Search in sources :

Example 91 with CRFBean

use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.

the class ListCRFServlet method processRequest.

/**
 * Finds all the crfs
 */
@Override
public void processRequest() throws Exception {
    if (currentStudy.getParentStudyId() > 0) {
        addPageMessage(respage.getString("no_crf_available_study_is_a_site"));
        forwardPage(Page.MENU_SERVLET);
        return;
    }
    session.removeAttribute("version");
    FormProcessor fp = new FormProcessor(request);
    // checks which module the requests are from
    String module = fp.getString(MODULE);
    if (module.equalsIgnoreCase("admin") && !(ub.isSysAdmin() || ub.isTechAdmin())) {
        addPageMessage(respage.getString("no_have_correct_privilege_current_study") + " " + respage.getString("change_active_study_or_contact"));
        forwardPage(Page.MENU_SERVLET);
        return;
    }
    request.setAttribute(MODULE, module);
    // if coming from change crf version -> display message
    String crfVersionChangeMsg = fp.getString("isFromCRFVersionBatchChange");
    if (crfVersionChangeMsg != null && !crfVersionChangeMsg.equals("")) {
        addPageMessage(crfVersionChangeMsg);
    }
    // for
    String dir = SQLInitServlet.getField("filePath") + "crf" + File.separator + "new" + File.separator;
    // crf
    // version
    // spreadsheet
    logger.debug("found directory: " + dir);
    CRFDAO cdao = new CRFDAO(sm.getDataSource());
    CRFVersionDAO vdao = new CRFVersionDAO(sm.getDataSource());
    ArrayList crfs = (ArrayList) cdao.findAll();
    for (int i = 0; i < crfs.size(); i++) {
        CRFBean eb = (CRFBean) crfs.get(i);
        logger.debug("crf id:" + eb.getId());
        ArrayList versions = (ArrayList) vdao.findAllByCRF(eb.getId());
        // check whether the speadsheet is available on the server
        for (int j = 0; j < versions.size(); j++) {
            CRFVersionBean cv = (CRFVersionBean) versions.get(j);
            File file = new File(dir + eb.getId() + cv.getOid() + ".xls");
            logger.debug("looking in " + dir + eb.getId() + cv.getOid() + ".xls");
            if (file.exists()) {
                cv.setDownloadable(true);
            } else {
                File file2 = new File(dir + eb.getId() + cv.getName() + ".xls");
                logger.debug("initial failed, looking in " + dir + eb.getId() + cv.getName() + ".xls");
                if (file2.exists()) {
                    cv.setDownloadable(true);
                }
            }
        }
        eb.setVersions(versions);
    }
    // request.setAttribute("crfs", crfs);
    EntityBeanTable table = fp.getEntityBeanTable();
    ArrayList allRows = ListCRFRow.generateRowsFromBeans(crfs);
    String[] columns = { resword.getString("CRF_name"), resword.getString("date_updated"), resword.getString("last_updated_by"), resword.getString("crf_oid"), resword.getString("versions"), resword.getString("version_oid"), resword.getString("date_created"), resword.getString("owner"), resword.getString("status"), resword.getString("download"), resword.getString("actions") };
    table.setColumns(new ArrayList(Arrays.asList(columns)));
    table.hideColumnLink(3);
    // oid column
    table.hideColumnLink(4);
    // BWP 3281: make the "owner" column sortable; table.hideColumnLink(7);
    table.hideColumnLink(8);
    table.setQuery("ListCRF", new HashMap());
    table.addLink(resword.getString("blank_CRF_template"), "DownloadVersionSpreadSheet?template=1");
    // YW << add "Enterprise CRF Catalog" link
    String crfCatalogField = "crfCatalog";
    // table.addLink(resword.getString("openclinica_CRF_catalog"), SQLInitServlet.getEnterpriseField(crfCatalogField));
    // YW >>
    // TODO add i18n links to the above, tbh
    table.addLink(resword.getString("create_a_new_CRF"), "CreateCRFVersion?module=" + module);
    table.setRows(allRows);
    table.computeDisplay();
    request.setAttribute("table", table);
    request.setAttribute("study", currentStudy);
    resetPanel();
    panel.setStudyInfoShown(false);
    panel.setOrderedData(true);
    panel.setSubmitDataModule(false);
    panel.setExtractData(false);
    panel.setCreateDataset(false);
    if (crfs.size() > 0) {
        setToPanel("CRFs", new Integer(crfs.size()).toString());
    }
    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"));
    forwardPage(Page.CRF_LIST);
}
Also used : CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) HashMap(java.util.HashMap) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) EntityBeanTable(org.akaza.openclinica.web.bean.EntityBeanTable) ArrayList(java.util.ArrayList) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) File(java.io.File)

