use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class RelationalSchemaGenerator method addCodeListTables.
private void addCodeListTables(RelationalSchema rs) throws CollectRdbException {
Survey survey = rs.getSurvey();
List<CodeList> codeLists = survey.getCodeLists();
for (CodeList codeList : codeLists) {
addCodeListTable(rs, codeList);
}
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class RecordUpdater method isDefaultValueToBeApplied.
private boolean isDefaultValueToBeApplied(Attribute<?, ?> attr) {
Survey survey = attr.getSurvey();
if (survey instanceof CollectSurvey) {
CollectAnnotations annotations = ((CollectSurvey) survey).getAnnotations();
Step recordStep = ((CollectRecord) attr.getRecord()).getStep();
AttributeDefinition def = attr.getDefinition();
Step stepToApplyDefaultValue = annotations.getPhaseToApplyDefaultValue(def);
return recordStep.compareTo(stepToApplyDefaultValue) >= 0;
} else {
return false;
}
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class ExpressionValidatorTest method testExistingPath.
@Test
public void testExistingPath() {
Survey survey = survey(attributeDef("region"), entityDef("time_study", attributeDef("date"), attributeDef("time")));
assertValidExpression(survey, "root/region", "time_study/date");
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class ExpressionValidatorTest method testConstantString.
@Test
public void testConstantString() {
Survey survey = survey(attributeDef("region"));
assertValidExpression(survey, "root/region", "'test'");
}
use of org.openforis.idm.metamodel.Survey in project collect by openforis.
the class ExpressionValidatorTest method testIndependentCustomFunction.
@Test
public void testIndependentCustomFunction() {
Survey survey = survey(attributeDef("region"));
assertValidExpression(survey, "root/region", "idm:currentDate()");
}
Aggregations