Search in sources :

Example 61 with EventCRFDAO

use of org.akaza.openclinica.dao.submit.EventCRFDAO in project OpenClinica by OpenClinica.

the class DisplaySectionBeanHandler method getDisplaySectionBeans.

/**
     * This method creates a List of DisplaySectionBeans, returning them in the
     * order that the sections appear in a CRF. This List is "lazily"
     * initialized the first time it is requested.
     *
     * @return A List of DisplaySectionBeans.
     * @see org.akaza.openclinica.control.managestudy.PrintCRFServlet
     * @see org.akaza.openclinica.control.managestudy.PrintDataEntryServlet
     */
public List<DisplaySectionBean> getDisplaySectionBeans() {
    FormBeanUtil formBeanUtil;
    ViewPersistanceHandler persistanceHandler;
    ArrayList<SectionBean> allCrfSections;
    // DAO classes for getting item definitions
    SectionDAO sectionDao;
    CRFVersionDAO crfVersionDao;
    if (displaySectionBeans == null) {
        displaySectionBeans = new ArrayList<DisplaySectionBean>();
        formBeanUtil = new FormBeanUtil();
        if (hasStoredData)
            persistanceHandler = new ViewPersistanceHandler();
        // We need a CRF version id to populate the form display
        if (this.crfVersionId == 0) {
            return displaySectionBeans;
        }
        sectionDao = new SectionDAO(dataSource);
        allCrfSections = (ArrayList) sectionDao.findByVersionId(this.crfVersionId);
        // for the purposes of null values, try to obtain a valid
        // eventCrfDefinition id
        EventDefinitionCRFBean eventDefBean = null;
        EventCRFBean eventCRFBean = new EventCRFBean();
        if (eventCRFId > 0) {
            EventCRFDAO ecdao = new EventCRFDAO(dataSource);
            eventCRFBean = (EventCRFBean) ecdao.findByPK(eventCRFId);
            StudyEventDAO sedao = new StudyEventDAO(dataSource);
            StudyEventBean studyEvent = (StudyEventBean) sedao.findByPK(eventCRFBean.getStudyEventId());
            EventDefinitionCRFDAO eventDefinitionCRFDAO = new EventDefinitionCRFDAO(dataSource);
            StudyDAO sdao = new StudyDAO(dataSource);
            StudyBean study = sdao.findByStudySubjectId(eventCRFBean.getStudySubjectId());
            eventDefBean = eventDefinitionCRFDAO.findByStudyEventIdAndCRFVersionId(study, studyEvent.getId(), this.crfVersionId);
        }
        eventDefBean = eventDefBean == null ? new EventDefinitionCRFBean() : eventDefBean;
        // Create an array or List of DisplaySectionBeans representing each
        // section
        // for printing
        DisplaySectionBean displaySectionBean;
        for (SectionBean sectionBean : allCrfSections) {
            displaySectionBean = formBeanUtil.createDisplaySectionBWithFormGroupsForPrint(sectionBean.getId(), this.crfVersionId, dataSource, eventDefBean.getId(), eventCRFBean, context);
            displaySectionBeans.add(displaySectionBean);
        }
    }
    return displaySectionBeans;
}
Also used : CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) FormBeanUtil(org.akaza.openclinica.view.form.FormBeanUtil) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) DisplaySectionBean(org.akaza.openclinica.bean.submit.DisplaySectionBean) SectionBean(org.akaza.openclinica.bean.submit.SectionBean) DisplaySectionBean(org.akaza.openclinica.bean.submit.DisplaySectionBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) ViewPersistanceHandler(org.akaza.openclinica.view.form.ViewPersistanceHandler) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) SectionDAO(org.akaza.openclinica.dao.submit.SectionDAO)

Example 62 with EventCRFDAO

use of org.akaza.openclinica.dao.submit.EventCRFDAO in project OpenClinica by OpenClinica.

the class SDVUtil method getAllEventCRFs.

public List<EventCRFBean> getAllEventCRFs(List<StudyEventBean> studyEventBeans) {
    List<EventCRFBean> eventCRFBeans = new ArrayList<EventCRFBean>();
    List<EventCRFBean> studyEventCRFBeans = new ArrayList<EventCRFBean>();
    EventCRFDAO eventCRFDAO = new EventCRFDAO(dataSource);
    for (StudyEventBean studyEventBean : studyEventBeans) {
        eventCRFBeans = eventCRFDAO.findAllByStudyEvent(studyEventBean);
        if (eventCRFBeans != null && !eventCRFBeans.isEmpty()) {
            studyEventCRFBeans.addAll(eventCRFBeans);
        }
    }
    return studyEventCRFBeans;
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) ArrayList(java.util.ArrayList) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 63 with EventCRFDAO

