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);
}
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;
}
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);
}
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);
}
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;
}
}
}
}
Aggregations