Search in sources :

Example 41 with SessionState

use of org.openforis.collect.web.session.SessionState in project collect by openforis.

the class SessionManager method checkIsActiveRecordLocked.

public void checkIsActiveRecordLocked() throws RecordUnlockedException {
    SessionState sessionState = getSessionState();
    CollectRecord record = sessionState.getActiveRecord();
    if (record == null) {
        throw new RecordUnlockedException();
    } else if (record.getId() != null) {
        User user = sessionState.getUser();
        String lockId = sessionState.getSessionId();
        try {
            recordManager.checkIsLocked(record.getId(), user, lockId);
            sessionState.keepActiveRecordAlive();
        } catch (RecordUnlockedException e) {
            clearActiveRecord();
            throw e;
        }
    }
}
Also used : SessionState(org.openforis.collect.web.session.SessionState) CollectRecord(org.openforis.collect.model.CollectRecord) User(org.openforis.collect.model.User) RecordUnlockedException(org.openforis.collect.persistence.RecordUnlockedException)

Example 42 with SessionState

use of org.openforis.collect.web.session.SessionState 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)

Example 43 with SessionState

use of org.openforis.collect.web.session.SessionState in project collect by openforis.

the class SessionManager method setActiveRecord.

public void setActiveRecord(CollectRecord record) {
    SessionState sessionState = getSessionState();
    sessionState.setActiveRecord(record);
    sessionState.keepActiveRecordAlive();
}
Also used : SessionState(org.openforis.collect.web.session.SessionState)

Example 44 with SessionState

use of org.openforis.collect.web.session.SessionState in project collect by openforis.

the class SessionManager method setActiveSurvey.

public void setActiveSurvey(CollectSurvey survey) {
    SessionState sessionState = getSessionState();
    sessionState.setActiveSurvey(survey);
}
Also used : SessionState(org.openforis.collect.web.session.SessionState)

Aggregations

SessionState (org.openforis.collect.web.session.SessionState)44 CollectSurvey (org.openforis.collect.model.CollectSurvey)18 User (org.openforis.collect.model.User)16 CollectRecord (org.openforis.collect.model.CollectRecord)15 Secured (org.springframework.security.access.annotation.Secured)13 Step (org.openforis.collect.model.CollectRecord.Step)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8 RecordFilter (org.openforis.collect.model.RecordFilter)7 Locale (java.util.Locale)5 RecordStep (org.openforis.collect.event.RecordStep)5 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)5 File (java.io.File)3 HashMap (java.util.HashMap)3 CollectRecordSummary (org.openforis.collect.model.CollectRecordSummary)3 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)3 Transactional (org.springframework.transaction.annotation.Transactional)3 IOException (java.io.IOException)2 Date (java.util.Date)2 ServletOutputStream (javax.servlet.ServletOutputStream)2 BulkRecordMoveJob (org.openforis.collect.io.data.BulkRecordMoveJob)2