Search in sources :

Example 6 with DisplayEventCRFBean

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

the class RemoveStudyEventServlet method getDisplayEventCRFs.

/**
     * Each of the event CRFs with its corresponding CRFBean. Then generates a
     * list of DisplayEventCRFBeans, one for each event CRF.
     *
     * @param eventCRFs
     *            The list of event CRFs for this study event.
     * @param eventDefinitionCRFs
     *            The list of event definition CRFs for this study event.
     * @return The list of DisplayEventCRFBeans for this study event.
     */
private ArrayList getDisplayEventCRFs(ArrayList eventCRFs, ArrayList eventDefinitionCRFs) {
    ArrayList answer = new ArrayList();
    HashMap definitionsById = new HashMap();
    int i;
    for (i = 0; i < eventDefinitionCRFs.size(); i++) {
        EventDefinitionCRFBean edc = (EventDefinitionCRFBean) eventDefinitionCRFs.get(i);
        definitionsById.put(new Integer(edc.getStudyEventDefinitionId()), edc);
    }
    StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
    CRFDAO cdao = new CRFDAO(sm.getDataSource());
    CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
    for (i = 0; i < eventCRFs.size(); i++) {
        EventCRFBean ecb = (EventCRFBean) eventCRFs.get(i);
        // populate the event CRF with its crf bean
        int crfVersionId = ecb.getCRFVersionId();
        CRFBean cb = cdao.findByVersionId(crfVersionId);
        ecb.setCrf(cb);
        CRFVersionBean cvb = (CRFVersionBean) cvdao.findByPK(crfVersionId);
        ecb.setCrfVersion(cvb);
        // then get the definition so we can call
        // DisplayEventCRFBean.setFlags
        int studyEventId = ecb.getStudyEventId();
        int studyEventDefinitionId = sedao.getDefinitionIdFromStudyEventId(studyEventId);
        EventDefinitionCRFBean edc = (EventDefinitionCRFBean) definitionsById.get(new Integer(studyEventDefinitionId));
        DisplayEventCRFBean dec = new DisplayEventCRFBean();
        dec.setFlags(ecb, ub, currentRole, edc.isDoubleEntry());
        answer.add(dec);
    }
    return answer;
}
Also used : DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) HashMap(java.util.HashMap) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) ArrayList(java.util.ArrayList) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)

Example 7 with DisplayEventCRFBean

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

the class RemoveEventCRFServlet method processRequest.

