Search in sources :

Example 11 with StudyParameterValueDAO

use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.

the class DefineStudyEventServlet method confirmWholeDefinition.

/**
     * Validates the entire definition
     * 
     * @throws Exception
     */
private void confirmWholeDefinition() throws Exception {
    Validator v = new Validator(request);
    FormProcessor fp = new FormProcessor(request);
    StudyEventDefinitionBean sed = (StudyEventDefinitionBean) session.getAttribute("definition");
    ArrayList eventDefinitionCRFs = new ArrayList();
    FormLayoutDAO fldao = new FormLayoutDAO(sm.getDataSource());
    for (int i = 0; i < sed.getCrfs().size(); i++) {
        EventDefinitionCRFBean edcBean = new EventDefinitionCRFBean();
        int crfId = fp.getInt("crfId" + i);
        int defaultVersionId = fp.getInt("defaultVersionId" + i);
        edcBean.setCrfId(crfId);
        edcBean.setDefaultVersionId(defaultVersionId);
        FormLayoutBean defaultVersion = (FormLayoutBean) fldao.findByPK(edcBean.getDefaultVersionId());
        edcBean.setDefaultVersionName(defaultVersion.getName());
        String crfName = fp.getString("crfName" + i);
        edcBean.setCrfName(crfName);
        String requiredCRF = fp.getString("requiredCRF" + i);
        String doubleEntry = fp.getString("doubleEntry" + i);
        String decisionCondition = fp.getString("decisionCondition" + i);
        String electronicSignature = fp.getString("electronicSignature" + i);
        String participantForm = fp.getString("participantForm" + i);
        String allowAnonymousSubmission = fp.getString("allowAnonymousSubmission" + i);
        String submissionUrl = fp.getString("submissionUrl" + i);
        String offline = fp.getString("offline" + i);
        // issue 312 BWP<<
        String hiddenCrf = fp.getString("hiddenCrf" + i);
        // hideCRF is false by default in the bean
        if (!StringUtil.isBlank(hiddenCrf) && "yes".equalsIgnoreCase(hiddenCrf.trim())) {
            edcBean.setHideCrf(true);
        } else {
            edcBean.setHideCrf(false);
        }
        // >>
        String sdvOption = fp.getString("sdvOption" + i);
        if (!StringUtils.isBlank(sdvOption)) {
            int id = Integer.valueOf(sdvOption);
            edcBean.setSourceDataVerification(SourceDataVerification.getByCode(id));
        }
        if (!StringUtils.isBlank(requiredCRF) && "yes".equalsIgnoreCase(requiredCRF.trim())) {
            edcBean.setRequiredCRF(true);
        } else {
            edcBean.setRequiredCRF(false);
        }
        if (!StringUtils.isBlank(participantForm) && "yes".equalsIgnoreCase(participantForm.trim())) {
            edcBean.setParticipantForm(true);
        } else {
            edcBean.setParticipantForm(false);
        }
        // when participant form is not selected, force allow anonymous to be not selected
        if (edcBean.isParticipantForm() && !StringUtils.isBlank(allowAnonymousSubmission) && "yes".equalsIgnoreCase(allowAnonymousSubmission.trim())) {
            edcBean.setAllowAnonymousSubmission(true);
        } else {
            edcBean.setAllowAnonymousSubmission(false);
        }
        if (!StringUtils.isBlank(offline) && "yes".equalsIgnoreCase(offline.trim())) {
            edcBean.setOffline(true);
        } else {
            edcBean.setOffline(false);
        }
        if (!StringUtils.isBlank(doubleEntry) && "yes".equalsIgnoreCase(doubleEntry.trim())) {
            edcBean.setDoubleEntry(true);
        } else {
            edcBean.setDoubleEntry(false);
        }
        if (!StringUtils.isBlank(decisionCondition) && "yes".equalsIgnoreCase(decisionCondition.trim())) {
            edcBean.setDecisionCondition(true);
        } else {
            edcBean.setDecisionCondition(false);
        }
        if (!StringUtils.isBlank(electronicSignature) && "yes".equalsIgnoreCase(electronicSignature.trim())) {
            edcBean.setElectronicSignature(true);
        } else {
            edcBean.setElectronicSignature(false);
        }
        // also useful to protect from naughty submission not coming from our html form
        if (edcBean.isParticipantForm() && edcBean.isAllowAnonymousSubmission()) {
            edcBean.setSubmissionUrl(submissionUrl.trim());
        }
        ArrayList<CRFVersionBean> versions = fldao.findAllByCRFId(crfId);
        edcBean.setVersions(versions);
        String nullString = "";
        // process null values
        ArrayList nulls = NullValue.toArrayList();
        for (int a = 0; a < nulls.size(); a++) {
            NullValue n = (NullValue) nulls.get(a);
            String myNull = fp.getString(n.getName().toLowerCase() + i);
            if (!StringUtils.isBlank(myNull) && "yes".equalsIgnoreCase(myNull.trim())) {
                nullString = nullString + n.getName().toUpperCase() + ",";
            }
        }
        edcBean.setNullValues(nullString);
        edcBean.setStudyId(ub.getActiveStudyId());
        eventDefinitionCRFs.add(edcBean);
    }
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource());
    String participateFormStatus = spvdao.findByHandleAndStudy(sed.getStudyId(), "participantPortal").getValue();
    request.setAttribute("participateFormStatus", participateFormStatus);
    if (participateFormStatus.equals("enabled"))
        baseUrl();
    request.setAttribute("participateFormStatus", participateFormStatus);
    request.setAttribute("eventDefinitionCRFs", eventDefinitionCRFs);
    // not used on page
    session.setAttribute("edCRFs", eventDefinitionCRFs);
    ArrayList<EventDefinitionCRFBean> edcsInSession = (ArrayList<EventDefinitionCRFBean>) session.getAttribute("edCRFs");
    int parentStudyId = sed.getStudyId();
    EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(sm.getDataSource());
    ArrayList<EventDefinitionCRFBean> eventDefCrfList = (ArrayList<EventDefinitionCRFBean>) edcdao.findAllActiveSitesAndStudiesPerParentStudy(parentStudyId);
    if (eventDefCrfList.size() != 0)
        validateSubmissionUrl(edcsInSession, eventDefCrfList, v);
    errors = v.validate();
    if (!errors.isEmpty()) {
        ArrayList<String> sdvOptions = new ArrayList<String>();
        sdvOptions.add(SourceDataVerification.AllREQUIRED.toString());
        sdvOptions.add(SourceDataVerification.PARTIALREQUIRED.toString());
        sdvOptions.add(SourceDataVerification.NOTREQUIRED.toString());
        sdvOptions.add(SourceDataVerification.NOTAPPLICABLE.toString());
        request.setAttribute("sdvOptions", sdvOptions);
        logger.info("has errors");
        session.setAttribute("eventDefinitionCRFs", eventDefinitionCRFs);
        request.setAttribute("formMessages", errors);
        forwardPage(Page.DEFINE_STUDY_EVENT4);
    }
    forwardPage(Page.DEFINE_STUDY_EVENT_CONFIRM);
}
Also used : FormProcessor(org.akaza.openclinica.control.form.FormProcessor) ArrayList(java.util.ArrayList) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) NullValue(org.akaza.openclinica.bean.core.NullValue) FormLayoutDAO(org.akaza.openclinica.dao.submit.FormLayoutDAO) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO) Validator(org.akaza.openclinica.control.form.Validator)