use of org.akaza.openclinica.dao.submit.EventCRFDAO in project OpenClinica by OpenClinica.

the class SDVUtil method getFilteredItemsSubject.

@SuppressWarnings("unchecked")
private Collection<SubjectSDVContainer> getFilteredItemsSubject(FilterSet filterSet, SortSet sortSet, int rowStart, int rowEnd, int studyId, int studySubjectId, HttpServletRequest request) {
    EventCRFDAO eventCRFDAO = new EventCRFDAO(dataSource);
    StudyEventDAO studyEventDAO = new StudyEventDAO(dataSource);
    List<EventCRFBean> eventCRFBeans = new ArrayList<EventCRFBean>();
    String label = "";
    String eventName = "";
    String eventDate = "";
    String sdvStatus = "";
    String crfStatus = "";
    if (filterSet.getFilter("studySubjectId") != null) {
        label = filterSet.getFilter("studySubjectId").getValue().trim();
        eventCRFBeans = eventCRFDAO.getEventCRFsByStudySubjectLabelLimit(label, studyId, studyId, rowEnd - rowStart, rowStart);
    } else if (filterSet.getFilter("eventName") != null) {
        eventName = filterSet.getFilter("eventName").getValue().trim();
    // eventCRFBeans = eventCRFDAO.getEventCRFsByEventNameLimit(eventName,
    //   rowEnd-rowStart,rowStart);
    } else if (filterSet.getFilter("eventDate") != null) {
        eventDate = filterSet.getFilter("eventDate").getValue().trim();
    //  eventCRFBeans = eventCRFDAO.getEventCRFsByEventDateLimit(studyId,eventDate,
    //    rowEnd-rowStart,rowStart);
    } else if (filterSet.getFilter("crfStatus") != null) {
        crfStatus = filterSet.getFilter("crfStatus").getValue().trim();
    //Get the study event for the event crf
    // eventCRFBeans = eventCRFDAO.getEventCRFsByCRFStatus(studyId,
    //   SubjectEventStatus.getSubjectEventStatusIdByName(crfStatus),
    //   rowEnd-rowStart,rowStart);
    } else if (filterSet.getFilter("sdvStatusActions") != null) {
        sdvStatus = filterSet.getFilter("sdvStatusActions").getValue().trim();
    //  eventCRFBeans = eventCRFDAO.getEventCRFsByStudySDV(studyId,
    //    ("complete".equalsIgnoreCase(sdvStatus)),
    //   rowEnd-rowStart,rowStart);
    } else {
        eventCRFBeans = eventCRFDAO.getEventCRFsByStudySubjectLimit(studySubjectId, studyId, studyId, rowEnd - rowStart, rowStart);
    }
    return getSubjectRows(eventCRFBeans, request);
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) ArrayList(java.util.ArrayList) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 64 with EventCRFDAO

use of org.akaza.openclinica.dao.submit.EventCRFDAO in project OpenClinica by OpenClinica.

the class SDVUtil method getTotalRowCountSubjects.

