Search in sources :

Example 6 with FormProcessor

use of org.akaza.openclinica.control.form.FormProcessor in project OpenClinica by OpenClinica.

the class ViewEventCRFContentServlet method processRequest.

@Override
public void processRequest() throws Exception {
    FormProcessor fp = new FormProcessor(request);
    int eventCRFId = fp.getInt("ecId", true);
    int studySubId = fp.getInt("id", true);
    int eventId = fp.getInt("eventId", true);
    if (eventCRFId == 0) {
        addPageMessage(respage.getString("please_choose_an_event_CRF_to_view"));
        forwardPage(Page.VIEW_STUDY_SUBJECT_SERVLET);
        return;
    }
    StudyEventBean seb = getStudyEvent(eventId);
    StudySubjectDAO subdao = new StudySubjectDAO(sm.getDataSource());
    StudySubjectBean studySub = (StudySubjectBean) subdao.findByPK(studySubId);
    request.setAttribute("studySub", studySub);
    EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
    EventCRFBean eventCRF = (EventCRFBean) ecdao.findByPK(eventCRFId);
    DisplayTableOfContentsBean displayBean = TableOfContentsServlet.getDisplayBean(eventCRF, sm.getDataSource(), currentStudy);
    request.setAttribute("toc", displayBean);
    request.getSession().setAttribute(BEAN_STUDY_EVENT, seb);
    forwardPage(Page.VIEW_EVENT_CRF_CONTENT);
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) DisplayTableOfContentsBean(org.akaza.openclinica.bean.submit.DisplayTableOfContentsBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 7 with FormProcessor

use of org.akaza.openclinica.control.form.FormProcessor in project OpenClinica by OpenClinica.

the class UpdateStudyServlet method createStudyBean.

/**
     * Constructs study bean from request-first section
     * 
     * @param request
     * @return
     */
private StudyBean createStudyBean() {
    FormProcessor fp = new FormProcessor(request);
    StudyBean newStudy = (StudyBean) session.getAttribute("newStudy");
    newStudy.setName(fp.getString("name"));
    newStudy.setOfficialTitle(fp.getString("officialTitle"));
    newStudy.setIdentifier(fp.getString("uniqueProId"));
    newStudy.setSecondaryIdentifier(fp.getString("secondProId"));
    newStudy.setPrincipalInvestigator(fp.getString("prinInvestigator"));
    newStudy.setSummary(fp.getString("description"));
    newStudy.setProtocolDescription(fp.getString("protocolDescription"));
    newStudy.setSponsor(fp.getString("sponsor"));
    newStudy.setCollaborators(fp.getString("collaborators"));
    return newStudy;
}
Also used : FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean)

Example 8 with FormProcessor

use of org.akaza.openclinica.control.form.FormProcessor in project OpenClinica by OpenClinica.

the class UpdateStudyServlet method confirmStudy5.

/**
     * Validates the forth section of study and save it into study bean
     * 
     * @param request
     * @param response
     * @throws Exception
     */
