Search in sources :

Example 11 with InconsistentStateException

use of org.akaza.openclinica.web.InconsistentStateException in project OpenClinica by OpenClinica.

the class TableOfContentsServlet method validateEventCRFAndAction.

private void validateEventCRFAndAction() throws Exception {
    if (invalidAction(action)) {
        throw new InconsistentStateException(Page.LIST_STUDY_SUBJECTS_SERVLET, resexception.getString("no_action_specified_or_invalid"));
    }
    if (!isConsistentAction(action, ecb)) {
        HashMap verbs = new HashMap();
        verbs.put(ACTION_START_INITIAL_DATA_ENTRY, resword.getString("start_initial_data_entry"));
        verbs.put(ACTION_CONTINUE_INITIAL_DATA_ENTRY, resword.getString("continue_initial_data_entry"));
        verbs.put(ACTION_START_DOUBLE_DATA_ENTRY, resword.getString("start_double_data_entry"));
        verbs.put(ACTION_CONTINUE_DOUBLE_DATA_ENTRY, resword.getString("continue_double_data_entry"));
        verbs.put(ACTION_ADMINISTRATIVE_EDITING, resword.getString("perform_administrative_editing"));
        String verb = (String) verbs.get(action);
        if (verb == null) {
            verb = "start initial data entry";
        }
        throw new InconsistentStateException(Page.LIST_STUDY_SUBJECTS_SERVLET, resexception.getString("you_are_trying_to") + verb + " " + resexception.getString("on_event_CRF_inappropiate_action"));
    }
    if (action.equals(ACTION_START_DOUBLE_DATA_ENTRY)) {
        ecb.setValidatorId(ub.getId());
        ecb.setDateValidate(new Date());
        ecb = (EventCRFBean) ecdao.update(ecb);
    }
}
Also used : HashMap(java.util.HashMap) InconsistentStateException(org.akaza.openclinica.web.InconsistentStateException) Date(java.util.Date)

Aggregations

InconsistentStateException (org.akaza.openclinica.web.InconsistentStateException)11 ArrayList (java.util.ArrayList)8 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)6 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)6 Date (java.util.Date)5 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)5 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)5 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)5 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)5 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)4 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)4 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)4 HashMap (java.util.HashMap)3 Iterator (java.util.Iterator)3 HttpSession (javax.servlet.http.HttpSession)3 StudyUserRoleBean (org.akaza.openclinica.bean.login.StudyUserRoleBean)3 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)3 DisplayTableOfContentsBean (org.akaza.openclinica.bean.submit.DisplayTableOfContentsBean)3 SessionManager (org.akaza.openclinica.core.SessionManager)3 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)3