Example 12 with StudyParameterValueDAO

use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.

the class DefineStudyEventServlet method confirmDefinition2.

private void confirmDefinition2() throws Exception {
    FormProcessor fp = new FormProcessor(request);
    FormLayoutDAO fldao = new FormLayoutDAO(sm.getDataSource());
    ArrayList crfArray = new ArrayList();
    Map tmpCRFIdMap = (HashMap) session.getAttribute("tmpCRFIdMap");
    // trying to avoid NPE not sure why we would get it there ((tmpCRFIdMap.containsKey(id))), tbh
    if (tmpCRFIdMap == null) {
        tmpCRFIdMap = new HashMap();
    }
    ArrayList crfsWithVersion = (ArrayList) session.getAttribute("crfsWithVersion");
    for (int i = 0; i < crfsWithVersion.size(); i++) {
        int id = fp.getInt("id" + i);
        String name = fp.getString("name" + i);
        // String label = fp.getString("label" + i);
        String selected = fp.getString("selected" + i);
        // logger.info("selected:" + selected);
        if (!StringUtils.isBlank(selected) && "yes".equalsIgnoreCase(selected.trim())) {
            logger.debug("one crf selected");
            CRFBean cb = new CRFBean();
            cb.setId(id);
            cb.setName(name);
            // only find active verions
            ArrayList versions = (ArrayList) fldao.findAllActiveByCRF(cb.getId());
            cb.setVersions(versions);
            crfArray.add(cb);
        } else {
            if (tmpCRFIdMap.containsKey(id)) {
                tmpCRFIdMap.remove(id);
            }
        }
    }
    for (Iterator tmpCRFIterator = tmpCRFIdMap.keySet().iterator(); tmpCRFIterator.hasNext(); ) {
        int id = (Integer) tmpCRFIterator.next();
        String name = (String) tmpCRFIdMap.get(id);
        boolean isExists = false;
        for (Iterator it = crfArray.iterator(); it.hasNext(); ) {
            CRFBean cb = (CRFBean) it.next();
            if (id == cb.getId()) {
                isExists = true;
            }
        }
        if (!isExists) {
            CRFBean cb = new CRFBean();
            cb.setId(id);
            cb.setName(name);
            // only find active verions
            ArrayList versions = (ArrayList) fldao.findAllActiveByCRF(cb.getId());
            cb.setVersions(versions);
            crfArray.add(cb);
        }
    }
    session.removeAttribute("tmpCRFIdMap");
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource());
    if (crfArray.size() == 0) {
        // no crf seleted
        // addPageMessage("At least one CRF must be selected.");
        addPageMessage(respage.getString("no_CRF_selected_for_definition_add_later"));
        StudyEventDefinitionBean sed = (StudyEventDefinitionBean) session.getAttribute("definition");
        sed.setCrfs(new ArrayList());
        String participateFormStatus = spvdao.findByHandleAndStudy(sed.getStudyId(), "participantPortal").getValue();
        request.setAttribute("participateFormStatus", participateFormStatus);
        session.setAttribute("definition", sed);
        request.setAttribute("eventDefinitionCRFs", new ArrayList());
        // not used on page
        session.setAttribute("edCRFs", new ArrayList());
        forwardPage(Page.DEFINE_STUDY_EVENT_CONFIRM);
    // forwardPage(Page.DEFINE_STUDY_EVENT2);
    } else {
        StudyEventDefinitionBean sed = (StudyEventDefinitionBean) session.getAttribute("definition");
        // crfs selected by user
        sed.setCrfs(crfArray);
        session.setAttribute("eventDefinitionCRFs", new ArrayList());
        session.setAttribute("definition", sed);
        String participateFormStatus = spvdao.findByHandleAndStudy(sed.getStudyId(), "participantPortal").getValue();
        if (participateFormStatus.equals("enabled"))
            baseUrl();
        request.setAttribute("participateFormStatus", participateFormStatus);
        ArrayList<String> sdvOptions = new ArrayList<String>();
        sdvOptions.add(SourceDataVerification.AllREQUIRED.toString());
        sdvOptions.add(SourceDataVerification.PARTIALREQUIRED.toString());
        sdvOptions.add(SourceDataVerification.NOTREQUIRED.toString());
        sdvOptions.add(SourceDataVerification.NOTAPPLICABLE.toString());
        request.setAttribute("sdvOptions", sdvOptions);
        forwardPage(Page.DEFINE_STUDY_EVENT3);
    }
}
Also used : HashMap(java.util.HashMap) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) ArrayList(java.util.ArrayList) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) FormLayoutDAO(org.akaza.openclinica.dao.submit.FormLayoutDAO) Iterator(java.util.Iterator) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO) HashMap(java.util.HashMap) Map(java.util.Map)

