use of org.openforis.idm.testfixture.NodeDefinitionBuilder.EntityDefinitionBuilder in project collect by openforis.
the class SurveyBuilder method build.
public Survey build() {
EntityDefinitionBuilder rootEntityBuilder = NodeDefinitionBuilder.rootEntityDef("root", rootEntityNodeBuilders);
rootEntityBuilder.buildInternal(survey);
return survey;
}
use of org.openforis.idm.testfixture.NodeDefinitionBuilder.EntityDefinitionBuilder in project collect by openforis.
the class SurveyBuilder method survey.
public static Survey survey(NodeDefinitionBuilder... builders) {
String rootEntityName = "root";
Survey survey = new TestSurveyContext().createSurvey();
EntityDefinitionBuilder entityBuilder = new EntityDefinitionBuilder(rootEntityName, builders);
EntityDefinition rootEntityDef = (EntityDefinition) entityBuilder.buildInternal(survey);
Schema schema = survey.getSchema();
if (schema.getRootEntityDefinition(rootEntityName) != null) {
schema.removeRootEntityDefinition(rootEntityName);
}
schema.addRootEntityDefinition(rootEntityDef);
survey.refreshSurveyDependencies();
return survey;
}
Aggregations