use of org.openforis.collect.io.data.DataLine.SingleEntityIdentifierDefinition in project collect by openforis.
the class DataCSVReader method getExpectedAncestorKeyColumnNames.
private List<String> getExpectedAncestorKeyColumnNames() {
List<EntityIdentifierDefinition> entityIdentifierDefns = getAncestorIdentifiers();
// validate ancestor key columns
Schema schema = parentEntityDefinition.getSchema();
List<String> expectedEntityKeyColumns = new ArrayList<String>();
for (EntityIdentifierDefinition identifier : entityIdentifierDefns) {
int defnId = identifier.getEntityDefinitionId();
EntityDefinition defn = (EntityDefinition) schema.getDefinitionById(defnId);
if (identifier instanceof EntityPositionIdentifierDefinition) {
String expectedColName = getPositionColumnName(defn);
expectedEntityKeyColumns.add(expectedColName);
} else if (identifier instanceof SingleEntityIdentifierDefinition) {
// skip
} else {
List<AttributeDefinition> keyDefns = defn.getKeyAttributeDefinitions();
for (AttributeDefinition keyDefn : keyDefns) {
List<String> expectedColNames = getKeyAttributeColumnNames(parentEntityDefinition, keyDefn);
expectedEntityKeyColumns.addAll(expectedColNames);
}
}
}
return expectedEntityKeyColumns;
}
Aggregations