Example 13 with StudyParameterValueDAO

use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.

the class CreateSubStudyServlet method initDefinitions.

private ArrayList<StudyEventDefinitionBean> initDefinitions(StudyBean site) throws MalformedURLException {
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource());
    ArrayList<StudyEventDefinitionBean> seds = new ArrayList<StudyEventDefinitionBean>();
    StudyEventDefinitionDAO sedDao = new StudyEventDefinitionDAO(sm.getDataSource());
    EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(sm.getDataSource());
    CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
    FormLayoutDAO fldao = new FormLayoutDAO(sm.getDataSource());
    CRFDAO cdao = new CRFDAO(sm.getDataSource());
    StudyBean parentStudy = (StudyBean) new StudyDAO(sm.getDataSource()).findByPK(site.getParentStudyId());
    seds = sedDao.findAllByStudy(parentStudy);
    int start = 0;
    for (StudyEventDefinitionBean sed : seds) {
        String participateFormStatus = spvdao.findByHandleAndStudy(sed.getStudyId(), "participantPortal").getValue();
        if (participateFormStatus.equals("enabled"))
            baseUrl();
        request.setAttribute("participateFormStatus", participateFormStatus);
        int defId = sed.getId();
        ArrayList<EventDefinitionCRFBean> edcs = (ArrayList<EventDefinitionCRFBean>) edcdao.findAllByDefinitionAndSiteIdAndParentStudyId(defId, site.getId(), parentStudy.getId());
        ArrayList<EventDefinitionCRFBean> defCrfs = new ArrayList<EventDefinitionCRFBean>();
        // sed.setCrfNum(edcs.size());
        for (EventDefinitionCRFBean edcBean : edcs) {
            CRFBean cBean = (CRFBean) cdao.findByPK(edcBean.getCrfId());
            String crfPath = sed.getOid() + "." + cBean.getOid();
            edcBean.setOffline(getEventDefinitionCrfTagService().getEventDefnCrfOfflineStatus(2, crfPath, true));
            int edcStatusId = edcBean.getStatus().getId();
            CRFBean crf = (CRFBean) cdao.findByPK(edcBean.getCrfId());
            int crfStatusId = crf.getStatusId();
            if (edcStatusId == 5 || edcStatusId == 7 || crfStatusId == 5 || crfStatusId == 7) {
            } else {
                ArrayList<FormLayoutBean> versions = (ArrayList<FormLayoutBean>) fldao.findAllActiveByCRF(edcBean.getCrfId());
                edcBean.setVersions(versions);
                edcBean.setCrfName(crf.getName());
                FormLayoutBean defaultVersion = (FormLayoutBean) fldao.findByPK(edcBean.getDefaultVersionId());
                edcBean.setDefaultVersionName(defaultVersion.getName());
                edcBean.setSubmissionUrl("");
                /*
                     * EventDefinitionCRFBean eBean = (EventDefinitionCRFBean) edcdao.findByPK(edcBean.getId());
                     * if (eBean.isActive()){
                     * edcBean.setSubmissionUrl(eBean.getSubmissionUrl());
                     * }else{
                     * edcBean.setSubmissionUrl("");
                     * }
                     */
                String sversionIds = edcBean.getSelectedVersionIds();
                ArrayList<Integer> idList = new ArrayList<Integer>();
                if (sversionIds.length() > 0) {
                    String[] ids = sversionIds.split("\\,");
                    for (String id : ids) {
                        idList.add(Integer.valueOf(id));
                    }
                }
                edcBean.setSelectedVersionIdList(idList);
                defCrfs.add(edcBean);
                ++start;
            }
        }
        logger.debug("definitionCrfs size=" + defCrfs.size() + " total size=" + edcs.size());
        sed.setCrfs(defCrfs);
        sed.setCrfNum(defCrfs.size());
    }
    return seds;
}
Also used : EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) FormLayoutDAO(org.akaza.openclinica.dao.submit.FormLayoutDAO) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO)