Example 92 with CRFBean

use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.

the class RemoveCRFServlet method processRequest.

@Override
public void processRequest() throws Exception {
    CRFDAO cdao = new CRFDAO(sm.getDataSource());
    CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
    FormProcessor fp = new FormProcessor(request);
    // checks which module the requests are from
    String module = fp.getString(MODULE);
    request.setAttribute(MODULE, module);
    int crfId = fp.getInt("id", true);
    String action = request.getParameter("action");
    if (crfId == 0) {
        addPageMessage(respage.getString("please_choose_a_CRF_to_remove"));
        forwardPage(Page.CRF_LIST_SERVLET);
    } else {
        CRFBean crf = (CRFBean) cdao.findByPK(crfId);
        ArrayList versions = cvdao.findAllByCRFId(crfId);
        crf.setVersions(versions);
        EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(sm.getDataSource());
        ArrayList edcs = (ArrayList) edcdao.findAllByCRF(crfId);
        SectionDAO secdao = new SectionDAO(sm.getDataSource());
        EventCRFDAO evdao = new EventCRFDAO(sm.getDataSource());
        ArrayList eventCRFs = evdao.findAllByCRF(crfId);
        StudyEventDAO seDao = new StudyEventDAO(sm.getDataSource());
        StudyEventDefinitionDAO sedDao = new StudyEventDefinitionDAO(sm.getDataSource());
        for (Object ecBean : eventCRFs) {
            StudyEventBean seBean = (StudyEventBean) seDao.findByPK(((EventCRFBean) ecBean).getStudyEventId());
            StudyEventDefinitionBean sedBean = (StudyEventDefinitionBean) sedDao.findByPK(seBean.getStudyEventDefinitionId());
            ((EventCRFBean) ecBean).setEventName(sedBean.getName());
        }
        if ("confirm".equalsIgnoreCase(action)) {
            request.setAttribute("crfToRemove", crf);
            request.setAttribute("eventCRFs", eventCRFs);
            forwardPage(Page.REMOVE_CRF);
        } else {
            logger.info("submit to remove the crf");
            crf.setStatus(Status.DELETED);
            crf.setUpdater(ub);
            crf.setUpdatedDate(new Date());
            cdao.update(crf);
            for (int i = 0; i < versions.size(); i++) {
                CRFVersionBean version = (CRFVersionBean) versions.get(i);
                if (!version.getStatus().equals(Status.DELETED)) {
                    version.setStatus(Status.AUTO_DELETED);
                    version.setUpdater(ub);
                    version.setUpdatedDate(new Date());
                    cvdao.update(version);
                    ArrayList sections = secdao.findAllByCRFVersionId(version.getId());
                    for (int j = 0; j < sections.size(); j++) {
                        SectionBean section = (SectionBean) sections.get(j);
                        if (!section.getStatus().equals(Status.DELETED)) {
                            section.setStatus(Status.AUTO_DELETED);
                            section.setUpdater(ub);
                            section.setUpdatedDate(new Date());
                            secdao.update(section);
                        }
                    }
                }
            }
            for (int i = 0; i < edcs.size(); i++) {
                EventDefinitionCRFBean edc = (EventDefinitionCRFBean) edcs.get(i);
                if (!edc.getStatus().equals(Status.DELETED)) {
                    edc.setStatus(Status.AUTO_DELETED);
                    edc.setUpdater(ub);
                    edc.setUpdatedDate(new Date());
                    edcdao.update(edc);
                }
            }
            ItemDataDAO idao = new ItemDataDAO(sm.getDataSource());
            for (int i = 0; i < eventCRFs.size(); i++) {
                EventCRFBean eventCRF = (EventCRFBean) eventCRFs.get(i);
                if (!eventCRF.getStatus().equals(Status.DELETED)) {
                    eventCRF.setStatus(Status.AUTO_DELETED);
                    eventCRF.setUpdater(ub);
                    eventCRF.setUpdatedDate(new Date());
                    evdao.update(eventCRF);
                    ArrayList items = idao.findAllByEventCRFId(eventCRF.getId());
                    for (int j = 0; j < items.size(); j++) {
                        ItemDataBean item = (ItemDataBean) items.get(j);
                        if (!item.getStatus().equals(Status.DELETED)) {
                            item.setStatus(Status.AUTO_DELETED);
                            item.setUpdater(ub);
                            item.setUpdatedDate(new Date());
                            idao.update(item);
                        }
                    }
                }
            }
            addPageMessage(respage.getString("the_CRF") + crf.getName() + " " + respage.getString("has_been_removed_succesfully"));
            forwardPage(Page.CRF_LIST_SERVLET);
        }
    }
}
Also used : EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) ArrayList(java.util.ArrayList) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) Date(java.util.Date) ItemDataDAO(org.akaza.openclinica.dao.submit.ItemDataDAO) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) SectionBean(org.akaza.openclinica.bean.submit.SectionBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) SectionDAO(org.akaza.openclinica.dao.submit.SectionDAO)

