Search in sources :

Example 11 with SessionStatus

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();
    }
}
Also used : SessionStatus(org.openforis.collect.designer.session.SessionStatus)

Example 12 with SessionStatus

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;
    }
}
Also used : SessionStatus(org.openforis.collect.designer.session.SessionStatus) Schema(org.openforis.idm.metamodel.Schema) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 13 with SessionStatus

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;
    }
}
Also used : CodeList(org.openforis.idm.metamodel.CodeList) SessionStatus(org.openforis.collect.designer.session.SessionStatus) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 14 with SessionStatus

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();
}
Also used : SessionStatus(org.openforis.collect.designer.session.SessionStatus)

Example 15 with SessionStatus

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);
    }
}
Also used : SessionStatus(org.openforis.collect.designer.session.SessionStatus) Init(org.zkoss.bind.annotation.Init)

Aggregations

SessionStatus (org.openforis.collect.designer.session.SessionStatus)21 CollectSurvey (org.openforis.collect.model.CollectSurvey)9 Command (org.zkoss.bind.annotation.Command)3 CodeList (org.openforis.idm.metamodel.CodeList)2 ModelVersion (org.openforis.idm.metamodel.ModelVersion)2 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)2 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)2 NotifyChange (org.zkoss.bind.annotation.NotifyChange)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 MessageUtil (org.openforis.collect.designer.util.MessageUtil)1 ConfirmParams (org.openforis.collect.designer.util.MessageUtil.ConfirmParams)1 CodeListImportProcess (org.openforis.collect.manager.codelistimport.CodeListImportProcess)1 CodeListImportStatus (org.openforis.collect.manager.codelistimport.CodeListImportStatus)1 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)1 UITabSet (org.openforis.collect.metamodel.ui.UITabSet)1 Schema (org.openforis.idm.metamodel.Schema)1 Secured (org.springframework.security.access.annotation.Secured)1 Init (org.zkoss.bind.annotation.Init)1