Example 14 with StudyParameterValueDAO

use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.

the class InitUpdateSubStudyServlet method createEventDefinitions.

private void createEventDefinitions(StudyBean parentStudy) throws MalformedURLException {
    FormProcessor fp = new FormProcessor(request);
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource());
    int siteId = Integer.valueOf(request.getParameter("id").trim());
    ArrayList<StudyEventDefinitionBean> seds = new ArrayList<StudyEventDefinitionBean>();
    StudyEventDefinitionDAO sedDao = new StudyEventDefinitionDAO(sm.getDataSource());
    EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(sm.getDataSource());
    // CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
    FormLayoutDAO fldao = new FormLayoutDAO(sm.getDataSource());
    CRFDAO cdao = new CRFDAO(sm.getDataSource());
    seds = sedDao.findAllByStudy(parentStudy);
    int start = 0;
    for (StudyEventDefinitionBean sed : seds) {
        String participateFormStatus = spvdao.findByHandleAndStudy(sed.getStudyId(), "participantPortal").getValue();
        if (participateFormStatus.equals("enabled"))
            baseUrl();
        request.setAttribute("participateFormStatus", participateFormStatus);
        int defId = sed.getId();
        ArrayList<EventDefinitionCRFBean> edcs = (ArrayList<EventDefinitionCRFBean>) edcdao.findAllByDefinitionAndSiteIdAndParentStudyId(defId, siteId, parentStudy.getId());
        ArrayList<EventDefinitionCRFBean> defCrfs = new ArrayList<EventDefinitionCRFBean>();
        // sed.setCrfNum(edcs.size());
        for (EventDefinitionCRFBean edcBean : edcs) {
            CRFBean cBean = (CRFBean) cdao.findByPK(edcBean.getCrfId());
            String crfPath = sed.getOid() + "." + cBean.getOid();
            edcBean.setOffline(getEventDefinitionCrfTagService().getEventDefnCrfOfflineStatus(2, crfPath, true));
            int edcStatusId = edcBean.getStatus().getId();
            CRFBean crf = (CRFBean) cdao.findByPK(edcBean.getCrfId());
            int crfStatusId = crf.getStatusId();
            if (edcStatusId == 5 || edcStatusId == 7 || crfStatusId == 5 || crfStatusId == 7) {
            } else {
                // ArrayList<CRFVersionBean> versions = (ArrayList<CRFVersionBean>)
                // cvdao.findAllActiveByCRF(edcBean.getCrfId());
                ArrayList<FormLayoutBean> versions = (ArrayList<FormLayoutBean>) fldao.findAllActiveByCRF(edcBean.getCrfId());
                edcBean.setVersions(versions);
                edcBean.setCrfName(crf.getName());
                if (edcBean.getParentId() == 0)
                    edcBean.setSubmissionUrl("");
                // CRFVersionBean defaultVersion = (CRFVersionBean) cvdao.findByPK(edcBean.getDefaultVersionId());
                FormLayoutBean defaultVersion = (FormLayoutBean) fldao.findByPK(edcBean.getDefaultVersionId());
                edcBean.setDefaultVersionName(defaultVersion.getName());
                String sversionIds = edcBean.getSelectedVersionIds();
                ArrayList<Integer> idList = new ArrayList<Integer>();
                if (sversionIds.length() > 0) {
                    String[] ids = sversionIds.split("\\,");
                    for (String id : ids) {
                        idList.add(Integer.valueOf(id));
                    }
                }
                edcBean.setSelectedVersionIdList(idList);
                defCrfs.add(edcBean);
                ++start;
            }
        }
        logger.debug("definitionCrfs size=" + defCrfs.size() + " total size=" + edcs.size());
        sed.setCrfs(defCrfs);
        sed.setCrfNum(defCrfs.size());
    }
    // not sure if request is better, since not sure if there is another
    // process using this.
    session.setAttribute("definitions", seds);
    session.setAttribute("sdvOptions", this.setSDVOptions());
}
Also used : EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) ArrayList(java.util.ArrayList) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) FormLayoutDAO(org.akaza.openclinica.dao.submit.FormLayoutDAO) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)

