Search in sources :

Example 11 with ModelVersion

use of org.openforis.idm.metamodel.ModelVersion in project collect by openforis.

the class SurveyBaseVM method getVersionLabel.

public String getVersionLabel(int id) {
    if (id > 0) {
        CollectSurvey survey = getSurvey();
        ModelVersion version = survey.getVersionById(id);
        String result = null;
        if (version != null) {
            result = version.getLabel(currentLanguageCode);
            if (result == null) {
                result = version.getName();
            }
        }
        return result;
    } else {
        return Labels.getLabel(EMPTY_OPTION);
    }
}
Also used : ModelVersion(org.openforis.idm.metamodel.ModelVersion) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 12 with ModelVersion

use of org.openforis.idm.metamodel.ModelVersion in project collect by openforis.

the class SurveyBaseVM method getFormVersionIdsWithEmptyOption.

public List<Integer> getFormVersionIdsWithEmptyOption() {
    List<ModelVersion> versions = getSurveyFormVersions();
    List<Integer> result = new ArrayList<Integer>();
    result.add(0, -1);
    for (ModelVersion modelVersion : versions) {
        result.add(modelVersion.getId());
    }
    return new BindingListModelList<Integer>(result, false);
}
Also used : ArrayList(java.util.ArrayList) ModelVersion(org.openforis.idm.metamodel.ModelVersion) BindingListModelList(org.zkoss.zkplus.databind.BindingListModelList)

Example 13 with ModelVersion

use of org.openforis.idm.metamodel.ModelVersion in project collect by openforis.

the class EditableListOfNodesVM method getChildDefinitionsInTab.

public List<NodeDefinition> getChildDefinitionsInTab(EntityDefinition entityDefn) {
    UIOptions uiOpts = getUIOptions();
    List<NodeDefinition> childDefinitions = entityDefn.getChildDefinitions();
    List<NodeDefinition> result = new ArrayList<NodeDefinition>();
    ModelVersion formVersion = getLayoutFormVersion();
    for (NodeDefinition nodeDefn : childDefinitions) {
        if (formVersion == null || formVersion.isApplicable(nodeDefn)) {
            UITab nodeTab = uiOpts.getAssignedTab(nodeDefn);
            if (nodeTab == tab) {
                result.add(nodeDefn);
            }
        }
    }
    return result;
}
Also used : UITab(org.openforis.collect.metamodel.ui.UITab) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) ArrayList(java.util.ArrayList) ModelVersion(org.openforis.idm.metamodel.ModelVersion)

Example 14 with ModelVersion

use of org.openforis.idm.metamodel.ModelVersion in project collect by openforis.

the class EditableListOfNodesVM method getChildDefinitions.

public List<NodeDefinition> getChildDefinitions(EntityDefinition entityDefn) {
    List<NodeDefinition> result = new ArrayList<NodeDefinition>();
    List<NodeDefinition> childDefinitions = entityDefn.getChildDefinitions();
    ModelVersion formVersion = getLayoutFormVersion();
    for (NodeDefinition nodeDefn : childDefinitions) {
        if (formVersion == null || formVersion.isApplicable(nodeDefn)) {
            result.add(nodeDefn);
        }
    }
    return childDefinitions;
}
Also used : NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) ArrayList(java.util.ArrayList) ModelVersion(org.openforis.idm.metamodel.ModelVersion)

Example 15 with ModelVersion

use of org.openforis.idm.metamodel.ModelVersion in project collect by openforis.

the class TabsGroupPanelVM method getNodesPerTab.

public List<NodeDefinition> getNodesPerTab() {
    UIOptions uiOpts = getUIOptions();
    List<NodeDefinition> result = new ArrayList<NodeDefinition>();
    List<NodeDefinition> nodesPerTab = uiOpts.getNodesPerTab(tab, false);
    ModelVersion version = getFormVersion();
    for (NodeDefinition nodeDefn : nodesPerTab) {
        if (version == null || version.isApplicable(nodeDefn)) {
            result.add(nodeDefn);
        }
    }
    return result;
}
Also used : UIOptions(org.openforis.collect.metamodel.ui.UIOptions) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) ArrayList(java.util.ArrayList) ModelVersion(org.openforis.idm.metamodel.ModelVersion)

Aggregations

ModelVersion (org.openforis.idm.metamodel.ModelVersion)40 ArrayList (java.util.ArrayList)9 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)9 Record (org.openforis.idm.model.Record)9 CollectSurvey (org.openforis.collect.model.CollectSurvey)7 CodeAttributeDefinition (org.openforis.idm.metamodel.CodeAttributeDefinition)7 CodeListItem (org.openforis.idm.metamodel.CodeListItem)7 CodeList (org.openforis.idm.metamodel.CodeList)5 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)5 ExternalCodeListItem (org.openforis.idm.metamodel.ExternalCodeListItem)5 PersistedCodeListItem (org.openforis.idm.metamodel.PersistedCodeListItem)5 CodeAttribute (org.openforis.idm.model.CodeAttribute)5 Code (org.openforis.idm.model.Code)4 Entity (org.openforis.idm.model.Entity)4 SessionStatus (org.openforis.collect.designer.session.SessionStatus)2 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)2 Survey (org.openforis.idm.metamodel.Survey)2 NodePointer (org.openforis.idm.model.NodePointer)2 Command (org.zkoss.bind.annotation.Command)2 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)2