use of org.openforis.idm.metamodel.Schema in project collect by openforis.
the class StateDependencyMap method registerDependencies.
private void registerDependencies(Survey survey) {
Schema schema = survey.getSchema();
List<EntityDefinition> rootEntityDefinitions = schema.getRootEntityDefinitions();
for (EntityDefinition entityDefinition : rootEntityDefinitions) {
registerDependencies(entityDefinition);
}
}
use of org.openforis.idm.metamodel.Schema in project collect by openforis.
the class DataHandler method getNodeDefinition.
private NodeDefinition getNodeDefinition(Entity parentEntity, String localName, Attributes attributes) {
NodeDefinition newDefn = null;
EntityDefinition parentEntityDefn = parentEntity.getDefinition();
Schema originalSchema = recordSurvey.getSchema();
EntityDefinition originlParentEntityDefn = (EntityDefinition) originalSchema.getDefinitionById(parentEntityDefn.getId());
NodeDefinition originalDefn = originlParentEntityDefn.getChildDefinition(localName);
if (originalDefn != null) {
Schema newSchema = currentSurvey.getSchema();
newDefn = newSchema.getDefinitionById(originalDefn.getId());
}
return newDefn;
}
use of org.openforis.idm.metamodel.Schema in project collect by openforis.
the class SchemaVM method createEntityDefinition.
protected EntityDefinition createEntityDefinition() {
Schema schema = survey.getSchema();
EntityDefinition newNode = schema.createEntityDefinition();
return newNode;
}
use of org.openforis.idm.metamodel.Schema in project collect by openforis.
the class SchemaVM method moveNode.
protected void moveNode(int newIndexInTree) {
SurveyObject surveyObject = selectedTreeNode.getSurveyObject();
List<SurveyObject> siblings = getSiblingsInTree(surveyObject);
SurveyObject newIndexItem = siblings.get(newIndexInTree);
SchemaTreeNode newIndexNode = treeModel.getTreeNode(newIndexItem);
int newIndexInModel = newIndexNode.getIndexInModel();
if (surveyObject instanceof NodeDefinition) {
NodeDefinition nodeDefn = (NodeDefinition) surveyObject;
EntityDefinition parentEntity = nodeDefn.getParentEntityDefinition();
if (parentEntity != null) {
parentEntity.moveChildDefinition(nodeDefn, newIndexInModel);
} else {
EntityDefinition rootEntity = nodeDefn.getRootEntity();
Schema schema = rootEntity.getSchema();
schema.moveRootEntityDefinition(rootEntity, newIndexInModel);
}
} else {
UITab tab = (UITab) surveyObject;
UITabSet parent = tab.getParent();
parent.moveTab(tab, newIndexInModel);
}
treeModel.moveSelectedNode(newIndexInTree);
notifyChange("treeModel", "moveNodeUpDisabled", "moveNodeDownDisabled");
dispatchSurveyChangedCommand();
}
use of org.openforis.idm.metamodel.Schema in project collect by openforis.
the class NewSurveyParametersPopUpVM method createEmptySurvey.
protected CollectSurvey createEmptySurvey(String name, String langCode) {
// create empty survey
CollectSurvey survey = surveyManager.createTemporarySurvey(name, langCode);
// add default root entity
Schema schema = survey.getSchema();
EntityDefinition rootEntity = schema.createEntityDefinition();
rootEntity.setMultiple(true);
rootEntity.setName(SurveyController.DEFAULT_ROOT_ENTITY_NAME);
schema.addRootEntityDefinition(rootEntity);
// create root tab set
UIOptions uiOptions = survey.getUIOptions();
UITabSet rootTabSet = uiOptions.createRootTabSet((EntityDefinition) rootEntity);
UITab mainTab = uiOptions.getMainTab(rootTabSet);
mainTab.setLabel(langCode, SurveyController.DEFAULT_MAIN_TAB_LABEL);
SurveyObjectsGenerator surveyObjectsGenerator = new SurveyObjectsGenerator();
surveyObjectsGenerator.addPredefinedObjects(survey);
return survey;
}
Aggregations