private void confirmStudy5() throws Exception {
    FormProcessor fp = new FormProcessor(request);
    Validator v = new Validator(request);
    if (!StringUtil.isBlank(fp.getString("facConEmail"))) {
        v.addValidation("facConEmail", Validator.IS_A_EMAIL);
    }
    v.addValidation("facName", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 255);
    v.addValidation("facCity", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 255);
    v.addValidation("facState", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 20);
    v.addValidation("facZip", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 64);
    v.addValidation("facCountry", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 64);
    v.addValidation("facConName", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 255);
    v.addValidation("facConDegree", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 255);
    v.addValidation("facConPhone", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 255);
    v.addValidation("facConEmail", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 255);
    errors = v.validate();
    StudyBean newStudy = (StudyBean) session.getAttribute("newStudy");
    newStudy.setFacilityCity(fp.getString("facCity"));
    newStudy.setFacilityContactDegree(fp.getString("facConDrgree"));
    newStudy.setFacilityName(fp.getString("facName"));
    newStudy.setFacilityContactEmail(fp.getString("facConEmail"));
    newStudy.setFacilityContactPhone(fp.getString("facConPhone"));
    newStudy.setFacilityContactName(fp.getString("facConName"));
    newStudy.setFacilityCountry(fp.getString("facCountry"));
    newStudy.setFacilityContactDegree(fp.getString("facConDegree"));
    // newStudy.setFacilityRecruitmentStatus(fp.getString("facRecStatus"));
    newStudy.setFacilityState(fp.getString("facState"));
    newStudy.setFacilityZip(fp.getString("facZip"));
    session.setAttribute("newStudy", newStudy);
    if (errors.isEmpty()) {
        forwardPage(Page.UPDATE_STUDY7);
    } else {
        request.setAttribute("formMessages", errors);
        request.setAttribute("facRecruitStatusMap", CreateStudyServlet.facRecruitStatusMap);
        forwardPage(Page.UPDATE_STUDY6);
    }
}
Also used : FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) Validator(org.akaza.openclinica.control.form.Validator)

Example 9 with FormProcessor

use of org.akaza.openclinica.control.form.FormProcessor in project OpenClinica by OpenClinica.

the class UpdateStudyServletNew method processRequest.

@Override
public void processRequest() throws Exception {
    resetPanel();
    FormProcessor fp = new FormProcessor(request);
    Validator v = new Validator(request);
    int studyId = fp.getInt("id");
    studyId = studyId == 0 ? fp.getInt("studyId") : studyId;
    String action = fp.getString("action");
    StudyDAO sdao = new StudyDAO(sm.getDataSource());
    boolean isInterventional = false;
    study = (StudyBean) sdao.findByPK(studyId);
    if (study.getId() != currentStudy.getId()) {
        addPageMessage(respage.getString("not_current_study") + respage.getString("change_study_contact_sysadmin"));
        forwardPage(Page.MENU_SERVLET);
        return;
    }
    study.setId(studyId);
    StudyConfigService scs = new StudyConfigService(sm.getDataSource());
    study = scs.setParametersForStudy(study);
    request.setAttribute("studyToView", study);
    request.setAttribute("studyId", studyId + "");
    request.setAttribute("studyPhaseMap", CreateStudyServlet.studyPhaseMap);
    ArrayList statuses = Status.toStudyUpdateMembersList();
    statuses.add(Status.PENDING);
    request.setAttribute("statuses", statuses);
    String interventional = resadmin.getString("interventional");
    isInterventional = interventional.equalsIgnoreCase(study.getProtocolType());
    request.setAttribute("isInterventional", isInterventional ? "1" : "0");
    String protocolType = study.getProtocolTypeKey();
    // A. Hamid. 5001
    if (study.getParentStudyId() > 0) {
        StudyBean parentStudy = (StudyBean) sdao.findByPK(study.getParentStudyId());
        request.setAttribute("parentStudy", parentStudy);
    }
    ArrayList interventionArray = new ArrayList();
    if (isInterventional) {
        interventionArray = parseInterventions(study);
        setMaps(isInterventional, interventionArray);
    } else {
        setMaps(isInterventional, interventionArray);
    }
    if (!action.equals("submit")) {
        // First Load First Form
        if (study.getDatePlannedStart() != null) {
            fp.addPresetValue(INPUT_START_DATE, local_df.format(study.getDatePlannedStart()));
        }
        if (study.getDatePlannedEnd() != null) {
            fp.addPresetValue(INPUT_END_DATE, local_df.format(study.getDatePlannedEnd()));
        }
        if (study.getProtocolDateVerification() != null) {
            fp.addPresetValue(INPUT_VER_DATE, local_df.format(study.getProtocolDateVerification()));
        }
        setPresetValues(fp.getPresetValues());
    // first load 2nd form
    }
    if (study == null) {
        addPageMessage(respage.getString("please_choose_a_study_to_edit"));
        forwardPage(Page.STUDY_LIST_SERVLET);
        return;
    }
    if (action.equals("submit")) {
        validateStudy1(fp, v);
        validateStudy2(fp, new Validator(request));
        validateStudy3(isInterventional, new Validator(request), fp);
        validateStudy4(fp, new Validator(request));
        validateStudy5(fp, new Validator(request));
        validateStudy6(fp, new Validator(request));
        confirmWholeStudy(fp);
        request.setAttribute("studyToView", study);
        if (!errors.isEmpty()) {
            logger.error("found errors : " + errors.toString());
            request.setAttribute("formMessages", errors);
            forwardPage(Page.UPDATE_STUDY_NEW);
        } else {
            study.setProtocolType(protocolType);
            submitStudy(study);
            addPageMessage(respage.getString("the_study_has_been_updated_succesfully"));
            ArrayList pageMessages = (ArrayList) request.getAttribute(PAGE_MESSAGE);
            session.setAttribute("pageMessages", pageMessages);
            response.sendRedirect(request.getContextPath() + "/pages/studymodule");
        // forwardPage(Page.MANAGE_STUDY_MODULE);
        }
    } else {
        forwardPage(Page.UPDATE_STUDY_NEW);
    }
}
Also used : StudyConfigService(org.akaza.openclinica.dao.service.StudyConfigService) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) Validator(org.akaza.openclinica.control.form.Validator)

