use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class CSVDataImportProcess method createParentEntitySearchError.
private ParsingError createParentEntitySearchError(CollectRecord record, DataLine line, EntityIdentifier<?> identifier, String messageKey) {
EntityIdentifierDefinition identifierDefn = identifier.getDefinition();
Survey survey = record.getSurvey();
Schema schema = survey.getSchema();
EntityDefinition parentEntityDefn = (EntityDefinition) schema.getDefinitionById(identifierDefn.getEntityDefinitionId());
String[] colNames = DataCSVReader.getKeyAttributeColumnNames(parentEntityDefn, parentEntityDefn.getKeyAttributeDefinitions());
ParsingError error = new ParsingError(ErrorType.INVALID_VALUE, line.getLineNumber(), colNames, messageKey);
List<String> recordKeys = record.getRootEntityKeyValues();
CollectionUtils.filter(recordKeys, new Predicate() {
@Override
public boolean evaluate(Object object) {
return StringUtils.isNotBlank((String) object);
}
});
String jointRecordKeys = StringUtils.join(recordKeys, ", ");
String jointParentEntityKeys = identifier instanceof EntityPositionIdentifier ? "[" + ((EntityPositionIdentifier) identifier).getPosition() + "]" : StringUtils.join(((EntityKeysIdentifier) identifier).getKeyValues(), ", ");
error.setMessageArgs(new String[] { parentEntityDefn.getName(), jointParentEntityKeys, jointRecordKeys });
return error;
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class CodeListPR method addCodeListToSurvey.
protected void addCodeListToSurvey() {
Survey survey = list.getSurvey();
survey.addCodeList(list);
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class CodeListPR method onStartTag.
@Override
protected void onStartTag() throws XmlParseException {
int id = getIntegerAttribute(ID, true);
String name = getAttribute(NAME, false);
String lookupTable = getAttribute(LOOKUP, false);
String since = getAttribute(SINCE, false);
String deprecated = getAttribute(DEPRECATED, false);
Survey survey = getSurvey();
list = survey.createCodeList(id);
list.setName(name);
list.setLookupTable(lookupTable);
list.setSinceVersionByName(since);
list.setDeprecatedVersionByName(deprecated);
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class CalculatedAttributeDependencyGraph method determineDependents.
@Override
protected Set<NodePathPointer> determineDependents(Node<?> source) throws InvalidExpressionException {
Survey survey = source.getSurvey();
Set<NodePathPointer> dependentPointers = survey.getCalculatedValueDependencies(source.getDefinition());
return dependentPointers;
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class MinCountDependencyGraph method determineDependents.
@Override
protected Set<NodePathPointer> determineDependents(NodePointer source) throws InvalidExpressionException {
NodeDefinition def = source.getChildDefinition();
Survey survey = def.getSurvey();
Set<NodePathPointer> minCountDependencies = survey.getMinCountDependencies(def);
return filterByVersion(minCountDependencies, source.getModelVersion());
}
Aggregations