Example 93 with CRFBean

use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.

the class SecureController method getNoteInfo.

public DiscrepancyNoteBean getNoteInfo(DiscrepancyNoteBean note) {
    StudySubjectDAO ssdao = new StudySubjectDAO(sm.getDataSource());
    if ("itemData".equalsIgnoreCase(note.getEntityType())) {
        int itemDataId = note.getEntityId();
        ItemDataDAO iddao = new ItemDataDAO(sm.getDataSource());
        ItemDataBean itemData = (ItemDataBean) iddao.findByPK(itemDataId);
        ItemDAO idao = new ItemDAO(sm.getDataSource());
        if (StringUtil.isBlank(note.getEntityName())) {
            ItemBean item = (ItemBean) idao.findByPK(itemData.getItemId());
            note.setEntityName(item.getName());
            request.setAttribute("item", item);
        }
        EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
        StudyEventDAO svdao = new StudyEventDAO(sm.getDataSource());
        EventCRFBean ec = (EventCRFBean) ecdao.findByPK(itemData.getEventCRFId());
        StudyEventBean event = (StudyEventBean) svdao.findByPK(ec.getStudyEventId());
        StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
        StudyEventDefinitionBean sed = (StudyEventDefinitionBean) seddao.findByPK(event.getStudyEventDefinitionId());
        note.setEventName(sed.getName());
        note.setEventStart(event.getDateStarted());
        CRFDAO cdao = new CRFDAO(sm.getDataSource());
        CRFBean crf = cdao.findByVersionId(ec.getCRFVersionId());
        note.setCrfName(crf.getName());
        note.setEventCRFId(ec.getId());
        if (StringUtil.isBlank(note.getSubjectName())) {
            StudySubjectBean ss = (StudySubjectBean) ssdao.findByPK(ec.getStudySubjectId());
            note.setSubjectName(ss.getName());
        }
        if (note.getDiscrepancyNoteTypeId() == 0) {
            // default
            note.setDiscrepancyNoteTypeId(DiscrepancyNoteType.FAILEDVAL.getId());
        // value
        }
    } else if ("eventCrf".equalsIgnoreCase(note.getEntityType())) {
        int eventCRFId = note.getEntityId();
        EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
        StudyEventDAO svdao = new StudyEventDAO(sm.getDataSource());
        EventCRFBean ec = (EventCRFBean) ecdao.findByPK(eventCRFId);
        StudyEventBean event = (StudyEventBean) svdao.findByPK(ec.getStudyEventId());
        StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
        StudyEventDefinitionBean sed = (StudyEventDefinitionBean) seddao.findByPK(event.getStudyEventDefinitionId());
        note.setEventName(sed.getName());
        note.setEventStart(event.getDateStarted());
        CRFDAO cdao = new CRFDAO(sm.getDataSource());
        CRFBean crf = cdao.findByVersionId(ec.getCRFVersionId());
        note.setCrfName(crf.getName());
        StudySubjectBean ss = (StudySubjectBean) ssdao.findByPK(ec.getStudySubjectId());
        note.setSubjectName(ss.getName());
        note.setEventCRFId(ec.getId());
    } else if ("studyEvent".equalsIgnoreCase(note.getEntityType())) {
        int eventId = note.getEntityId();
        StudyEventDAO svdao = new StudyEventDAO(sm.getDataSource());
        StudyEventBean event = (StudyEventBean) svdao.findByPK(eventId);
        StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
        StudyEventDefinitionBean sed = (StudyEventDefinitionBean) seddao.findByPK(event.getStudyEventDefinitionId());
        note.setEventName(sed.getName());
        note.setEventStart(event.getDateStarted());
        StudySubjectBean ss = (StudySubjectBean) ssdao.findByPK(event.getStudySubjectId());
        note.setSubjectName(ss.getName());
    } else if ("studySub".equalsIgnoreCase(note.getEntityType())) {
        int studySubjectId = note.getEntityId();
        StudySubjectBean ss = (StudySubjectBean) ssdao.findByPK(studySubjectId);
        note.setSubjectName(ss.getName());
    } else if ("Subject".equalsIgnoreCase(note.getEntityType())) {
        int subjectId = note.getEntityId();
        StudySubjectBean ss = ssdao.findBySubjectIdAndStudy(subjectId, currentStudy);
        note.setSubjectName(ss.getName());
    }
    return note;
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) ItemDAO(org.akaza.openclinica.dao.submit.ItemDAO) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) ItemDataDAO(org.akaza.openclinica.dao.submit.ItemDataDAO) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 94 with CRFBean