Example 10 with FormProcessor

use of org.akaza.openclinica.control.form.FormProcessor in project OpenClinica by OpenClinica.

the class UpdateStudyServlet method confirmStudy4.

/**
     * Validates the forth section of study and save it into study bean
     * 
     * @param request
     * @param response
     * @throws Exception
     */
private void confirmStudy4() throws Exception {
    FormProcessor fp = new FormProcessor(request);
    Validator v = new Validator(request);
    v.addValidation("conditions", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 500);
    v.addValidation("keywords", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 255);
    v.addValidation("eligibility", Validator.LENGTH_NUMERIC_COMPARISON, NumericComparisonOperator.LESS_THAN_OR_EQUAL_TO, 500);
    errors = v.validate();
    if (fp.getInt("expectedTotalEnrollment") <= 0) {
        Validator.addError(errors, "expectedTotalEnrollment", respage.getString("expected_total_enrollment_must_be_a_positive_number"));
    }
    StudyBean newStudy = (StudyBean) session.getAttribute("newStudy");
    newStudy.setConditions(fp.getString("conditions"));
    newStudy.setKeywords(fp.getString("keywords"));
    newStudy.setEligibility(fp.getString("eligibility"));
    newStudy.setGender(fp.getString("gender"));
    newStudy.setAgeMax(fp.getString("ageMax"));
    newStudy.setAgeMin(fp.getString("ageMin"));
    newStudy.setHealthyVolunteerAccepted(fp.getBoolean("healthyVolunteerAccepted"));
    newStudy.setExpectedTotalEnrollment(fp.getInt("expectedTotalEnrollment"));
    session.setAttribute("newStudy", newStudy);
    request.setAttribute("facRecruitStatusMap", CreateStudyServlet.facRecruitStatusMap);
    if (errors.isEmpty()) {
        forwardPage(Page.UPDATE_STUDY6);
    } else {
        request.setAttribute("formMessages", errors);
        forwardPage(Page.UPDATE_STUDY5);
    }
}
Also used : FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) Validator(org.akaza.openclinica.control.form.Validator)

Aggregations

FormProcessor (org.akaza.openclinica.control.form.FormProcessor)224 ArrayList (java.util.ArrayList)139 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)92 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)73 HashMap (java.util.HashMap)69 Date (java.util.Date)49 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)48 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)46 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)46 Validator (org.akaza.openclinica.control.form.Validator)44 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)44 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)42 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)41 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)41 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)40 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)36 UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)36 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)35 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)35 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)35