Search in sources :

Example 11 with FormLayoutBean

use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.

the class ViewCRFServlet method processRequest.

@Override
public void processRequest() throws Exception {
    resetPanel();
    panel.setStudyInfoShown(false);
    panel.setOrderedData(true);
    panel.setSubmitDataModule(false);
    panel.setExtractData(false);
    panel.setCreateDataset(false);
    setToPanel(resword.getString("create_CRF"), respage.getString("br_create_new_CRF_entering"));
    setToPanel(resword.getString("create_CRF_version"), respage.getString("br_create_new_CRF_uploading"));
    setToPanel(resword.getString("revise_CRF_version"), respage.getString("br_if_you_owner_CRF_version"));
    setToPanel(resword.getString("CRF_spreadsheet_template"), respage.getString("br_download_blank_CRF_spreadsheet_from"));
    setToPanel(resword.getString("example_CRF_br_spreadsheets"), respage.getString("br_download_example_CRF_instructions_from"));
    FormProcessor fp = new FormProcessor(request);
    // checks which module the requests are from, manage or admin
    String module = fp.getString(MODULE);
    request.setAttribute(MODULE, module);
    int crfId = fp.getInt(CRF_ID);
    List<StudyBean> studyBeans = null;
    if (crfId == 0) {
        addPageMessage(respage.getString("please_choose_a_CRF_to_view"));
        forwardPage(Page.CRF_LIST);
    } else {
        CRFDAO cdao = new CRFDAO(sm.getDataSource());
        // CRFVersionDAO vdao = new CRFVersionDAO(sm.getDataSource());
        FormLayoutDAO fdao = new FormLayoutDAO<>(sm.getDataSource());
        CRFBean crf = (CRFBean) cdao.findByPK(crfId);
        request.setAttribute("crfName", crf.getName());
        // ArrayList<CRFVersionBean> crfVersions = (ArrayList<CRFVersionBean>) vdao.findAllByCRF(crfId);
        ArrayList<FormLayoutBean> layoutVersions = (ArrayList<FormLayoutBean>) fdao.findAllByCRF(crfId);
        crf.setVersions(layoutVersions);
        ArrayList<ItemGroupCrvVersionUtil> items_verified = verifyUniqueItemPlacementInGroups(crf.getName());
        request.setAttribute("items", items_verified);
        if ("admin".equalsIgnoreCase(module)) {
            // BWP 3279: generate a table showing a list of studies associated with the CRF>>
            StudyDAO studyDAO = new StudyDAO(sm.getDataSource());
            studyBeans = findStudiesForCRFId(crfId, studyDAO);
            // Create the Jmesa table for the studies associated with the CRF
            String studyHtml = renderStudiesTable(studyBeans);
            request.setAttribute("studiesTableHTML", studyHtml);
        // >>
        }
        Collection<TableColumnHolder> items = populate(crf, layoutVersions);
        request.setAttribute(CRF, crf);
        forwardPage(Page.VIEW_CRF);
    }
}
Also used : CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) ItemGroupCrvVersionUtil(org.akaza.openclinica.core.util.ItemGroupCrvVersionUtil) FormLayoutDAO(org.akaza.openclinica.dao.submit.FormLayoutDAO) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO)

Example 12 with FormLayoutBean

use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.

the class AddCRFToDefinitionServlet method addCRF.

private void addCRF() throws Exception {
    FormProcessor fp = new FormProcessor(request);
    FormLayoutDAO fldao = new FormLayoutDAO(sm.getDataSource());
    ArrayList crfArray = new ArrayList();
    Map tmpCRFIdMap = (HashMap) session.getAttribute("tmpCRFIdMap");
    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 selected = fp.getString("selected" + i);
        if (!StringUtil.isBlank(selected) && "yes".equalsIgnoreCase(selected.trim())) {
            logger.info("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(respage.getString("no_new_CRF_added"));
        StudyEventDefinitionBean sed = (StudyEventDefinitionBean) session.getAttribute("definition");
        String participateFormStatus = spvdao.findByHandleAndStudy(sed.getStudyId(), "participantPortal").getValue();
        request.setAttribute("participateFormStatus", participateFormStatus);
        sed.setCrfs(new ArrayList());
        session.setAttribute("definition", sed);
        forwardPage(Page.UPDATE_EVENT_DEFINITION1);
    } else {
        StudyEventDefinitionBean sed = (StudyEventDefinitionBean) session.getAttribute("definition");
        String participateFormStatus = spvdao.findByHandleAndStudy(sed.getStudyId(), "participantPortal").getValue();
        if (participateFormStatus.equals("enabled"))
            baseUrl();
        request.setAttribute("participateFormStatus", participateFormStatus);
        ArrayList edcs = (ArrayList) session.getAttribute("eventDefinitionCRFs");
        int ordinalForNewCRF = edcs.size();
        for (int i = 0; i < crfArray.size(); i++) {
            CRFBean crf = (CRFBean) crfArray.get(i);
            EventDefinitionCRFBean edcBean = new EventDefinitionCRFBean();
            edcBean.setCrfId(crf.getId());
            edcBean.setCrfName(crf.getName());
            edcBean.setStudyId(ub.getActiveStudyId());
            edcBean.setStatus(Status.AVAILABLE);
            edcBean.setStudyEventDefinitionId(sed.getId());
            edcBean.setStudyId(ub.getActiveStudyId());
            edcBean.setSourceDataVerification(SourceDataVerification.NOTREQUIRED);
            ordinalForNewCRF = ordinalForNewCRF + 1;
            edcBean.setOrdinal(ordinalForNewCRF);
            edcBean.setVersions(crf.getVersions());
            FormLayoutBean defaultVersion1 = (FormLayoutBean) fldao.findByPK(edcBean.getDefaultVersionId());
            edcBean.setDefaultVersionName(defaultVersion1.getName());
            ordinalForNewCRF++;
            edcs.add(edcBean);
        }
        session.setAttribute("eventDefinitionCRFs", edcs);
        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);
        addPageMessage(respage.getString("has_have_been_added_need_confirmation"));
        forwardPage(Page.UPDATE_EVENT_DEFINITION1);
    }
}
Also used : HashMap(java.util.HashMap) 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) 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) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) HashMap(java.util.HashMap) Map(java.util.Map)