use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.

the class ListEventsForSubjectTableFactory method setDataAndLimitVariables.

@SuppressWarnings("unchecked")
@Override
public void setDataAndLimitVariables(TableFacade tableFacade) {
    Limit limit = tableFacade.getLimit();
    ListEventsForSubjectFilter eventsForSubjectFilter = getListEventsForSubjectFilter(limit);
    // Used on Initial sort without filters
    if (!limit.isComplete()) {
        int totalRows = getStudySubjectDAO().getCountWithFilter(eventsForSubjectFilter, getStudyBean());
        tableFacade.setTotalRows(totalRows);
    }
    // Preprocess the studysubjectbean list to find subjects with crf status
    ListEventsForSubjectSort eventsForSubjectSort = getListEventsForSubjectSort(limit);
    int rowStart = limit.getRowSelect().getRowStart();
    int rowEnd = limit.getRowSelect().getRowEnd();
    Collection<StudySubjectBean> items = getStudySubjectDAO().getWithFilterAndSort(getStudyBean(), eventsForSubjectFilter, eventsForSubjectSort, rowStart, rowEnd);
    Collection<HashMap<Object, Object>> theItems = new ArrayList<HashMap<Object, Object>>();
    for (StudySubjectBean studySubjectBean : items) {
        HashMap<Object, Object> theItem = new HashMap<Object, Object>();
        theItem.put("studySubject", studySubjectBean);
        theItem.put("studySubject.label", studySubjectBean.getLabel());
        theItem.put("studySubject.status", studySubjectBean.getStatus());
        theItem.put("enrolledAt", ((StudyBean) getStudyDAO().findByPK(studySubjectBean.getStudyId())).getIdentifier());
        SubjectBean subjectBean = (SubjectBean) getSubjectDAO().findByPK(studySubjectBean.getSubjectId());
        theItem.put("subject", subjectBean);
        theItem.put("subject.charGender", subjectBean.getGender());
        // study group classes
        SubjectGroupMapBean subjectGroupMapBean = new SubjectGroupMapBean();
        for (StudyGroupClassBean studyGroupClass : getStudyGroupClasses()) {
            subjectGroupMapBean = getSubjectGroupMapDAO().findAllByStudySubjectAndStudyGroupClass(studySubjectBean.getId(), studyGroupClass.getId());
            if (null != subjectGroupMapBean) {
                theItem.put("sgc_" + studyGroupClass.getId(), subjectGroupMapBean.getStudyGroupId());
                theItem.put("grpName_sgc_" + studyGroupClass.getId(), subjectGroupMapBean.getStudyGroupName());
            }
        }
        subjectGroupMapBean = null;
        HashMap<String, EventCRFBean> crfAsKeyEventCrfAsValue = getEventsCrfsForStudySubject(studySubjectBean);
        // Get the event Status
        List<StudyEventBean> eventsForStudySubjectAndEventDefinitions = getStudyEventDAO().findAllByDefinitionAndSubject(selectedStudyEventDefinition, studySubjectBean);
        List<DisplayBean> events = new ArrayList<DisplayBean>();
        // study event size < 1
        if (eventsForStudySubjectAndEventDefinitions.size() < 1) {
            DisplayBean d = new DisplayBean();
            d.getProps().put("event", null);
            d.getProps().put("event.status", SubjectEventStatus.NOT_SCHEDULED);
            d.getProps().put("studySubject.createdDate", null);
            for (int i = 0; i < getCrfs(selectedStudyEventDefinition).size(); i++) {
                CRFBean crf = getCrfs(selectedStudyEventDefinition).get(i);
                d.getProps().put("crf_" + crf.getId(), DataEntryStage.UNCOMPLETED);
                d.getProps().put("crf_" + crf.getId() + "_eventCrf", null);
                d.getProps().put("crf_" + crf.getId() + "_crf", crf);
                // d.getProps().put("crf_" + crf.getId() + "_eventDefinitionCrf", eventDefinitionCrfs.get(i));
                d.getProps().put("crf_" + crf.getId() + "_eventDefinitionCrf", getEventDefinitionCRFBean(selectedStudyEventDefinition.getId(), crf, studySubjectBean));
                theItem.put("crf_" + crf.getId(), "");
            }
            events.add(d);
        }
        // study event size >0
        for (StudyEventBean studyEventBean : eventsForStudySubjectAndEventDefinitions) {
            DisplayBean d = new DisplayBean();
            d.getProps().put("event", studyEventBean);
            d.getProps().put("event.status", studyEventBean.getSubjectEventStatus());
            d.getProps().put("studySubject.createdDate", studyEventBean.getDateStarted());
            for (int i = 0; i < getCrfs(selectedStudyEventDefinition).size(); i++) {
                CRFBean crf = getCrfs(selectedStudyEventDefinition).get(i);
                EventCRFBean eventCRFBean = crfAsKeyEventCrfAsValue.get(crf.getId() + "_" + studyEventBean.getId());
                if (eventCRFBean != null) {
                    d.getProps().put("crf_" + crf.getId(), eventCRFBean.getStage());
                    d.getProps().put("crf_" + crf.getId() + "_eventCrf", eventCRFBean);
                } else {
                    d.getProps().put("crf_" + crf.getId(), DataEntryStage.UNCOMPLETED);
                    d.getProps().put("crf_" + crf.getId() + "_eventCrf", null);
                }
                d.getProps().put("crf_" + crf.getId() + "_crf", crf);
                // d.getProps().put("crf_" + crf.getId() + "_eventDefinitionCrf", eventDefinitionCrfs.get(i));
                d.getProps().put("crf_" + crf.getId() + "_eventDefinitionCrf", getEventDefinitionCRFBean(selectedStudyEventDefinition.getId(), crf, studySubjectBean));
                theItem.put("crf_" + crf.getId(), "");
            }
            events.add(d);
        }
        theItem.put("events", events);
        theItem.put("event.status", "");
        theItem.put("studySubject.createdDate", "");
        theItem.put("webappContext", tableFacade.getWebContext().getContextPath());
        theItems.add(theItem);
    }
    // Do not forget to set the items back on the tableFacade.
    tableFacade.setItems(theItems);
}
Also used : SubjectGroupMapBean(org.akaza.openclinica.bean.submit.SubjectGroupMapBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ListEventsForSubjectSort(org.akaza.openclinica.dao.managestudy.ListEventsForSubjectSort) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) SubjectBean(org.akaza.openclinica.bean.submit.SubjectBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) ListEventsForSubjectFilter(org.akaza.openclinica.dao.managestudy.ListEventsForSubjectFilter) StudyGroupClassBean(org.akaza.openclinica.bean.managestudy.StudyGroupClassBean) Limit(org.jmesa.limit.Limit)

