Commit 7aad9140 authored by Matija Obreza's avatar Matija Obreza
Browse files

COLLSRC is int, don't add null values to Lists

parent e0cd990b
......@@ -51,7 +51,7 @@ public class RowConverter {
Object mapValue = map.get(columnDef.getRdfTerm());
if (mapValue == null) {
_log.debug("Addding value for " + columnDef.getRdfTerm() + " val=" + rowValue);
_log.debug("Adding value for " + columnDef.getRdfTerm() + " val=" + rowValue);
if (rowValue instanceof String[]) {
_log.debug("val=" + ArrayUtils.toString(rowValue));
map.put(columnDef.getRdfTerm(), new ArrayList<String>(Arrays.asList((String[]) rowValue)));
......@@ -62,10 +62,10 @@ public class RowConverter {
_log.debug("Adding " + columnDef.getRdfTerm() + " to List<?>" + " val=" + rowValue);
if (rowValue instanceof String[]) {
((List<Object>) mapValue).addAll(Arrays.asList((String[]) rowValue));
} else {
} else if (rowValue != null) {
((List<Object>) mapValue).add(rowValue);
}
} else {
} else if (rowValue != null) {
_log.debug("Converting " + columnDef.getRdfTerm() + " to List<?>" + " val=" + rowValue);
Object currentVal = mapValue;
List<Object> newVal = new ArrayList<Object>();
......@@ -125,8 +125,9 @@ public class RowConverter {
Matcher matcher = pat.matcher(trim);
if (matcher.find()) {
String res = matcher.groupCount() == 0 ? matcher.group() : matcher.group(1);
// System.err.println("Pattern=" + pattern + " groups=" + matcher.groupCount() + " res=" + res);
// throw new RuntimeException("foobar");
// System.err.println("Pattern=" + pattern + " groups=" +
// matcher.groupCount() + " res=" + res);
// throw new RuntimeException("foobar");
return res;
}
return null;
......@@ -138,7 +139,8 @@ public class RowConverter {
return columnDef;
}
}
// _log.trace("ColumnDef not found for column=" + column.getPreferredName() + " term=" + column.getRdfTerm());
// _log.trace("ColumnDef not found for column=" +
// column.getPreferredName() + " term=" + column.getRdfTerm());
return null;
}
......@@ -176,7 +178,8 @@ public class RowConverter {
int dotPost = fieldName.lastIndexOf('.');
if (dotPost > -1)
fieldName = fieldName.substring(dotPost + 1);
// System.err.println(">> " + jsonField.getFieldName() + " field=" + fieldName);
// System.err.println(">> " + jsonField.getFieldName() + " field=" +
// fieldName);
JsonNode valueNode = containerNode.get(fieldName);
if (valueNode == null) {
......@@ -197,7 +200,8 @@ public class RowConverter {
arrayNode.add(coerce(jsonField.getType(), rdfValue));
}
} else {
// System.err.println("Putting field=" + fieldName + " type=" + rdfValues.getClass());
// System.err.println("Putting field=" + fieldName + " type=" +
// rdfValues.getClass());
containerNode.set(fieldName, coerce(jsonField.getType(), rdfValues));
}
}
......
......@@ -141,7 +141,7 @@ public class GenesysJSON {
columnDef = new JsonField("ancest", RdfMCPD.ANCEST);
columns.add(columnDef);
columnDef = new JsonField("collSrc", RdfMCPD.COLLSRC);
columnDef = new JsonField("collSrc", RdfMCPD.COLLSRC).setType(int.class);
columns.add(columnDef);
columnDef = new JsonField("donorCode", RdfMCPD.DONORCODE);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment