Search in sources :

Example 1 with EntityDefinitionBuilder

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;
}
Also used : EntityDefinitionBuilder(org.openforis.idm.testfixture.NodeDefinitionBuilder.EntityDefinitionBuilder)

Example 2 with EntityDefinitionBuilder

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;
}
Also used : EntityDefinition(org.openforis.idm.metamodel.EntityDefinition) Survey(org.openforis.idm.metamodel.Survey) EntityDefinitionBuilder(org.openforis.idm.testfixture.NodeDefinitionBuilder.EntityDefinitionBuilder) TestSurveyContext(org.openforis.idm.model.TestSurveyContext) Schema(org.openforis.idm.metamodel.Schema)

Aggregations

EntityDefinitionBuilder (org.openforis.idm.testfixture.NodeDefinitionBuilder.EntityDefinitionBuilder)2 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)1 Schema (org.openforis.idm.metamodel.Schema)1 Survey (org.openforis.idm.metamodel.Survey)1 TestSurveyContext (org.openforis.idm.model.TestSurveyContext)1