Search in sources :

Example 26 with ModelVersion

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

the class VersionableItemFormObject method saveTo.

@Override
public void saveTo(T dest, String languageCode) {
    Survey survey = dest.getSurvey();
    ModelVersion sinceVersion = null;
    if (sinceVersionId > 0) {
        sinceVersion = survey.getVersionById(sinceVersionId);
    }
    dest.setSinceVersion(sinceVersion);
    ModelVersion deprecatedVersion = null;
    if (deprecatedVersionId > 0) {
        deprecatedVersion = survey.getVersionById(deprecatedVersionId);
    }
    dest.setDeprecatedVersion(deprecatedVersion);
}
Also used : Survey(org.openforis.idm.metamodel.Survey) ModelVersion(org.openforis.idm.metamodel.ModelVersion)

Example 27 with ModelVersion

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

the class VersionableItemFormObject method loadFrom.

@Override
public void loadFrom(T source, String languageCode) {
    super.loadFrom(source, languageCode);
    ModelVersion sinceVersion = source.getSinceVersion();
    sinceVersionId = sinceVersion != null ? sinceVersion.getId() : -1;
    ModelVersion deprecatedVersion = source.getDeprecatedVersion();
    deprecatedVersionId = deprecatedVersion != null ? deprecatedVersion.getId() : -1;
}
Also used : ModelVersion(org.openforis.idm.metamodel.ModelVersion)

Example 28 with ModelVersion

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

the class SchemaLayoutVM method getFormVersions.

public List<ModelVersion> getFormVersions() {
    CollectSurvey survey = getSurvey();
    List<ModelVersion> result = new ArrayList<ModelVersion>(survey.getVersions());
    return new BindingListModelList<ModelVersion>(result, false);
}
Also used : ArrayList(java.util.ArrayList) ModelVersion(org.openforis.idm.metamodel.ModelVersion) CollectSurvey(org.openforis.collect.model.CollectSurvey) BindingListModelList(org.zkoss.zkplus.databind.BindingListModelList)

Example 29 with ModelVersion

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

the class SchemaLayoutVM method initTreeModel.

protected void initTreeModel() {
    CollectSurvey survey = getSurvey();
    ModelVersion formVersion = getFormVersion();
    treeModel = SchemaTreeModel.createInstance(survey, formVersion, true);
}
Also used : ModelVersion(org.openforis.idm.metamodel.ModelVersion) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 30 with ModelVersion

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

the class CodeListManager method loadPersistedItem.

protected PersistedCodeListItem loadPersistedItem(CodeAttribute attribute) {
    Code code = attribute.getValue();
    if (code == null || StringUtils.isBlank(code.getCode())) {
        return null;
    } else {
        String codeVal = code.getCode();
        CodeAttributeDefinition defn = attribute.getDefinition();
        CodeList list = defn.getList();
        Record record = attribute.getRecord();
        ModelVersion version = record.getVersion();
        if (StringUtils.isBlank(defn.getParentExpression())) {
            CodeListItem item = codeListItemDao.loadRootItem(list, codeVal, version);
            return (PersistedCodeListItem) item;
        } else {
            PersistedCodeListItem parentItem = (PersistedCodeListItem) loadParentItem(attribute);
            if (parentItem == null) {
                return null;
            } else {
                CodeListItem item = codeListItemDao.loadItem(list, parentItem.getSystemId(), codeVal, version);
                return (PersistedCodeListItem) item;
            }
        }
    }
}
Also used : CodeList(org.openforis.idm.metamodel.CodeList) CodeAttributeDefinition(org.openforis.idm.metamodel.CodeAttributeDefinition) Record(org.openforis.idm.model.Record) ModelVersion(org.openforis.idm.metamodel.ModelVersion) ExternalCodeListItem(org.openforis.idm.metamodel.ExternalCodeListItem) PersistedCodeListItem(org.openforis.idm.metamodel.PersistedCodeListItem) CodeListItem(org.openforis.idm.metamodel.CodeListItem) Code(org.openforis.idm.model.Code) PersistedCodeListItem(org.openforis.idm.metamodel.PersistedCodeListItem)

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