@Override
public void processRequest() throws Exception {
    FormProcessor fp = new FormProcessor(request);
    // eventCRFId
    int eventCRFId = fp.getInt("id");
    // studySubjectId
    int studySubId = fp.getInt("studySubId");
    checkStudyLocked("ViewStudySubject?id" + studySubId, respage.getString("current_study_locked"));
    StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
    StudySubjectDAO subdao = new StudySubjectDAO(sm.getDataSource());
    EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
    StudyDAO sdao = new StudyDAO(sm.getDataSource());
    if (eventCRFId == 0) {
        addPageMessage(respage.getString("please_choose_an_event_CRF_to_remove"));
        request.setAttribute("id", new Integer(studySubId).toString());
        forwardPage(Page.VIEW_STUDY_SUBJECT_SERVLET);
    } else {
        EventCRFBean eventCRF = (EventCRFBean) ecdao.findByPK(eventCRFId);
        StudySubjectBean studySub = (StudySubjectBean) subdao.findByPK(studySubId);
        request.setAttribute("studySub", studySub);
        // construct info needed on view event crf page
        CRFDAO cdao = new CRFDAO(sm.getDataSource());
        CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
        int crfVersionId = eventCRF.getCRFVersionId();
        CRFBean cb = cdao.findByVersionId(crfVersionId);
        eventCRF.setCrf(cb);
        CRFVersionBean cvb = (CRFVersionBean) cvdao.findByPK(crfVersionId);
        eventCRF.setCrfVersion(cvb);
        // then get the definition so we can call
        // DisplayEventCRFBean.setFlags
        int studyEventId = eventCRF.getStudyEventId();
        StudyEventBean event = (StudyEventBean) sedao.findByPK(studyEventId);
        int studyEventDefinitionId = sedao.getDefinitionIdFromStudyEventId(studyEventId);
        StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
        StudyEventDefinitionBean sed = (StudyEventDefinitionBean) seddao.findByPK(studyEventDefinitionId);
        event.setStudyEventDefinition(sed);
        request.setAttribute("event", event);
        EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(sm.getDataSource());
        StudyBean study = (StudyBean) sdao.findByPK(studySub.getStudyId());
        EventDefinitionCRFBean edc = edcdao.findByStudyEventDefinitionIdAndCRFId(study, studyEventDefinitionId, cb.getId());
        DisplayEventCRFBean dec = new DisplayEventCRFBean();
        dec.setEventCRF(eventCRF);
        dec.setFlags(eventCRF, ub, currentRole, edc.isDoubleEntry());
        // find all item data
        ItemDataDAO iddao = new ItemDataDAO(sm.getDataSource());
        ArrayList itemData = iddao.findAllByEventCRFId(eventCRF.getId());
        request.setAttribute("items", itemData);
        String action = request.getParameter("action");
        if ("confirm".equalsIgnoreCase(action)) {
            if (eventCRF.getStatus().equals(Status.DELETED) || eventCRF.getStatus().equals(Status.AUTO_DELETED)) {
                addPageMessage(respage.getString("this_event_CRF_is_removed_for_this_study") + " " + respage.getString("please_contact_sysadmin_for_more_information"));
                request.setAttribute("id", new Integer(studySubId).toString());
                forwardPage(Page.VIEW_STUDY_SUBJECT_SERVLET);
                return;
            }
            request.setAttribute("displayEventCRF", dec);
            forwardPage(Page.REMOVE_EVENT_CRF);
        } else {
            logger.info("submit to remove the event CRF from study");
            eventCRF.setStatus(Status.DELETED);
            eventCRF.setUpdater(ub);
            eventCRF.setUpdatedDate(new Date());
            ecdao.update(eventCRF);
            // remove all the item data
            for (int a = 0; a < itemData.size(); a++) {
                ItemDataBean item = (ItemDataBean) itemData.get(a);
                if (!item.getStatus().equals(Status.DELETED)) {
                    item.setStatus(Status.AUTO_DELETED);
                    item.setUpdater(ub);
                    item.setUpdatedDate(new Date());
                    iddao.update(item);
                    DiscrepancyNoteDAO dnDao = new DiscrepancyNoteDAO(sm.getDataSource());
                    List dnNotesOfRemovedItem = dnDao.findExistingNotesForItemData(item.getId());
                    if (!dnNotesOfRemovedItem.isEmpty()) {
                        DiscrepancyNoteBean itemParentNote = null;
                        for (Object obj : dnNotesOfRemovedItem) {
                            if (((DiscrepancyNoteBean) obj).getParentDnId() == 0) {
                                itemParentNote = (DiscrepancyNoteBean) obj;
                            }
                        }
                        DiscrepancyNoteBean dnb = new DiscrepancyNoteBean();
                        if (itemParentNote != null) {
                            dnb.setParentDnId(itemParentNote.getId());
                            dnb.setDiscrepancyNoteTypeId(itemParentNote.getDiscrepancyNoteTypeId());
                        }
                        dnb.setResolutionStatusId(ResolutionStatus.CLOSED.getId());
                        dnb.setStudyId(currentStudy.getId());
                        dnb.setAssignedUserId(ub.getId());
                        dnb.setOwner(ub);
                        dnb.setEntityType(DiscrepancyNoteBean.ITEM_DATA);
                        dnb.setEntityId(item.getId());
                        dnb.setColumn("value");
                        dnb.setCreatedDate(new Date());
                        dnb.setDescription("The item has been removed, this Discrepancy Note has been Closed.");
                        dnDao.create(dnb);
                        dnDao.createMapping(dnb);
                        itemParentNote.setResolutionStatusId(ResolutionStatus.CLOSED.getId());
                        dnDao.update(itemParentNote);
                    }
                }
            }
            String emailBody = respage.getString("the_event_CRF") + " " + cb.getName() + " " + respage.getString("has_been_removed_from_the_event") + event.getStudyEventDefinition().getName() + ". " + respage.getString("has_been_removed_from_the_event_cont");
            addPageMessage(emailBody);
            sendEmail(emailBody);
            request.setAttribute("id", new Integer(studySubId).toString());
            forwardPage(Page.VIEW_STUDY_SUBJECT_SERVLET);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) ItemDataDAO(org.akaza.openclinica.dao.submit.ItemDataDAO) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean) ArrayList(java.util.ArrayList) List(java.util.List) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) 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) Date(java.util.Date) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean)

