Skip to content

Commit

Permalink
0001601: Add Map-based methods to TransformData so one can more easil…
Browse files Browse the repository at this point in the history
…y lookup target transform data
  • Loading branch information
mhanes committed Feb 24, 2014
1 parent 834760f commit 5896f8c
Showing 1 changed file with 28 additions and 14 deletions.
Expand Up @@ -119,19 +119,16 @@ public void put(TransformColumn column, String columnValue, boolean recordAsKey)
columnValues.put(column.getTargetColumnName(), columnValue);
}

protected List<String> retrieve(
Map<TransformColumn.IncludeOnType, LinkedHashMap<String, String>> source,
boolean getColumnNames) {

protected Map<String, String> retrieve(
Map<TransformColumn.IncludeOnType, LinkedHashMap<String, String>> source) {

List<String> list = new ArrayList<String>(source == null ? 0 : source.size());
Map<String, String> list = new LinkedHashMap<String, String>(source == null ? 0
: source.size());
if (source != null) {
LinkedHashMap<String, String> values = source.get(IncludeOnType.ALL);
if (values != null) {
if (getColumnNames) {
list.addAll(values.keySet());
} else {
list.addAll(values.values());
}
list.putAll(values);
}

IncludeOnType type = IncludeOnType.DELETE;
Expand All @@ -143,16 +140,33 @@ protected List<String> retrieve(

values = source.get(type);
if (values != null) {
if (getColumnNames) {
list.addAll(values.keySet());
} else {
list.addAll(values.values());
}
list.putAll(values);
}
}
return list;
}

protected List<String> retrieve(
Map<TransformColumn.IncludeOnType, LinkedHashMap<String, String>> source,
boolean getColumnNames) {
Map<String, String> values = retrieve(source);
if (getColumnNames) {
return new ArrayList<String>(values.keySet());
} else {
return new ArrayList<String>(values.values());
}
}


public Map<String, String> getTargetKeyValues() {
return retrieve(keysBy);
}

public Map<String, String> getTargetValues() {
return retrieve(columnsBy);
}


public String[] getKeyNames() {

List<String> list = retrieve(keysBy, true);
Expand Down

0 comments on commit 5896f8c

Please sign in to comment.