Search in sources :

Example 1 with SurveyStoreException

use of org.openforis.collect.persistence.SurveyStoreException in project collect by openforis.

the class SurveySelectVM method performSurveyPublishing.

protected void performSurveyPublishing(CollectSurvey survey, Binder binder) {
    try {
        User loggedUser = getLoggedUser();
        surveyManager.publish(survey, loggedUser);
        selectedSurvey = null;
        notifyChange("selectedSurvey");
        reloadSurveySummaries(binder);
        MessageUtil.showInfo("survey.successfully_published", survey.getName());
        surveyManager.validateRecords(survey.getId(), loggedUser);
    } catch (SurveyStoreException e) {
        throw new RuntimeException(e);
    }
}
Also used : User(org.openforis.collect.model.User) SurveyStoreException(org.openforis.collect.persistence.SurveyStoreException)

Example 2 with SurveyStoreException

use of org.openforis.collect.persistence.SurveyStoreException in project collect by openforis.

the class SurveySelectVM method performSelectedSurveyUnpublishing.

private void performSelectedSurveyUnpublishing(Binder binder) {
    try {
        Integer publishedSurveyId = selectedSurvey.isTemporary() ? selectedSurvey.getPublishedId() : selectedSurvey.getId();
        CollectSurvey temporarySurvey = surveyManager.unpublish(publishedSurveyId, getLoggedUser());
        selectedSurvey = null;
        notifyChange("selectedSurvey");
        reloadSurveySummaries(binder);
        MessageUtil.showInfo("survey.successfully_unpublished", temporarySurvey.getName());
    } catch (SurveyStoreException e) {
        throw new RuntimeException(e);
    }
}
Also used : SurveyStoreException(org.openforis.collect.persistence.SurveyStoreException) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 3 with SurveyStoreException

use of org.openforis.collect.persistence.SurveyStoreException in project collect by openforis.

the class SessionManager method saveActiveDesignerSurvey.

public void saveActiveDesignerSurvey() {
    try {
        SessionState sessionState = getSessionState();
        CollectSurvey survey = getActiveDesignerSurvey();
        boolean activeSurveyWork = sessionState.isActiveSurveyWork();
        if (activeSurveyWork) {
            surveyManager.save(survey);
        } else {
            throw new IllegalArgumentException("Active designer survey should be a 'work' survey");
        }
    } catch (SurveyStoreException e) {
        LOG.error("Error updating taxonomy related attributes.", e);
    }
}
Also used : SessionState(org.openforis.collect.web.session.SessionState) SurveyStoreException(org.openforis.collect.persistence.SurveyStoreException) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Aggregations

SurveyStoreException (org.openforis.collect.persistence.SurveyStoreException)3 CollectSurvey (org.openforis.collect.model.CollectSurvey)2 User (org.openforis.collect.model.User)1 SessionState (org.openforis.collect.web.session.SessionState)1