Example 8 with DisplayEventCRFBean

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

the class RestoreStudyEventServlet method getDisplayEventCRFs.

/**
     * Each of the event CRFs with its corresponding CRFBean. Then generates a
     * list of DisplayEventCRFBeans, one for each event CRF.
     *
     * @param eventCRFs
     *            The list of event CRFs for this study event.
     * @param eventDefinitionCRFs
     *            The list of event definition CRFs for this study event.
     * @return The list of DisplayEventCRFBeans for this study event.
     */
private ArrayList getDisplayEventCRFs(ArrayList eventCRFs, ArrayList eventDefinitionCRFs) {
    ArrayList answer = new ArrayList();
    HashMap definitionsById = new HashMap();
    int i;
    for (i = 0; i < eventDefinitionCRFs.size(); i++) {
        EventDefinitionCRFBean edc = (EventDefinitionCRFBean) eventDefinitionCRFs.get(i);
        definitionsById.put(new Integer(edc.getStudyEventDefinitionId()), edc);
    }
    StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
    CRFDAO cdao = new CRFDAO(sm.getDataSource());
    CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
    for (i = 0; i < eventCRFs.size(); i++) {
        EventCRFBean ecb = (EventCRFBean) eventCRFs.get(i);
        // populate the event CRF with its crf bean
        int crfVersionId = ecb.getCRFVersionId();
        CRFBean cb = cdao.findByVersionId(crfVersionId);
        ecb.setCrf(cb);
        CRFVersionBean cvb = (CRFVersionBean) cvdao.findByPK(crfVersionId);
        ecb.setCrfVersion(cvb);
        // then get the definition so we can call
        // DisplayEventCRFBean.setFlags
        int studyEventId = ecb.getStudyEventId();
        int studyEventDefinitionId = sedao.getDefinitionIdFromStudyEventId(studyEventId);
        EventDefinitionCRFBean edc = (EventDefinitionCRFBean) definitionsById.get(new Integer(studyEventDefinitionId));
        DisplayEventCRFBean dec = new DisplayEventCRFBean();
        dec.setFlags(ecb, ub, currentRole, edc.isDoubleEntry());
        answer.add(dec);
    }
    return answer;
}
Also used : DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) HashMap(java.util.HashMap) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) ArrayList(java.util.ArrayList) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)

Example 9 with DisplayEventCRFBean

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

the class ViewStudySubjectServlet method getDisplayEventCRFs.

/**
     * Each of the event CRFs with its corresponding CRFBean. Then generates a
     * list of DisplayEventCRFBeans, one for each event CRF.
     *
     * @param eventCRFs
     *            The list of event CRFs for this study event.
     * @param eventDefinitionCRFs
     *            The list of event definition CRFs for this study event.
     * @return The list of DisplayEventCRFBeans for this study event.
     */
