use of org.openforis.idm.metamodel.ModelVersion in project collect by openforis.
the class DataHandler method extractVersionName.
protected String extractVersionName(Attributes attributes) {
String versionName = null;
String recordVersionName = attributes.getValue(ATTRIBUTE_VERSION);
if (StringUtils.isNotBlank(recordVersionName)) {
ModelVersion recordVersion = recordSurvey.getVersion(recordVersionName);
if (recordVersion == null) {
throw new IllegalArgumentException(String.format("Record version with name %s not found in the survey", recordVersionName));
}
int versionId = recordVersion.getId();
ModelVersion version = currentSurvey.getVersionById(versionId);
if (version == null) {
throw new IllegalArgumentException(String.format("Record version with id %d not found in the current survey", versionId));
}
versionName = version.getName();
}
return versionName;
}
use of org.openforis.idm.metamodel.ModelVersion in project collect by openforis.
the class SchemaLayoutVM method nodeSelected.
@Command
@NotifyChange({ "rootTabSet" })
public void nodeSelected(@BindingParam("node") Treeitem node) {
List<ModelVersion> versions = survey.getVersions();
setFormVersion(versions.isEmpty() ? null : versions.get(0));
UITabSet tabSet = getRootTabSet(node);
refreshTabSetLayoutPanel(tabSet, false);
this.rootTabSet = tabSet;
dispatchTabSetChangedCommand();
}
use of org.openforis.idm.metamodel.ModelVersion in project collect by openforis.
the class RecordUpdaterTest method addModelVersion.
private void addModelVersion(CollectSurvey survey, String name, String date) {
ModelVersion version = survey.createModelVersion();
version.setName(name);
version.setDate(Dates.parseDate(date));
survey.addVersion(version);
}
use of org.openforis.idm.metamodel.ModelVersion in project collect by openforis.
the class SurveyEditVM method openPreviewPopUp.
private void openPreviewPopUp() {
if (isSingleRootEntityDefined() && survey.getVersions().size() <= 1) {
ModelVersion version = survey.getVersions().isEmpty() ? null : survey.getVersions().get(0);
openPreviewPopUp(version, survey.getSchema().getFirstRootEntityDefinition());
} else {
openPreviewPreferencesPopUp();
}
}
use of org.openforis.idm.metamodel.ModelVersion in project collect by openforis.
the class SchemaVM method versionSelected.
@Command
public void versionSelected(@BindingParam("version") Object version) {
ModelVersion modelVersion;
if (version == FormObject.VERSION_EMPTY_SELECTION) {
modelVersion = null;
} else {
modelVersion = (ModelVersion) version;
}
nodesTreeFilterChanged(selectedRootEntity, modelVersion);
}
Aggregations