use of org.openforis.idm.model.AbstractValue in project collect by openforis.
the class CSVDataImportProcess method setRecordKeys.
private void setRecordKeys(DataLine line, CollectRecord record) {
EntityDefinition rootEntityDefn = record.getRootEntity().getDefinition();
Value[] recordKeyValues = line.getRecordKeyValues(rootEntityDefn);
List<AttributeDefinition> keyAttributeDefinitions = rootEntityDefn.getKeyAttributeDefinitions();
for (int i = 0; i < keyAttributeDefinitions.size(); i++) {
AttributeDefinition keyDefn = keyAttributeDefinitions.get(i);
// for record key attributes, absolute path must be equal to relative path
Attribute<?, ?> keyAttr = record.findNodeByPath(keyDefn.getPath());
Value keyVal = recordKeyValues[i];
setValueInField(keyAttr, keyDefn.getMainFieldName(), ((AbstractValue) keyVal).toInternalString(), line.getLineNumber(), null);
}
}
Aggregations