use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class SurveyBaseVM method initSurvey.
protected void initSurvey() {
if (survey == null) {
SessionStatus sessionStatus = getSessionStatus();
survey = sessionStatus.getSurvey();
}
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class NumericAttributeVM method getOldNodeDefinition.
protected NodeDefinition getOldNodeDefinition() {
SessionStatus sessionStatus = getSessionStatus();
Integer publishedSurveyId = sessionStatus.getPublishedSurveyId();
if (publishedSurveyId != null) {
CollectSurvey publishedSurvey = surveyManager.getById(publishedSurveyId);
Schema schema = publishedSurvey.getSchema();
int nodeId = editedItem.getId();
NodeDefinition oldDefn = schema.getDefinitionById(nodeId);
return oldDefn;
} else {
return null;
}
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class CodeListsVM method isCodeListInPublishedSurvey.
protected boolean isCodeListInPublishedSurvey() {
SessionStatus sessionStatus = getSessionStatus();
Integer publishedSurveyId = sessionStatus.getPublishedSurveyId();
if (publishedSurveyId != null) {
CollectSurvey publishedSurvey = surveyManager.getById(publishedSurveyId);
CodeList oldPublishedCodeList = publishedSurvey.getCodeListById(editedItem.getId());
return oldPublishedCodeList != null;
} else {
return false;
}
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class SurveyEditVM method resetSessionStatus.
protected void resetSessionStatus() {
SessionStatus sessionStatus = getSessionStatus();
sessionStatus.reset();
}
use of org.openforis.collect.designer.session.SessionStatus in project collect by openforis.
the class SurveyEditVM method init.
@Init(superclass = false)
public void init(@QueryParam("id") Integer surveyId) {
super.init();
survey = surveyManager.loadSurvey(surveyId);
if (survey == null || !survey.isTemporary()) {
backToSurveysList();
} else {
SessionStatus sessionStatus = getSessionStatus();
Integer publishedSurveyId = null;
if (survey.isPublished()) {
if (survey.isTemporary()) {
publishedSurveyId = survey.getPublishedId();
} else {
publishedSurveyId = survey.getId();
}
}
sessionStatus.setPublishedSurveyId(publishedSurveyId);
sessionStatus.setSurvey(survey);
changed = false;
currentLanguageCode = survey.getDefaultLanguage();
if (currentLanguageCode == null) {
openLanguageManagerPopUp();
} else {
sessionStatus.setCurrentLanguageCode(currentLanguageCode);
}
String confirmCloseMessage = Labels.getLabel("survey.edit.leave_page");
PageUtil.confirmClose(confirmCloseMessage);
}
}
Aggregations