Example 15 with StudyParameterValueDAO

use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.

the class RemoveCRFFromDefinitionServlet method processRequest.

@Override
public void processRequest() throws Exception {
    ArrayList edcs = (ArrayList) session.getAttribute("eventDefinitionCRFs");
    ArrayList updatedEdcs = new ArrayList();
    String crfName = "";
    StudyEventDefinitionBean sed = (StudyEventDefinitionBean) session.getAttribute("definition");
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource());
    String participateFormStatus = spvdao.findByHandleAndStudy(sed.getStudyId(), "participantPortal").getValue();
    request.setAttribute("participateFormStatus", participateFormStatus);
    if (edcs != null && edcs.size() > 1) {
        String idString = request.getParameter("id");
        logger.info("crf id:" + idString);
        if (StringUtil.isBlank(idString)) {
            addPageMessage(respage.getString("please_choose_a_crf_to_remove"));
            forwardPage(Page.UPDATE_EVENT_DEFINITION1);
        } else {
            // crf id
            int id = Integer.valueOf(idString.trim()).intValue();
            for (int i = 0; i < edcs.size(); i++) {
                EventDefinitionCRFBean edc = (EventDefinitionCRFBean) edcs.get(i);
                if (edc.getCrfId() == id) {
                    edc.setStatus(Status.DELETED);
                    crfName = edc.getCrfName();
                }
                if (edc.getId() > 0 || !edc.getStatus().equals(Status.DELETED)) {
                    updatedEdcs.add(edc);
                    logger.info("\nversion:" + edc.getDefaultVersionId());
                }
            }
            session.setAttribute("eventDefinitionCRFs", updatedEdcs);
            addPageMessage(respage.getString("has_been_removed_need_confirmation"));
            forwardPage(Page.UPDATE_EVENT_DEFINITION1);
        }
    } else {
        addPageMessage(respage.getString("an_ED_needs_to_have_least_one_CRF"));
        forwardPage(Page.UPDATE_EVENT_DEFINITION1);
    }
}
Also used : ArrayList(java.util.ArrayList) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)

Aggregations

StudyParameterValueDAO (org.akaza.openclinica.dao.service.StudyParameterValueDAO)54 ArrayList (java.util.ArrayList)37 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)36 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)29 StudyParameterValueBean (org.akaza.openclinica.bean.service.StudyParameterValueBean)27 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)22 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)21 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)17 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)16 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)15 Date (java.util.Date)13 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)10 FormLayoutDAO (org.akaza.openclinica.dao.submit.FormLayoutDAO)10 HashMap (java.util.HashMap)9 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)9 ParticipantPortalRegistrar (org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar)9 Iterator (java.util.Iterator)8 FormLayoutBean (org.akaza.openclinica.bean.submit.FormLayoutBean)8 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)8 StudyConfigService (org.akaza.openclinica.dao.service.StudyConfigService)7