public static ArrayList getDisplayEventCRFs(DataSource ds, ArrayList eventCRFs, ArrayList eventDefinitionCRFs, UserAccountBean ub, StudyUserRoleBean currentRole, SubjectEventStatus status, StudyBean study) {
    ArrayList answer = new ArrayList();
    // HashMap definitionsById = new HashMap();
    int i;
    /*
         * for (i = 0; i < eventDefinitionCRFs.size(); i++) {
         * EventDefinitionCRFBean edc = (EventDefinitionCRFBean)
         * eventDefinitionCRFs.get(i); definitionsById.put(new
         * Integer(edc.getStudyEventDefinitionId()), edc); }
         */
    StudyEventDAO sedao = new StudyEventDAO(ds);
    CRFDAO cdao = new CRFDAO(ds);
    CRFVersionDAO cvdao = new CRFVersionDAO(ds);
    FormLayoutDAO fldao = new FormLayoutDAO(ds);
    ItemDataDAO iddao = new ItemDataDAO(ds);
    EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(ds);
    for (i = 0; i < eventCRFs.size(); i++) {
        EventCRFBean ecb = (EventCRFBean) eventCRFs.get(i);
        // populate the event CRF with its crf bean
        int crfVersionId = ecb.getCRFVersionId();
        int formLayoutId = ecb.getFormLayoutId();
        CRFBean cb = cdao.findByLayoutId(formLayoutId);
        ecb.setCrf(cb);
        CRFVersionBean cvb = (CRFVersionBean) cvdao.findByPK(crfVersionId);
        ecb.setCrfVersion(cvb);
        FormLayoutBean flb = (FormLayoutBean) fldao.findByPK(formLayoutId);
        ecb.setFormLayout(flb);
        // then get the definition so we can call
        // DisplayEventCRFBean.setFlags
        int studyEventId = ecb.getStudyEventId();
        int studyEventDefinitionId = sedao.getDefinitionIdFromStudyEventId(studyEventId);
        // EventDefinitionCRFBean edc = (EventDefinitionCRFBean)
        // definitionsById.get(new Integer(
        // studyEventDefinitionId));
        // fix problem of the above code(commented out), find the correct
        // edc, note that on definitionId can be related to multiple
        // eventdefinitioncrfBeans
        EventDefinitionCRFBean edc = edcdao.findByStudyEventDefinitionIdAndCRFId(study, studyEventDefinitionId, cb.getId());
        // rules updated 112007 tbh
        if (status.equals(SubjectEventStatus.LOCKED) || status.equals(SubjectEventStatus.SKIPPED) || status.equals(SubjectEventStatus.STOPPED)) {
            ecb.setStage(DataEntryStage.LOCKED);
        // we need to set a SED-wide flag here, because other edcs
        // in this event can be filled in and change the status, tbh
        } else if (status.equals(SubjectEventStatus.INVALID)) {
            ecb.setStage(DataEntryStage.LOCKED);
        } else if (!cb.getStatus().equals(Status.AVAILABLE)) {
            ecb.setStage(DataEntryStage.LOCKED);
        } else if (!cvb.getStatus().equals(Status.AVAILABLE)) {
            ecb.setStage(DataEntryStage.LOCKED);
        }
        // TODO need to refactor since this is similar to other code, tbh
        if (edc != null) {
            // System.out.println("edc is not null, need to set flags");
            DisplayEventCRFBean dec = new DisplayEventCRFBean();
            dec.setEventDefinitionCRF(edc);
            // System.out.println("edc.isDoubleEntry()" +
            // edc.isDoubleEntry() + ecb.getId());
            dec.setFlags(ecb, ub, currentRole, edc.isDoubleEntry());
            if (dec.isLocked()) {
            // System.out.println("*** found a locked DEC:
            // "+edc.getCrfName());
            }
            ArrayList idata = iddao.findAllByEventCRFId(ecb.getId());
            if (!idata.isEmpty()) {
                // consider an event crf started only if item data get
                // created
                answer.add(dec);
            }
        }
    }
    return answer;
}
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) ArrayList(java.util.ArrayList) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) ItemDataDAO(org.akaza.openclinica.dao.submit.ItemDataDAO) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) DisplayEventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.DisplayEventDefinitionCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) FormLayoutDAO(org.akaza.openclinica.dao.submit.FormLayoutDAO) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) DisplayEventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.DisplayEventDefinitionCRFBean)

Example 10 with DisplayEventCRFBean

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

the class StudySubjectServiceImpl method getDisplayStudyEventsForStudySubject.