Example 13 with FormLayoutBean

use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.

the class InitUpdateEventDefinitionServlet method processRequest.

@Override
public void processRequest() throws Exception {
    StudyEventDefinitionDAO sdao = new StudyEventDefinitionDAO(sm.getDataSource());
    String idString = request.getParameter("id");
    logger.info("definition id: " + idString);
    if (StringUtil.isBlank(idString)) {
        addPageMessage(respage.getString("please_choose_a_definition_to_edit"));
        forwardPage(Page.LIST_DEFINITION_SERVLET);
    } else {
        // definition id
        int defId = Integer.valueOf(idString.trim()).intValue();
        StudyEventDefinitionBean sed = (StudyEventDefinitionBean) sdao.findByPK(defId);
        StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource());
        String participateFormStatus = spvdao.findByHandleAndStudy(sed.getStudyId(), "participantPortal").getValue();
        if (participateFormStatus.equals("enabled"))
            baseUrl();
        request.setAttribute("participateFormStatus", participateFormStatus);
        if (currentStudy.getId() != sed.getStudyId()) {
            addPageMessage(respage.getString("no_have_correct_privilege_current_study") + " " + respage.getString("change_active_study_or_contact"));
            forwardPage(Page.MENU_SERVLET);
            return;
        }
        EventDefinitionCRFDAO edao = new EventDefinitionCRFDAO(sm.getDataSource());
        ArrayList eventDefinitionCRFs = (ArrayList) edao.findAllParentsByDefinition(defId);
        FormLayoutDAO fldao = new FormLayoutDAO(sm.getDataSource());
        CRFDAO cdao = new CRFDAO(sm.getDataSource());
        ArrayList newEventDefinitionCRFs = new ArrayList();
        for (int i = 0; i < eventDefinitionCRFs.size(); i++) {
            EventDefinitionCRFBean edc = (EventDefinitionCRFBean) eventDefinitionCRFs.get(i);
            ArrayList versions = (ArrayList) fldao.findAllActiveByCRF(edc.getCrfId());
            edc.setVersions(versions);
            CRFBean crf = (CRFBean) cdao.findByPK(edc.getCrfId());
            edc.setCrfName(crf.getName());
            edc.setCrf(crf);
            edc.setParticipantForm(edc.isParticipantForm());
            // TO DO: use a better way on JSP page,eg.function tag
            edc.setNullFlags(processNullValues(edc));
            FormLayoutBean formLayout = (FormLayoutBean) fldao.findByPK(edc.getDefaultVersionId());
            edc.setDefaultVersionName(formLayout.getName());
            String crfPath = sed.getOid() + "." + edc.getCrf().getOid();
            edc.setOffline(getEventDefinitionCrfTagService().getEventDefnCrfOfflineStatus(2, crfPath, true));
            newEventDefinitionCRFs.add(edc);
        }
        session.setAttribute("definition", sed);
        session.setAttribute("eventDefinitionCRFs", newEventDefinitionCRFs);
        // changed above to new list because static, in-place updating is
        // updating all EDCs, tbh 102007
        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.UPDATE_EVENT_DEFINITION1);
    }
}
Also used : EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) 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 14 with FormLayoutBean

use of org.akaza.openclinica.bean.submit.FormLayoutBean 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 15 with FormLayoutBean

use of org.akaza.openclinica.bean.submit.FormLayoutBean 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)

Aggregations

FormLayoutBean (org.akaza.openclinica.bean.submit.FormLayoutBean)41 ArrayList (java.util.ArrayList)32 FormLayoutDAO (org.akaza.openclinica.dao.submit.FormLayoutDAO)23 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)22 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)21 HashMap (java.util.HashMap)20 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)16 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)14 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)13 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)12 Iterator (java.util.Iterator)10 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)10 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)9 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)9 StudyParameterValueDAO (org.akaza.openclinica.dao.service.StudyParameterValueDAO)8 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)8 DisplayEventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.DisplayEventDefinitionCRFBean)7 DisplayEventCRFBean (org.akaza.openclinica.bean.submit.DisplayEventCRFBean)7 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)6 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)5