Example 95 with CRFBean

use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.

the class ListEventsForSubjectTableFactory method getEventsCrfsForStudySubject.

/**
 * This builds a hashmap object whose key is "crfId_eventId". This is to target a specific form
 * in an event if the form is used elsewhere.
 * @param studySubjectBean
 * @return
 */
private HashMap<String, EventCRFBean> getEventsCrfsForStudySubject(StudySubjectBean studySubjectBean) {
    List<EventCRFBean> eventCrfs = getEventCRFDAO().findAllByStudySubject(studySubjectBean.getId());
    HashMap<String, EventCRFBean> crfAsKeyEventCrfAsValue = new HashMap<>();
    for (EventCRFBean eventCRFBean : eventCrfs) {
        CRFBean crf = getCrfDAO().findByVersionId(eventCRFBean.getCRFVersionId());
        crfAsKeyEventCrfAsValue.put(crf.getId() + "_" + eventCRFBean.getStudyEventId(), eventCRFBean);
    }
    return crfAsKeyEventCrfAsValue;
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) HashMap(java.util.HashMap) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean)

Aggregations

CRFBean (org.akaza.openclinica.bean.admin.CRFBean)138 ArrayList (java.util.ArrayList)95 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)78 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)78 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)70 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)67 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)63 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)56 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)44 HashMap (java.util.HashMap)43 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)43 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)40 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)37 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)29 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)27 Iterator (java.util.Iterator)26 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)26 DisplayEventCRFBean (org.akaza.openclinica.bean.submit.DisplayEventCRFBean)22 ItemBean (org.akaza.openclinica.bean.submit.ItemBean)21 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)20