@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<DisplayStudyEventBean> getDisplayStudyEventsForStudySubject(StudySubjectBean studySubject, UserAccountBean userAccount, StudyUserRoleBean currentRole) {
    StudyEventDAO studyEventDao = new StudyEventDAO(dataSource);
    StudyEventDefinitionDAO studyEventDefinitionDao = new StudyEventDefinitionDAO(dataSource);
    StudyDAO studyDao = new StudyDAO(dataSource);
    EventDefinitionCRFDAO eventDefinitionCrfDao = new EventDefinitionCRFDAO(dataSource);
    EventCRFDAO eventCrfDao = new EventCRFDAO(dataSource);
    CRFDAO crfDao = new CRFDAO(dataSource);
    FormLayoutDAO formLayoutDAO = new FormLayoutDAO(dataSource);
    ArrayList events = studyEventDao.findAllByStudySubject(studySubject);
    Map<Integer, StudyEventDefinitionBean> eventDefinitionByEvent = studyEventDefinitionDao.findByStudySubject(studySubject.getId());
    StudyBean study = (StudyBean) studyDao.findByPK(studySubject.getStudyId());
    Map<Integer, SortedSet<EventDefinitionCRFBean>> eventDefinitionCrfByStudyEventDefinition;
    if (study.getParentStudyId() < 1) {
        // Is a study
        eventDefinitionCrfByStudyEventDefinition = eventDefinitionCrfDao.buildEventDefinitionCRFListByStudyEventDefinitionForStudy(studySubject.getId());
    } else {
        // Is a site
        eventDefinitionCrfByStudyEventDefinition = eventDefinitionCrfDao.buildEventDefinitionCRFListByStudyEventDefinition(studySubject.getId(), study.getId(), study.getParentStudyId());
    }
    Map<Integer, SortedSet<EventCRFBean>> eventCrfListByStudyEvent = eventCrfDao.buildEventCrfListByStudyEvent(studySubject.getId());
    Map<Integer, Integer> maxOrdinalByStudyEvent = studyEventDefinitionDao.buildMaxOrdinalByStudyEvent(studySubject.getId());
    Set<Integer> nonEmptyEventCrf = eventCrfDao.buildNonEmptyEventCrfIds(studySubject.getId());
    Map<Integer, FormLayoutBean> formLayoutById = formLayoutDAO.buildFormLayoutById(studySubject.getId());
    Map<Integer, CRFBean> crfById = crfDao.buildCrfById(studySubject.getId());
    ArrayList<DisplayStudyEventBean> displayEvents = new ArrayList<DisplayStudyEventBean>();
    for (int i = 0; i < events.size(); i++) {
        StudyEventBean event = (StudyEventBean) events.get(i);
        StudyEventDefinitionBean sed = eventDefinitionByEvent.get(event.getStudyEventDefinitionId());
        event.setStudyEventDefinition(sed);
        List eventDefinitionCRFs = new ArrayList((eventDefinitionCrfByStudyEventDefinition.containsKey(sed.getId()) ? eventDefinitionCrfByStudyEventDefinition.get(sed.getId()) : Collections.EMPTY_LIST));
        List eventCRFs = new ArrayList((eventCrfListByStudyEvent.containsKey(event.getId())) ? eventCrfListByStudyEvent.get(event.getId()) : Collections.EMPTY_LIST);
        // construct info needed on view study event page
        DisplayStudyEventBean de = new DisplayStudyEventBean();
        de.setStudyEvent(event);
        de.setDisplayEventCRFs((ArrayList<DisplayEventCRFBean>) getDisplayEventCRFs(eventCRFs, userAccount, currentRole, event.getSubjectEventStatus(), study, nonEmptyEventCrf, formLayoutById, crfById, event.getStudyEventDefinitionId(), eventDefinitionCRFs));
        ArrayList<DisplayEventDefinitionCRFBean> al = getUncompletedCRFs(eventDefinitionCRFs, eventCRFs, event.getSubjectEventStatus(), nonEmptyEventCrf, formLayoutById, crfById);
        populateUncompletedCRFsWithCRFAndVersions(al, formLayoutById, crfById);
        de.setUncompletedCRFs(al);
        // de.setMaximumSampleOrdinal(studyEventDao.getMaxSampleOrdinal(sed,
        // studySubject));
        de.setMaximumSampleOrdinal(maxOrdinalByStudyEvent.get(event.getStudyEventDefinitionId()));
        displayEvents.add(de);
    // event.setEventCRFs(createAllEventCRFs(eventCRFs,
    // eventDefinitionCRFs));
    }
    return displayEvents;
}
Also used : ArrayList(java.util.ArrayList) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) DisplayStudyEventBean(org.akaza.openclinica.bean.managestudy.DisplayStudyEventBean) SortedSet(java.util.SortedSet) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) ArrayList(java.util.ArrayList) List(java.util.List) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) DisplayEventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.DisplayEventDefinitionCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) DisplayStudyEventBean(org.akaza.openclinica.bean.managestudy.DisplayStudyEventBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) FormLayoutDAO(org.akaza.openclinica.dao.submit.FormLayoutDAO) DisplayEventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.DisplayEventDefinitionCRFBean)

Aggregations

DisplayEventCRFBean (org.akaza.openclinica.bean.submit.DisplayEventCRFBean)18 ArrayList (java.util.ArrayList)15 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)13 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)12 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)11 DisplayEventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.DisplayEventDefinitionCRFBean)11 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)10 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)10 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)9 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)8 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)7 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)7 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)7 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)6 HashMap (java.util.HashMap)5 DisplayStudyEventBean (org.akaza.openclinica.bean.managestudy.DisplayStudyEventBean)5 FormLayoutBean (org.akaza.openclinica.bean.submit.FormLayoutBean)5 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)4 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)4 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)4