public int getTotalRowCountSubjects(FilterSet filterSet, int studyId, int studySubjectId) {
    EventCRFDAO eventCRFDAO = new EventCRFDAO(dataSource);
    if (filterSet.getFilters().size() == 0) {
        return eventCRFDAO.countEventCRFsByStudySubject(studySubjectId, studyId, studyId);
    }
    int count = 0;
    //Filter for study subject label
    StudySubjectDAO studySubjectDAO = new StudySubjectDAO(dataSource);
    StudySubjectBean studySubjectBean = new StudySubjectBean();
    studySubjectBean = (StudySubjectBean) studySubjectDAO.findByPK(studySubjectId);
    String label = studySubjectBean.getLabel();
    String eventNameValue = "";
    String eventDateValue = "";
    String crfStatus = "";
    String sdvStatus = "";
    for (Filter filter : filterSet.getFilters()) {
        if (filter.getProperty().equalsIgnoreCase("eventName")) {
            eventNameValue = filter.getValue();
            continue;
        }
        if (filter.getProperty().equalsIgnoreCase("eventDate")) {
            eventDateValue = filter.getValue();
            continue;
        }
        if (filter.getProperty().equalsIgnoreCase("crfStatus")) {
            crfStatus = filter.getValue();
            continue;
        }
        if (filter.getProperty().equalsIgnoreCase("sdvStatusActions")) {
            sdvStatus = filter.getValue();
        }
    }
    if (eventNameValue.length() > 0) {
        return eventCRFDAO.countEventCRFsByEventNameSubjectLabel(eventNameValue, label);
    }
    if (eventDateValue.length() > 0) {
    //return eventCRFDAO.countEventCRFsByEventDate(studyId,eventDateValue);
    }
    if (crfStatus.length() > 0) {
    //return eventCRFDAO.countEventCRFsByCRFStatus(studyId,
    // SubjectEventStatus.getSubjectEventStatusIdByName(crfStatus));
    }
    if (sdvStatus.length() > 0) {
    // return eventCRFDAO.countEventCRFsByStudySDV(studyId,
    //  ("complete".equalsIgnoreCase(sdvStatus)));
    }
    return eventCRFDAO.countEventCRFsByStudySubject(studySubjectId, studyId, studyId);
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) EventCRFSDVFilter(org.akaza.openclinica.dao.EventCRFSDVFilter) Filter(org.jmesa.limit.Filter) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 65 with EventCRFDAO

use of org.akaza.openclinica.dao.submit.EventCRFDAO in project OpenClinica by OpenClinica.

the class SDVUtil method setSDVStatusForStudySubjects.

public boolean setSDVStatusForStudySubjects(List<Integer> studySubjectIds, int userId, boolean setVerification) {
    EventCRFDAO eventCRFDAO = new EventCRFDAO(dataSource);
    StudySubjectDAO studySubjectDAO = new StudySubjectDAO(dataSource);
    EventDefinitionCRFDAO eventDefinitionCrfDAO = new EventDefinitionCRFDAO(dataSource);
    StudyEventDAO studyEventDAO = new StudyEventDAO(dataSource);
    CRFDAO crfDAO = new CRFDAO(dataSource);
    if (studySubjectIds == null || studySubjectIds.isEmpty()) {
        return true;
    }
    for (Integer studySubjectId : studySubjectIds) {
        ArrayList<EventCRFBean> eventCrfs = eventCRFDAO.getEventCRFsByStudySubjectCompleteOrLocked(studySubjectId);
        StudySubjectBean studySubject = (StudySubjectBean) studySubjectDAO.findByPK(studySubjectId);
        for (EventCRFBean eventCRFBean : eventCrfs) {
            CRFBean crfBean = crfDAO.findByVersionId(eventCRFBean.getCRFVersionId());
            StudyEventBean studyEvent = (StudyEventBean) studyEventDAO.findByPK(eventCRFBean.getStudyEventId());
            EventDefinitionCRFBean eventDefinitionCrf = eventDefinitionCrfDAO.findByStudyEventDefinitionIdAndCRFIdAndStudyId(studyEvent.getStudyEventDefinitionId(), crfBean.getId(), studySubject.getStudyId());
            if (eventDefinitionCrf.getId() == 0) {
                eventDefinitionCrf = eventDefinitionCrfDAO.findForStudyByStudyEventDefinitionIdAndCRFId(studyEvent.getStudyEventDefinitionId(), crfBean.getId());
            }
            if (eventDefinitionCrf.getSourceDataVerification() == SourceDataVerification.AllREQUIRED || eventDefinitionCrf.getSourceDataVerification() == SourceDataVerification.PARTIALREQUIRED) {
                try {
                    eventCRFDAO.setSDVStatus(setVerification, userId, eventCRFBean.getId());
                } catch (Exception exc) {
                    //   System.out.println(exc.getMessage());
                    return false;
                }
            }
        }
        studySubjectDAO.update(studySubject);
    }
    return true;
}
Also used : EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) ServletException(javax.servlet.ServletException) IOException(java.io.IOException) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Aggregations

EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)106 ArrayList (java.util.ArrayList)80 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)76 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)73 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)71 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)57 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)51 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)51 Date (java.util.Date)50 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)49 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)49 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)47 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)45 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)45 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)43 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)41 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)37 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)34 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)32 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)24