Search in sources :

Example 1 with AuditDAO

use of org.akaza.openclinica.dao.admin.AuditDAO in project OpenClinica by OpenClinica.

the class AuditLogStudyServlet method processRequest.

/*
     * (non-Javadoc) Assume that we get the user id automatically. We will jump
     * from the edit user page if the user is an admin, they can get to see the
     * users' log
     * 
     * @see org.akaza.openclinica.control.core.SecureController#processRequest()
     */
/*
     * (non-Javadoc) redo this servlet to run the audits per study subject for
     * the study; need to add a studyId param and then use the
     * StudySubjectDAO.findAllByStudyOrderByLabel() method to grab a lot of
     * study subject beans and then return them much like in
     * ViewStudySubjectAuditLogServet.process()
     * 
     * currentStudy instead of studyId?
     */
@Override
protected void processRequest() throws Exception {
    int studyId = currentStudy.getId();
    StudySubjectDAO subdao = new StudySubjectDAO(sm.getDataSource());
    SubjectDAO sdao = new SubjectDAO(sm.getDataSource());
    AuditDAO adao = new AuditDAO(sm.getDataSource());
    FormProcessor fp = new FormProcessor(request);
    StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
    StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
    EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(sm.getDataSource());
    EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
    StudyDAO studydao = new StudyDAO(sm.getDataSource());
    CRFDAO cdao = new CRFDAO(sm.getDataSource());
    CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
    HashMap eventCRFAuditsHashMap = new HashMap();
    HashMap eventsHashMap = new HashMap();
    HashMap studySubjectAuditsHashMap = new HashMap();
    HashMap subjectHashMap = new HashMap();
    ArrayList studySubjects = subdao.findAllByStudyOrderByLabel(currentStudy);
    logger.info("found " + studySubjects.size() + " study subjects");
    request.setAttribute("studySubjects", studySubjects);
    for (int ss = 0; ss < studySubjects.size(); ss++) {
        ArrayList studySubjectAudits = new ArrayList();
        ArrayList eventCRFAudits = new ArrayList();
        StudySubjectBean studySubject = (StudySubjectBean) studySubjects.get(ss);
        // request.setAttribute("studySub"+ss, studySubject);
        SubjectBean subject = (SubjectBean) sdao.findByPK(studySubject.getSubjectId());
        subjectHashMap.put(new Integer(studySubject.getId()), subject);
        // logger.info("just set a subject with a status of
        // "+subject.getStatus().getName());
        // request.setAttribute("subject"+ss, subject);
        StudyBean study = (StudyBean) studydao.findByPK(studySubject.getStudyId());
        request.setAttribute("study", study);
        // hmm, repetitive work?
        // Show both study subject and subject audit events together
        // Study
        studySubjectAudits.addAll(adao.findStudySubjectAuditEvents(studySubject.getId()));
        // subject
        // value
        // changed
        // Global
        studySubjectAudits.addAll(adao.findSubjectAuditEvents(subject.getId()));
        // subject
        // value
        // changed
        studySubjectAuditsHashMap.put(new Integer(studySubject.getId()), studySubjectAudits);
        // request.setAttribute("studySubjectAudits"+ss,
        // studySubjectAudits);
        // Get the list of events
        ArrayList events = sedao.findAllByStudySubject(studySubject);
        for (int i = 0; i < events.size(); i++) {
            // Link study event definitions
            StudyEventBean studyEvent = (StudyEventBean) events.get(i);
            studyEvent.setStudyEventDefinition((StudyEventDefinitionBean) seddao.findByPK(studyEvent.getStudyEventDefinitionId()));
            // Link event CRFs
            studyEvent.setEventCRFs(ecdao.findAllByStudyEvent(studyEvent));
        }
        // for (int i = 0; i < events.size(); i++) {
        // StudyEventBean studyEvent = (StudyEventBean) events.get(i);
        // ArrayList eventCRFs = studyEvent.getEventCRFs();
        // for (int j = 0; j < eventCRFs.size(); j++) {
        // //Link CRF and CRF Versions
        // EventCRFBean eventCRF = (EventCRFBean) eventCRFs.get(j);
        // eventCRF.setCrfVersion((CRFVersionBean)
        // cvdao.findByPK(eventCRF.getCRFVersionId()));
        // eventCRF.setCrf((CRFBean)
        // cdao.findByVersionId(eventCRF.getCRFVersionId()));
        // //Get the event crf audits
        // eventCRFAudits.addAll(adao.findEventCRFAuditEvents(eventCRF.getId()));
        // }
        // }
        eventsHashMap.put(new Integer(studySubject.getId()), events);
    // request.setAttribute("events"+ss, events);
    // eventCRFAuditsHashMap.put(new Integer(studySubject.getId()),
    // eventCRFAudits);
    // request.setAttribute("eventCRFAudits"+ss, eventCRFAudits);
    }
    // request.setAttribute("eventCRFAudits", eventCRFAuditsHashMap);
    request.setAttribute("events", eventsHashMap);
    request.setAttribute("studySubjectAudits", studySubjectAuditsHashMap);
    request.setAttribute("study", currentStudy);
    request.setAttribute("subjects", subjectHashMap);
    // FormProcessor fp = new FormProcessor(request);
    // 
    // AuditEventDAO aeDAO = new AuditEventDAO(sm.getDataSource());
    // ArrayList al = aeDAO.findAllByStudyId(currentStudy.getId());
    // 
    // EntityBeanTable table = fp.getEntityBeanTable();
    // ArrayList allRows = AuditEventStudyRow.generateRowsFromBeans(al);
    // String[] columns = { "Date and Time", "Action", "Entity/Operation",
    // "Record ID", "Changes and Additions","Other Info" };
    // table.setColumns(new ArrayList(Arrays.asList(columns)));
    // table.hideColumnLink(4);
    // table.hideColumnLink(1);
    // table.hideColumnLink(5);
    // table.setQuery("AuditLogUser?userLogId="+userId, new HashMap());
    // String[] columns =
    // {resword.getString("date_and_time"),resword.getString("action_message"),
    // resword.getString("entity_operation"),
    // resword.getString("updated_by"),resword.getString("subject_unique_ID"),resword.getString("changes_and_additions"),
    // //"Other Info",
    // resword.getString("actions")};
    // table.setColumns(new ArrayList(Arrays.asList(columns)));
    // table.setAscendingSort(false);
    // table.hideColumnLink(1);
    // table.hideColumnLink(5);
    // table.hideColumnLink(6);
    // //table.hideColumnLink(7);
    // table.setQuery("AuditLogStudy", new HashMap());
    // table.setRows(allRows);
    // table.computeDisplay();
    // 
    // 
    // request.setAttribute("table", table);
    logger.warn("*** found servlet, sending to page ***");
    String pattn = "";
    String pattern2 = "";
    pattn = ResourceBundleProvider.getFormatBundle().getString("date_format_string");
    pattern2 = ResourceBundleProvider.getFormatBundle().getString("date_time_format_string");
    request.setAttribute("dateFormatPattern", pattn);
    request.setAttribute("dateTimeFormatPattern", pattern2);
    forwardPage(Page.AUDIT_LOG_STUDY);
}
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) HashMap(java.util.HashMap) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) SubjectDAO(org.akaza.openclinica.dao.submit.SubjectDAO) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) AuditDAO(org.akaza.openclinica.dao.admin.AuditDAO) SubjectBean(org.akaza.openclinica.bean.submit.SubjectBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 2 with AuditDAO

use of org.akaza.openclinica.dao.admin.AuditDAO in project OpenClinica by OpenClinica.

the class ExportExcelStudySubjectAuditLogServlet method processRequest.

@Override
public void processRequest() throws Exception {
    StudySubjectDAO subdao = new StudySubjectDAO(sm.getDataSource());
    SubjectDAO sdao = new SubjectDAO(sm.getDataSource());
    AuditDAO adao = new AuditDAO(sm.getDataSource());
    StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
    StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
    EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(sm.getDataSource());
    EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
    StudyDAO studydao = new StudyDAO(sm.getDataSource());
    CRFDAO cdao = new CRFDAO(sm.getDataSource());
    CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
    StudySubjectBean studySubject = null;
    SubjectBean subject = null;
    ArrayList events = null;
    ArrayList studySubjectAudits = new ArrayList();
    ArrayList eventCRFAudits = new ArrayList();
    ArrayList studyEventAudits = new ArrayList();
    ArrayList allDeletedEventCRFs = new ArrayList();
    ArrayList allEventCRFs = new ArrayList();
    ArrayList allEventCRFItems = new ArrayList();
    String attachedFilePath = Utils.getAttachedFilePath(currentStudy);
    FormProcessor fp = new FormProcessor(request);
    int studySubId = fp.getInt("id", true);
    if (studySubId == 0) {
        addPageMessage(respage.getString("please_choose_a_subject_to_view"));
        forwardPage(Page.LIST_STUDY_SUBJECTS);
    } else {
        studySubject = (StudySubjectBean) subdao.findByPK(studySubId);
        StudyBean study = (StudyBean) studydao.findByPK(studySubject.getStudyId());
        // Check if this StudySubject would be accessed from the Current Study
        if (studySubject.getStudyId() != currentStudy.getId()) {
            if (currentStudy.getParentStudyId() > 0) {
                addPageMessage(respage.getString("no_have_correct_privilege_current_study") + " " + respage.getString("change_active_study_or_contact"));
                forwardPage(Page.MENU_SERVLET);
                return;
            } else {
                // The SubjectStudy is not belong to currentstudy and current study is not a site.
                Collection sites = studydao.findOlnySiteIdsByStudy(currentStudy);
                if (!sites.contains(study.getId())) {
                    addPageMessage(respage.getString("no_have_correct_privilege_current_study") + " " + respage.getString("change_active_study_or_contact"));
                    forwardPage(Page.MENU_SERVLET);
                    return;
                }
            }
        }
        subject = (SubjectBean) sdao.findByPK(studySubject.getSubjectId());
        /* Show both study subject and subject audit events together */
        // Study subject value changed
        Collection studySubjectAuditEvents = adao.findStudySubjectAuditEvents(studySubject.getId());
        // integer values.
        for (Iterator iterator = studySubjectAuditEvents.iterator(); iterator.hasNext(); ) {
            AuditBean auditBean = (AuditBean) iterator.next();
            if (auditBean.getAuditEventTypeId() == 3) {
                auditBean.setOldValue(Status.get(Integer.parseInt(auditBean.getOldValue())).getName());
                auditBean.setNewValue(Status.get(Integer.parseInt(auditBean.getNewValue())).getName());
            }
        }
        studySubjectAudits.addAll(studySubjectAuditEvents);
        // Global subject value changed
        studySubjectAudits.addAll(adao.findSubjectAuditEvents(subject.getId()));
        studySubjectAudits.addAll(adao.findStudySubjectGroupAssignmentAuditEvents(studySubject.getId()));
        // Get the list of events
        events = sedao.findAllByStudySubject(studySubject);
        for (int i = 0; i < events.size(); i++) {
            // Link study event definitions
            StudyEventBean studyEvent = (StudyEventBean) events.get(i);
            studyEvent.setStudyEventDefinition((StudyEventDefinitionBean) seddao.findByPK(studyEvent.getStudyEventDefinitionId()));
            // Link event CRFs
            studyEvent.setEventCRFs(ecdao.findAllByStudyEvent(studyEvent));
            // Find deleted Event CRFs
            List deletedEventCRFs = adao.findDeletedEventCRFsFromAuditEvent(studyEvent.getId());
            allDeletedEventCRFs.addAll(deletedEventCRFs);
            List eventCRFs = (List) adao.findAllEventCRFAuditEvents(studyEvent.getId());
            allEventCRFs.addAll(eventCRFs);
            List eventCRFItems = (List) adao.findAllEventCRFAuditEventsWithItemDataType(studyEvent.getId());
            allEventCRFItems.addAll(eventCRFItems);
            logger.info("deletedEventCRFs size[" + deletedEventCRFs.size() + "]");
            logger.info("allEventCRFItems size[" + allEventCRFItems.size() + "]");
        }
        for (int i = 0; i < events.size(); i++) {
            StudyEventBean studyEvent = (StudyEventBean) events.get(i);
            studyEventAudits.addAll(adao.findStudyEventAuditEvents(studyEvent.getId()));
            ArrayList eventCRFs = studyEvent.getEventCRFs();
            for (int j = 0; j < eventCRFs.size(); j++) {
                // Link CRF and CRF Versions
                EventCRFBean eventCRF = (EventCRFBean) eventCRFs.get(j);
                eventCRF.setCrfVersion((CRFVersionBean) cvdao.findByPK(eventCRF.getCRFVersionId()));
                eventCRF.setCrf(cdao.findByVersionId(eventCRF.getCRFVersionId()));
                // Get the event crf audits
                eventCRFAudits.addAll(adao.findEventCRFAuditEventsWithItemDataType(eventCRF.getId()));
                logger.info("eventCRFAudits size [" + eventCRFAudits.size() + "] eventCRF id [" + eventCRF.getId() + "]");
            }
        }
        ItemDataDAO itemDataDao = new ItemDataDAO(sm.getDataSource());
        for (Object o : eventCRFAudits) {
            AuditBean ab = (AuditBean) o;
            if (ab.getAuditTable().equalsIgnoreCase("item_data")) {
                ItemDataBean idBean = (ItemDataBean) itemDataDao.findByPK(ab.getEntityId());
                ab.setOrdinal(idBean.getOrdinal());
            }
        }
    }
    try {
        WritableFont headerFormat = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLUE2);
        WritableCellFormat cellFormat = new WritableCellFormat();
        cellFormat.setFont(headerFormat);
        response.setContentType("application/vnd.ms-excel");
        response.setHeader("Content-Disposition", "attachment; filename=export.xls");
        WorkbookSettings wbSettings = new WorkbookSettings();
        wbSettings.setLocale(new Locale("en", "EN"));
        WritableWorkbook workbook = Workbook.createWorkbook(response.getOutputStream(), wbSettings);
        int row = 0;
        // Subject Information
        workbook.createSheet("Subject Information", 0);
        WritableSheet excelSheet = workbook.getSheet(0);
        // Subject Summary
        String[] excelRow = new String[] { "study_subject_ID", "secondary_subject_ID", "date_of_birth", "person_ID", "created_by", "status" };
        for (int i = 0; i < excelRow.length; i++) {
            Label label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
            excelSheet.addCell(label);
        }
        row++;
        excelRow = new String[] { studySubject.getLabel(), studySubject.getSecondaryLabel(), dateFormat(subject.getDateOfBirth()), subject.getUniqueIdentifier(), studySubject.getOwner().getName(), studySubject.getStatus().getName() };
        for (int i = 0; i < excelRow.length; i++) {
            Label label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
            excelSheet.addCell(label);
        }
        row++;
        row++;
        // Subject Audit Events
        excelRow = new String[] { "audit_event", "date_time_of_server", "user", "value_type", "old", "new" };
        for (int i = 0; i < excelRow.length; i++) {
            Label label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
            excelSheet.addCell(label);
        }
        row++;
        for (int j = 0; j < studySubjectAudits.size(); j++) {
            AuditBean audit = (AuditBean) studySubjectAudits.get(j);
            excelRow = new String[] { audit.getAuditEventTypeName(), dateTimeFormat(audit.getAuditDate()), audit.getUserName(), audit.getEntityName(), audit.getOldValue(), audit.getNewValue() };
            for (int i = 0; i < excelRow.length; i++) {
                Label label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
                excelSheet.addCell(label);
            }
            row++;
        }
        row++;
        // Study Events
        excelRow = new String[] { "study_events", "location", "date", "occurrence_number" };
        for (int i = 0; i < excelRow.length; i++) {
            Label label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
            excelSheet.addCell(label);
        }
        row++;
        for (int j = 0; j < events.size(); j++) {
            StudyEventBean event = (StudyEventBean) events.get(j);
            if (event.getStartTimeFlag()) {
                excelRow = new String[] { event.getStudyEventDefinition().getName(), event.getLocation(), dateTimeFormat(event.getDateStarted()), Integer.toString(event.getSampleOrdinal()) };
            } else {
                excelRow = new String[] { event.getStudyEventDefinition().getName(), event.getLocation(), dateFormat(event.getDateStarted()), Integer.toString(event.getSampleOrdinal()) };
            }
            for (int i = 0; i < excelRow.length; i++) {
                Label label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
                excelSheet.addCell(label);
            }
            row++;
        }
        autoSizeColumns(excelSheet);
        int sheet = 0;
        // Study Event Summary Looper
        for (int eventCount = 0; eventCount < events.size(); eventCount++) {
            row = 0;
            sheet++;
            StudyEventBean event = (StudyEventBean) events.get(eventCount);
            workbook.createSheet(event.getStudyEventDefinition().getName().replace("/", ".") + "_" + event.getSampleOrdinal(), sheet);
            excelSheet = workbook.getSheet(sheet);
            Label label = null;
            // Header
            label = new Label(0, row, ResourceBundleProvider.getResWord("name"), cellFormat);
            excelSheet.addCell(label);
            label = new Label(1, row, event.getStudyEventDefinition().getName(), cellFormat);
            excelSheet.addCell(label);
            row++;
            label = new Label(0, row, "Location");
            excelSheet.addCell(label);
            label = new Label(1, row, event.getLocation());
            excelSheet.addCell(label);
            row++;
            label = new Label(0, row, "Start Date");
            excelSheet.addCell(label);
            if (event.getStartTimeFlag()) {
                label = new Label(1, row, dateTimeFormat(event.getDateStarted()));
            } else {
                label = new Label(1, row, dateFormat(event.getDateStarted()));
            }
            excelSheet.addCell(label);
            row++;
            label = new Label(0, row, "Status");
            excelSheet.addCell(label);
            label = new Label(1, row, event.getSubjectEventStatus().getName());
            excelSheet.addCell(label);
            row++;
            label = new Label(0, row, ResourceBundleProvider.getResWord("occurrence_number"));
            excelSheet.addCell(label);
            label = new Label(1, row, Integer.toString(event.getSampleOrdinal()));
            excelSheet.addCell(label);
            row++;
            row++;
            // End Header
            // Audit for Deleted Event CRFs
            excelRow = new String[] { "name", "version", "deleted_by", "delete_date" };
            for (int i = 0; i < excelRow.length; i++) {
                label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
                excelSheet.addCell(label);
            }
            row++;
            for (int j = 0; j < allDeletedEventCRFs.size(); j++) {
                DeletedEventCRFBean deletedEventCRF = (DeletedEventCRFBean) allDeletedEventCRFs.get(j);
                if (deletedEventCRF.getStudyEventId() == event.getId()) {
                    excelRow = new String[] { deletedEventCRF.getCrfName(), deletedEventCRF.getCrfVersion(), deletedEventCRF.getDeletedBy(), dateFormat(deletedEventCRF.getDeletedDate()) };
                    for (int i = 0; i < excelRow.length; i++) {
                        label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
                        excelSheet.addCell(label);
                    }
                    row++;
                }
            }
            row++;
            row++;
            // Audit Events for Study Event
            excelRow = new String[] { "audit_event", "date_time_of_server", "user", "value_type", "old", "new" };
            for (int i = 0; i < excelRow.length; i++) {
                label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
                excelSheet.addCell(label);
            }
            row++;
            for (int j = 0; j < studyEventAudits.size(); j++) {
                AuditBean studyEvent = (AuditBean) studyEventAudits.get(j);
                if (studyEvent.getEntityId() == event.getId()) {
                    String getOld = studyEvent.getOldValue();
                    String oldValue = "";
                    if (getOld.equals("0"))
                        oldValue = "invalid";
                    else if (getOld.equals("1"))
                        oldValue = "scheduled";
                    else if (getOld.equals("2"))
                        oldValue = "not_scheduled";
                    else if (getOld.equals("3"))
                        oldValue = "data_entry_started";
                    else if (getOld.equals("4"))
                        oldValue = "completed";
                    else if (getOld.equals("5"))
                        oldValue = "stopped";
                    else if (getOld.equals("6"))
                        oldValue = "skipped";
                    else if (getOld.equals("7"))
                        oldValue = "locked";
                    else if (getOld.equals("8"))
                        oldValue = "signed";
                    else
                        oldValue = studyEvent.getOldValue();
                    String getNew = studyEvent.getNewValue();
                    String newValue = "";
                    if (getNew.equals("0"))
                        newValue = "invalid";
                    else if (getNew.equals("1"))
                        newValue = "scheduled";
                    else if (getNew.equals("2"))
                        newValue = "not_scheduled";
                    else if (getNew.equals("3"))
                        newValue = "data_entry_started";
                    else if (getNew.equals("4"))
                        newValue = "completed";
                    else if (getNew.equals("5"))
                        newValue = "removed";
                    else if (getNew.equals("6"))
                        newValue = "skipped";
                    else if (getNew.equals("7"))
                        newValue = "locked";
                    else if (getNew.equals("8"))
                        newValue = "signed";
                    else if (getNew.equals("9"))
                        newValue = "forzen";
                    else
                        newValue = studyEvent.getNewValue();
                    excelRow = new String[] { studyEvent.getAuditEventTypeName(), dateTimeFormat(studyEvent.getAuditDate()), studyEvent.getUserName(), studyEvent.getEntityName() + "(" + studyEvent.getOrdinal() + ")", oldValue, newValue };
                    for (int i = 0; i < excelRow.length; i++) {
                        label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
                        excelSheet.addCell(label);
                    }
                    row++;
                }
            }
            row++;
            row++;
            // Event CRFs Audit Events
            for (int j = 0; j < allEventCRFs.size(); j++) {
                AuditBean auditBean = (AuditBean) allEventCRFs.get(j);
                if (auditBean.getStudyEventId() == event.getId()) {
                    // Audit Events for Study Event
                    excelRow = new String[] { "name", "version", "date_interviewed", "interviewer_name", "owner" };
                    for (int i = 0; i < excelRow.length; i++) {
                        label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
                        excelSheet.addCell(label);
                    }
                    row++;
                    excelRow = new String[] { auditBean.getCrfName(), auditBean.getCrfVersionName(), dateFormat(auditBean.getDateInterviewed()), auditBean.getInterviewerName(), auditBean.getUserName() };
                    for (int i = 0; i < excelRow.length; i++) {
                        label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
                        excelSheet.addCell(label);
                    }
                    row++;
                    row++;
                    excelRow = new String[] { "audit_event", "date_time_of_server", "user", "value_type", "old", "new" };
                    for (int i = 0; i < excelRow.length; i++) {
                        label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
                        excelSheet.addCell(label);
                    }
                    row++;
                    row++;
                    for (int k = 0; k < allEventCRFItems.size(); k++) {
                        row--;
                        AuditBean eventCrfAudit = (AuditBean) allEventCRFItems.get(k);
                        if (eventCrfAudit.getStudyEventId() == event.getId() && eventCrfAudit.getEventCrfVersionId() == auditBean.getEventCrfVersionId()) {
                            String oldValue = "";
                            String newValue = "";
                            if (eventCrfAudit.getAuditEventTypeId() == 12 || eventCrfAudit.getEntityName().equals("Status")) {
                                String getOld = eventCrfAudit.getOldValue();
                                if (getOld.equals("0"))
                                    oldValue = "invalid";
                                else if (getOld.equals("1"))
                                    oldValue = "available";
                                else if (getOld.equals("2"))
                                    oldValue = "unavailable";
                                else if (getOld.equals("3"))
                                    oldValue = "private";
                                else if (getOld.equals("4"))
                                    oldValue = "pending";
                                else if (getOld.equals("5"))
                                    oldValue = "removed";
                                else if (getOld.equals("6"))
                                    oldValue = "locked";
                                else if (getOld.equals("7"))
                                    oldValue = "auto-removed";
                                else {
                                    oldValue = getOld;
                                }
                            } else if (eventCrfAudit.getAuditEventTypeId() == 32) {
                                String getOld = eventCrfAudit.getOldValue();
                                if (getOld.equals("0"))
                                    oldValue = "FALSE";
                                else if (getOld.equals("1"))
                                    oldValue = "TRUE";
                                else {
                                    oldValue = getOld;
                                }
                            } else {
                                oldValue = eventCrfAudit.getOldValue();
                            }
                            if (eventCrfAudit.getAuditEventTypeId() == 12 || eventCrfAudit.getEntityName().equals("Status")) {
                                String getNew = eventCrfAudit.getNewValue();
                                if (getNew.equals("0"))
                                    newValue = "invalid";
                                else if (getNew.equals("1"))
                                    newValue = "available";
                                else if (getNew.equals("2"))
                                    newValue = "unavailable";
                                else if (getNew.equals("3"))
                                    newValue = "private";
                                else if (getNew.equals("4"))
                                    newValue = "pending";
                                else if (getNew.equals("5"))
                                    newValue = "removed";
                                else if (getNew.equals("6"))
                                    newValue = "locked";
                                else if (getNew.equals("7"))
                                    newValue = "auto-removed";
                                else {
                                    newValue = getNew;
                                }
                            } else if (eventCrfAudit.getAuditEventTypeId() == 32) {
                                String getNew = eventCrfAudit.getNewValue();
                                if (getNew.equals("0"))
                                    newValue = "FALSE";
                                else if (getNew.equals("1"))
                                    newValue = "TRUE";
                                else {
                                    newValue = getNew;
                                }
                            } else {
                                newValue = eventCrfAudit.getNewValue();
                            }
                            String ordinal = "";
                            if (eventCrfAudit.getOrdinal() != 0) {
                                ordinal = "(" + eventCrfAudit.getOrdinal() + ")";
                            } else if (eventCrfAudit.getOrdinal() == 0 && eventCrfAudit.getItemDataRepeatKey() != 0) {
                                ordinal = "(" + eventCrfAudit.getItemDataRepeatKey() + ")";
                            }
                            excelRow = new String[] { eventCrfAudit.getAuditEventTypeName(), dateTimeFormat(eventCrfAudit.getAuditDate()), eventCrfAudit.getUserName(), eventCrfAudit.getEntityName() + ordinal, oldValue, newValue };
                            for (int i = 0; i < excelRow.length; i++) {
                                label = new Label(i, row, ResourceBundleProvider.getResWord(excelRow[i]), cellFormat);
                                excelSheet.addCell(label);
                            }
                            row++;
                            row++;
                        }
                        row++;
                    }
                    row++;
                }
                autoSizeColumns(excelSheet);
            }
        }
        workbook.write();
        workbook.close();
        session.setAttribute("subject", null);
        session.setAttribute("study", null);
        session.setAttribute("studySub", null);
        session.setAttribute("studyEventAudits", null);
        session.setAttribute("studySubjectAudits", null);
        session.setAttribute("events", null);
        session.setAttribute("eventCRFAudits", null);
        session.setAttribute("allDeletedEventCRFs", null);
    } catch (Exception e) {
        throw e;
    } finally {
    // proposed move session attributes here
    }
}
Also used : Locale(java.util.Locale) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) SubjectDAO(org.akaza.openclinica.dao.submit.SubjectDAO) DeletedEventCRFBean(org.akaza.openclinica.bean.admin.DeletedEventCRFBean) ArrayList(java.util.ArrayList) Label(jxl.write.Label) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) ItemDataDAO(org.akaza.openclinica.dao.submit.ItemDataDAO) AuditDAO(org.akaza.openclinica.dao.admin.AuditDAO) DeletedEventCRFBean(org.akaza.openclinica.bean.admin.DeletedEventCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) Iterator(java.util.Iterator) 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) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) WritableFont(jxl.write.WritableFont) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) WorkbookSettings(jxl.WorkbookSettings) WritableSheet(jxl.write.WritableSheet) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) AuditBean(org.akaza.openclinica.bean.admin.AuditBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) WritableCellFormat(jxl.write.WritableCellFormat) InsufficientPermissionException(org.akaza.openclinica.web.InsufficientPermissionException) WritableWorkbook(jxl.write.WritableWorkbook) SubjectBean(org.akaza.openclinica.bean.submit.SubjectBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) Collection(java.util.Collection)

Example 3 with AuditDAO

use of org.akaza.openclinica.dao.admin.AuditDAO in project OpenClinica by OpenClinica.

the class ViewStudySubjectAuditLogServlet method processRequest.

@Override
public void processRequest() throws Exception {
    StudySubjectDAO subdao = new StudySubjectDAO(sm.getDataSource());
    SubjectDAO sdao = new SubjectDAO(sm.getDataSource());
    AuditDAO adao = new AuditDAO(sm.getDataSource());
    FormProcessor fp = new FormProcessor(request);
    StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
    StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
    EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(sm.getDataSource());
    EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
    StudyDAO studydao = new StudyDAO(sm.getDataSource());
    CRFDAO cdao = new CRFDAO(sm.getDataSource());
    CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
    ArrayList studySubjectAudits = new ArrayList();
    ArrayList eventCRFAudits = new ArrayList();
    ArrayList studyEventAudits = new ArrayList();
    ArrayList allDeletedEventCRFs = new ArrayList();
    String attachedFilePath = Utils.getAttachedFilePath(currentStudy);
    // studySubjectId
    int studySubId = fp.getInt("id", true);
    request.setAttribute("id", studySubId);
    if (studySubId == 0) {
        addPageMessage(respage.getString("please_choose_a_subject_to_view"));
        forwardPage(Page.LIST_STUDY_SUBJECTS);
    } else {
        StudySubjectBean studySubject = (StudySubjectBean) subdao.findByPK(studySubId);
        StudyBean study = (StudyBean) studydao.findByPK(studySubject.getStudyId());
        // Check if this StudySubject would be accessed from the Current Study
        if (studySubject.getStudyId() != currentStudy.getId()) {
            if (currentStudy.getParentStudyId() > 0) {
                addPageMessage(respage.getString("no_have_correct_privilege_current_study") + " " + respage.getString("change_active_study_or_contact"));
                forwardPage(Page.MENU_SERVLET);
                return;
            } else {
                // The SubjectStudy is not belong to currentstudy and current study is not a site.
                Collection sites = studydao.findOlnySiteIdsByStudy(currentStudy);
                if (!sites.contains(study.getId())) {
                    addPageMessage(respage.getString("no_have_correct_privilege_current_study") + " " + respage.getString("change_active_study_or_contact"));
                    forwardPage(Page.MENU_SERVLET);
                    return;
                }
            }
        }
        request.setAttribute("studySub", studySubject);
        SubjectBean subject = (SubjectBean) sdao.findByPK(studySubject.getSubjectId());
        StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource());
        study.getStudyParameterConfig().setCollectDob(spvdao.findByHandleAndStudy(study.getId(), "collectDob").getValue());
        String collectdob = "used";
        if (study.getStudyParameterConfig().getCollectDob().equals("2")) {
            collectdob = "yearOnly";
        } else if (study.getStudyParameterConfig().getCollectDob().equals("3")) {
            collectdob = "notUsed";
        } else if (study.getStudyParameterConfig().getCollectDob().equals("1")) {
            collectdob = "used";
        }
        request.setAttribute("collectdob", collectdob);
        request.setAttribute("subject", subject);
        request.setAttribute("study", study);
        /* Show both study subject and subject audit events together */
        // Study subject value changed
        Collection studySubjectAuditEvents = adao.findStudySubjectAuditEvents(studySubject.getId());
        // integer values.
        for (Iterator iterator = studySubjectAuditEvents.iterator(); iterator.hasNext(); ) {
            AuditBean auditBean = (AuditBean) iterator.next();
            if (auditBean.getAuditEventTypeId() == 3) {
                auditBean.setOldValue(Status.get(Integer.parseInt(auditBean.getOldValue())).getName());
                auditBean.setNewValue(Status.get(Integer.parseInt(auditBean.getNewValue())).getName());
            }
        }
        studySubjectAudits.addAll(studySubjectAuditEvents);
        // Global subject value changed
        studySubjectAudits.addAll(adao.findSubjectAuditEvents(subject.getId()));
        studySubjectAudits.addAll(adao.findStudySubjectGroupAssignmentAuditEvents(studySubject.getId()));
        request.setAttribute("studySubjectAudits", studySubjectAudits);
        // Get the list of events
        ArrayList events = sedao.findAllByStudySubject(studySubject);
        for (int i = 0; i < events.size(); i++) {
            // Link study event definitions
            StudyEventBean studyEvent = (StudyEventBean) events.get(i);
            studyEvent.setStudyEventDefinition((StudyEventDefinitionBean) seddao.findByPK(studyEvent.getStudyEventDefinitionId()));
            // Link event CRFs
            studyEvent.setEventCRFs(ecdao.findAllByStudyEvent(studyEvent));
            // Find deleted Event CRFs
            List deletedEventCRFs = adao.findDeletedEventCRFsFromAuditEventByEventCRFStatus(studyEvent.getId());
            allDeletedEventCRFs.addAll(deletedEventCRFs);
            logger.info("deletedEventCRFs size[" + deletedEventCRFs.size() + "]");
        }
        for (int i = 0; i < events.size(); i++) {
            StudyEventBean studyEvent = (StudyEventBean) events.get(i);
            studyEventAudits.addAll(adao.findStudyEventAuditEvents(studyEvent.getId()));
            ArrayList eventCRFs = studyEvent.getEventCRFs();
            for (int j = 0; j < eventCRFs.size(); j++) {
                // Link CRF and CRF Versions
                EventCRFBean eventCRF = (EventCRFBean) eventCRFs.get(j);
                eventCRF.setCrfVersion((CRFVersionBean) cvdao.findByPK(eventCRF.getCRFVersionId()));
                eventCRF.setCrf(cdao.findByVersionId(eventCRF.getCRFVersionId()));
                // Get the event crf audits
                eventCRFAudits.addAll(adao.findEventCRFAuditEventsWithItemDataType(eventCRF.getId()));
                logger.info("eventCRFAudits size [" + eventCRFAudits.size() + "] eventCRF id [" + eventCRF.getId() + "]");
            }
        }
        ItemDataDAO itemDataDao = new ItemDataDAO(sm.getDataSource());
        for (Object o : eventCRFAudits) {
            AuditBean ab = (AuditBean) o;
            if (ab.getAuditTable().equalsIgnoreCase("item_data")) {
                ItemDataBean idBean = (ItemDataBean) itemDataDao.findByPK(ab.getEntityId());
                ab.setOrdinal(idBean.getOrdinal());
            }
        }
        request.setAttribute("events", events);
        request.setAttribute("eventCRFAudits", eventCRFAudits);
        request.setAttribute("studyEventAudits", studyEventAudits);
        request.setAttribute("allDeletedEventCRFs", allDeletedEventCRFs);
        request.setAttribute("attachedFilePath", attachedFilePath);
        forwardPage(Page.VIEW_STUDY_SUBJECT_AUDIT);
    }
}
Also used : StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) SubjectDAO(org.akaza.openclinica.dao.submit.SubjectDAO) ArrayList(java.util.ArrayList) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) ItemDataDAO(org.akaza.openclinica.dao.submit.ItemDataDAO) AuditDAO(org.akaza.openclinica.dao.admin.AuditDAO) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) Iterator(java.util.Iterator) 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) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) AuditBean(org.akaza.openclinica.bean.admin.AuditBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) SubjectBean(org.akaza.openclinica.bean.submit.SubjectBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) Collection(java.util.Collection) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO)

Example 4 with AuditDAO

use of org.akaza.openclinica.dao.admin.AuditDAO in project OpenClinica by OpenClinica.

the class ViewDiscrepancyNoteServlet method processRequest.

@Override
@SuppressWarnings("unchecked")
protected void processRequest() throws Exception {
    FormProcessor fp = new FormProcessor(request);
    int eventCRFId = fp.getInt(CreateDiscrepancyNoteServlet.EVENT_CRF_ID);
    request.setAttribute(CreateDiscrepancyNoteServlet.EVENT_CRF_ID, new Integer(eventCRFId));
    request.setAttribute(DIS_TYPES, DiscrepancyNoteType.list);
    if (currentRole.getRole().equals(Role.RESEARCHASSISTANT) || currentRole.getRole().equals(Role.RESEARCHASSISTANT2) || currentRole.getRole().equals(Role.INVESTIGATOR)) {
        ArrayList<ResolutionStatus> resStatuses = new ArrayList();
        resStatuses.add(ResolutionStatus.UPDATED);
        resStatuses.add(ResolutionStatus.RESOLVED);
        request.setAttribute(RES_STATUSES, resStatuses);
        // it's for parentDNId is null or 0
        request.setAttribute(WHICH_RES_STATUSES, "22");
        ArrayList<ResolutionStatus> resStatuses2 = new ArrayList<ResolutionStatus>();
        resStatuses2.add(ResolutionStatus.OPEN);
        resStatuses2.add(ResolutionStatus.RESOLVED);
        request.setAttribute(RES_STATUSES2, resStatuses2);
        List<DiscrepancyNoteType> types2 = new ArrayList<DiscrepancyNoteType>(DiscrepancyNoteType.list);
        types2.remove(DiscrepancyNoteType.QUERY);
        request.setAttribute(DIS_TYPES2, types2);
    } else if (currentRole.getRole().equals(Role.MONITOR)) {
        ArrayList<ResolutionStatus> resStatuses = new ArrayList();
        resStatuses.add(ResolutionStatus.OPEN);
        resStatuses.add(ResolutionStatus.UPDATED);
        resStatuses.add(ResolutionStatus.CLOSED);
        request.setAttribute(RES_STATUSES, resStatuses);
        request.setAttribute(WHICH_RES_STATUSES, "1");
        ArrayList<DiscrepancyNoteType> types2 = new ArrayList<DiscrepancyNoteType>();
        types2.add(DiscrepancyNoteType.QUERY);
        request.setAttribute(DIS_TYPES2, types2);
    } else {
        // Role.STUDYDIRECTOR Role.COORDINATOR
        List<ResolutionStatus> resStatuses = new ArrayList<ResolutionStatus>(ResolutionStatus.list);
        resStatuses.remove(ResolutionStatus.NOT_APPLICABLE);
        request.setAttribute(RES_STATUSES, resStatuses);
        ;
        // it's for parentDNId is null or 0 and FVC
        request.setAttribute(WHICH_RES_STATUSES, "2");
        ArrayList<ResolutionStatus> resStatuses2 = new ArrayList<ResolutionStatus>();
        resStatuses2.add(ResolutionStatus.OPEN);
        resStatuses2.add(ResolutionStatus.RESOLVED);
        request.setAttribute(RES_STATUSES2, resStatuses2);
    }
    // logic from CreateDiscrepancyNoteServlet
    request.setAttribute("unlock", "0");
    fp.getBoolean(IS_REASON_FOR_CHANGE);
    fp.getBoolean(ERROR_FLAG);
    String monitor = fp.getString("monitor");
    // } else if ("1".equalsIgnoreCase(monitor)) {// change to allow user to
    if ("1".equalsIgnoreCase(monitor)) {
        // change to allow user to
        // enter note for all items,
        // not just blank items
        request.setAttribute(CAN_MONITOR, "1");
        request.setAttribute("monitor", monitor);
    } else {
        request.setAttribute(CAN_MONITOR, "0");
    }
    Boolean fromBox = fp.getBoolean(FROM_BOX);
    if (fromBox == null || !fromBox) {
        session.removeAttribute(BOX_TO_SHOW);
        session.removeAttribute(BOX_DN_MAP);
        session.removeAttribute(AUTOVIEWS);
    }
    Boolean refresh = fp.getBoolean("refresh");
    request.setAttribute("refresh", refresh + "");
    String ypos = fp.getString("y");
    if (ypos == null || ypos.length() == 0) {
        ypos = "0";
    }
    request.setAttribute("y", ypos);
    DiscrepancyNoteDAO dndao = new DiscrepancyNoteDAO(sm.getDataSource());
    int entityId = fp.getInt(ENTITY_ID, true);
    String name = fp.getString(ENTITY_TYPE, true);
    String column = fp.getString(ENTITY_COLUMN, true);
    String field = fp.getString(ENTITY_FIELD, true);
    String isLocked = fp.getString(LOCKED_FLAG);
    if (!StringUtil.isBlank(isLocked) && "yes".equalsIgnoreCase(isLocked)) {
        request.setAttribute(LOCKED_FLAG, "yes");
    } else {
        request.setAttribute(LOCKED_FLAG, "no");
    }
    DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT, locale);
    int subjectId = fp.getInt(CreateDiscrepancyNoteServlet.SUBJECT_ID, true);
    int itemId = fp.getInt(CreateDiscrepancyNoteServlet.ITEM_ID, true);
    StudySubjectBean ssub = new StudySubjectBean();
    if (subjectId > 0) {
        StudySubjectDAO ssdao = new StudySubjectDAO(sm.getDataSource());
        ssub = (StudySubjectBean) ssdao.findByPK(subjectId);
        request.setAttribute("noteSubject", ssub);
    }
    ItemBean item = new ItemBean();
    if (itemId > 0) {
        ItemDAO idao = new ItemDAO(sm.getDataSource());
        item = (ItemBean) idao.findByPK(itemId);
        request.setAttribute("item", item);
        request.setAttribute("entityName", item.getName());
    }
    ItemDataBean itemData = new ItemDataBean();
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
    int preUserId = 0;
    if (!StringUtil.isBlank(name)) {
        if ("itemData".equalsIgnoreCase(name)) {
            ItemDataDAO iddao = new ItemDataDAO(sm.getDataSource());
            itemData = (ItemDataBean) iddao.findByPK(entityId);
            request.setAttribute("entityValue", itemData.getValue());
            request.setAttribute("entityName", item.getName());
            EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
            EventCRFBean ec = (EventCRFBean) ecdao.findByPK(itemData.getEventCRFId());
            preUserId = ec.getOwnerId() > 0 ? ec.getOwnerId() : 0;
            request.setAttribute("entityCreatedDate", sdf.format(ec.getCreatedDate()));
            StudyEventDAO sed = new StudyEventDAO(sm.getDataSource());
            StudyEventBean se = (StudyEventBean) sed.findByPK(ec.getStudyEventId());
            StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
            StudyEventDefinitionBean sedb = (StudyEventDefinitionBean) seddao.findByPK(se.getStudyEventDefinitionId());
            se.setName(sedb.getName());
            request.setAttribute("studyEvent", se);
            CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
            CRFVersionBean cv = (CRFVersionBean) cvdao.findByPK(ec.getCRFVersionId());
            CRFDAO cdao = new CRFDAO(sm.getDataSource());
            CRFBean crf = (CRFBean) cdao.findByPK(cv.getCrfId());
            request.setAttribute("crf", crf);
        } else if ("studySub".equalsIgnoreCase(name)) {
            StudySubjectDAO ssdao = new StudySubjectDAO(sm.getDataSource());
            ssub = (StudySubjectBean) ssdao.findByPK(entityId);
            SubjectDAO sdao = new SubjectDAO(sm.getDataSource());
            SubjectBean sub = (SubjectBean) sdao.findByPK(ssub.getSubjectId());
            request.setAttribute("noteSubject", ssub);
            if (!StringUtil.isBlank(column)) {
                if ("enrollment_date".equalsIgnoreCase(column)) {
                    if (ssub.getEnrollmentDate() != null) {
                        request.setAttribute("entityValue", dateFormatter.format(ssub.getEnrollmentDate()));
                    }
                    request.setAttribute("entityName", resword.getString("enrollment_date"));
                } else if ("gender".equalsIgnoreCase(column)) {
                    request.setAttribute("entityValue", sub.getGender() + "");
                    request.setAttribute("entityName", resword.getString("gender"));
                } else if ("date_of_birth".equalsIgnoreCase(column)) {
                    if (sub.getDateOfBirth() != null) {
                        request.setAttribute("entityValue", dateFormatter.format(sub.getDateOfBirth()));
                    }
                    request.setAttribute("entityName", resword.getString("date_of_birth"));
                } else if ("unique_identifier".equalsIgnoreCase(column)) {
                    if (sub.getUniqueIdentifier() != null) {
                        request.setAttribute("entityValue", sub.getUniqueIdentifier());
                    }
                    request.setAttribute("entityName", resword.getString("unique_identifier"));
                }
            }
            preUserId = ssub.getOwnerId() > 0 ? ssub.getOwnerId() : 0;
            request.setAttribute("entityCreatedDate", sdf.format(ssub.getCreatedDate()));
        } else if ("subject".equalsIgnoreCase(name)) {
            SubjectDAO sdao = new SubjectDAO(sm.getDataSource());
            SubjectBean sub = (SubjectBean) sdao.findByPK(entityId);
            // be caution: here for subject, noteSubject is SubjectBean and
            // label is unique_identifier
            sub.setLabel(sub.getUniqueIdentifier());
            request.setAttribute("noteSubject", sub);
            if (!StringUtil.isBlank(column)) {
                if ("gender".equalsIgnoreCase(column)) {
                    request.setAttribute("entityValue", ssub.getGender() + "");
                    request.setAttribute("entityName", resword.getString("gender"));
                } else if ("date_of_birth".equalsIgnoreCase(column)) {
                    if (sub.getDateOfBirth() != null) {
                        request.setAttribute("entityValue", dateFormatter.format(sub.getDateOfBirth()));
                    }
                    request.setAttribute("entityName", resword.getString("date_of_birth"));
                } else if ("unique_identifier".equalsIgnoreCase(column)) {
                    request.setAttribute("entityValue", sub.getUniqueIdentifier());
                    request.setAttribute("entityName", resword.getString("unique_identifier"));
                }
            }
            preUserId = sub.getOwnerId() > 0 ? sub.getOwnerId() : 0;
            request.setAttribute("entityCreatedDate", sdf.format(sub.getCreatedDate()));
        } else if ("studyEvent".equalsIgnoreCase(name)) {
            StudyEventDAO sed = new StudyEventDAO(sm.getDataSource());
            StudyEventBean se = (StudyEventBean) sed.findByPK(entityId);
            StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
            StudyEventDefinitionBean sedb = (StudyEventDefinitionBean) seddao.findByPK(se.getStudyEventDefinitionId());
            se.setName(sedb.getName());
            request.setAttribute("studyEvent", se);
            request.setAttribute("noteSubject", new StudySubjectDAO(sm.getDataSource()).findByPK(se.getStudySubjectId()));
            if (!StringUtil.isBlank(column)) {
                if ("location".equalsIgnoreCase(column)) {
                    request.setAttribute("entityValue", se.getLocation());
                    request.setAttribute("entityName", resword.getString("location"));
                } else if ("start_date".equalsIgnoreCase(column)) {
                    if (se.getDateStarted() != null) {
                        request.setAttribute("entityValue", dateFormatter.format(se.getDateStarted()));
                    }
                    request.setAttribute("entityName", resword.getString("start_date"));
                } else if ("end_date".equalsIgnoreCase(column)) {
                    if (se.getDateEnded() != null) {
                        request.setAttribute("entityValue", dateFormatter.format(se.getDateEnded()));
                    }
                    request.setAttribute("entityName", resword.getString("end_date"));
                }
            }
            preUserId = se.getOwnerId() > 0 ? se.getOwnerId() : 0;
            request.setAttribute("entityCreatedDate", sdf.format(se.getCreatedDate()));
        } else if ("eventCrf".equalsIgnoreCase(name)) {
            EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
            EventCRFBean ec = (EventCRFBean) ecdao.findByPK(entityId);
            if (!StringUtil.isBlank(column)) {
                if ("date_interviewed".equals(column)) {
                    if (ec.getDateInterviewed() != null) {
                        request.setAttribute("entityValue", dateFormatter.format(ec.getDateInterviewed()));
                    }
                    request.setAttribute("entityName", resword.getString("date_interviewed"));
                } else if ("interviewer_name".equals(column)) {
                    request.setAttribute("entityValue", ec.getInterviewerName());
                    request.setAttribute("entityName", resword.getString("interviewer_name"));
                }
            }
            setupStudyEventCRFAttributes(ec);
            preUserId = ec.getOwnerId() > 0 ? ec.getOwnerId() : 0;
            request.setAttribute("entityCreatedDate", sdf.format(ec.getCreatedDate()));
        }
    }
    boolean writeToDB = fp.getBoolean(CreateDiscrepancyNoteServlet.WRITE_TO_DB, true);
    HashMap<Integer, Integer> autoviews = (HashMap<Integer, Integer>) session.getAttribute(AUTOVIEWS);
    autoviews = autoviews == null ? new HashMap<Integer, Integer>() : autoviews;
    HashMap<Integer, DiscrepancyNoteBean> boxDNMap = (HashMap<Integer, DiscrepancyNoteBean>) session.getAttribute(BOX_DN_MAP);
    if (boxDNMap == null || !boxDNMap.containsKey(0)) {
        boxDNMap = new HashMap<Integer, DiscrepancyNoteBean>();
        // initialize dn for a new thread
        DiscrepancyNoteBean dnb = new DiscrepancyNoteBean();
        if (currentRole.getRole().equals(Role.RESEARCHASSISTANT) || currentRole.getRole().equals(Role.RESEARCHASSISTANT2) || currentRole.getRole().equals(Role.INVESTIGATOR)) {
            dnb.setDiscrepancyNoteTypeId(DiscrepancyNoteType.ANNOTATION.getId());
            dnb.setResolutionStatusId(ResolutionStatus.NOT_APPLICABLE.getId());
            autoviews.put(0, 0);
        // request.setAttribute("autoView", "0");
        } else {
            dnb.setDiscrepancyNoteTypeId(DiscrepancyNoteType.QUERY.getId());
            dnb.setAssignedUserId(preUserId);
            autoviews.put(0, 1);
        // request.setAttribute("autoView", "1");
        }
        boxDNMap.put(0, dnb);
    } else if (boxDNMap.containsKey(0)) {
        int dnTypeId = boxDNMap.get(0).getDiscrepancyNoteTypeId();
        autoviews.put(0, dnTypeId == 3 ? 1 : 0);
    }
    if (boxDNMap.containsKey(0)) {
        int dnTypeId0 = boxDNMap.get(0).getDiscrepancyNoteTypeId();
        if (dnTypeId0 == 2 || dnTypeId0 == 4) {
            request.setAttribute("typeID0", dnTypeId0 + "");
        }
    }
    // request.setAttribute("enterData", enterData);
    request.setAttribute("monitor", monitor);
    request.setAttribute(ENTITY_ID, entityId + "");
    request.setAttribute(ENTITY_TYPE, name);
    request.setAttribute(ENTITY_FIELD, field);
    request.setAttribute(ENTITY_COLUMN, column);
    request.setAttribute(CreateDiscrepancyNoteServlet.WRITE_TO_DB, writeToDB ? "1" : "0");
    ArrayList notes = (ArrayList) dndao.findAllByEntityAndColumn(name, entityId, column);
    if (notes.size() > 0) {
        notes.get(0);
        // @pgawade 21-May-2011 Corrected the condition to throw no access
        // error
        StudyDAO studyDAO = new StudyDAO(sm.getDataSource());
        int parentStudyForNoteSub = 0;
        // @pgawade #9801: 07-June-2011 corrected the way to get study
        // subject id associated with discrepancy note
        // int noteSubId = note.getOwnerId();
        StudySubjectDAO ssdao = new StudySubjectDAO(sm.getDataSource());
        // StudySubjectBean notessub = (StudySubjectBean)
        // ssdao.findByPK(noteSubId);
        StudySubjectBean notessub = (StudySubjectBean) ssdao.findByPK(subjectId);
        StudyBean studyBeanSub = (StudyBean) studyDAO.findByPK(notessub.getStudyId());
        if (null != studyBeanSub) {
            parentStudyForNoteSub = studyBeanSub.getParentStudyId();
        }
        if (notessub.getStudyId() != currentStudy.getId() && currentStudy.getId() != parentStudyForNoteSub) {
            addPageMessage(noAccessMessage);
            throw new InsufficientPermissionException(Page.MENU_SERVLET, exceptionName, "1");
        }
    }
    FormDiscrepancyNotes newNotes = (FormDiscrepancyNotes) session.getAttribute(AddNewSubjectServlet.FORM_DISCREPANCY_NOTES_NAME);
    Map<Integer, DiscrepancyNoteBean> noteTree = new LinkedHashMap<Integer, DiscrepancyNoteBean>();
    String session_key = eventCRFId + "_" + field;
    ArrayList newFieldNotes = null;
    if (newNotes != null && (!newNotes.getNotes(field).isEmpty() || !newNotes.getNotes(session_key).isEmpty())) {
        newFieldNotes = newNotes.getNotes(field);
        if (newFieldNotes == null || newFieldNotes.size() == 0) {
            newFieldNotes = newNotes.getNotes(session_key);
        }
        // System.out.println("how many notes:" + newFieldNotes.size());
        for (int i = 0; i < newFieldNotes.size(); i++) {
            DiscrepancyNoteBean note = (DiscrepancyNoteBean) newFieldNotes.get(i);
            note.setLastUpdator(ub);
            note.setLastDateUpdated(new Date());
            note.setDisType(DiscrepancyNoteType.get(note.getDiscrepancyNoteTypeId()));
            note.setResStatus(ResolutionStatus.get(note.getResolutionStatusId()));
            note.setSaved(false);
            if (itemId > 0) {
                note.setEntityName(item.getName());
                note.setEntityValue(itemData.getValue());
            }
            note.setSubjectName(ssub.getName());
            note.setEntityType(name);
            int pId = note.getParentDnId();
            if (pId == 0) {
                // we can only keep one unsaved note because
                // note.id == 0
                noteTree.put(note.getId(), note);
            }
        }
        for (int i = 0; i < newFieldNotes.size(); i++) {
            DiscrepancyNoteBean note = (DiscrepancyNoteBean) newFieldNotes.get(i);
            int pId = note.getParentDnId();
            if (pId > 0) {
                note.setSaved(false);
                note.setLastUpdator(ub);
                note.setLastDateUpdated(new Date());
                note.setEntityName(item.getName());
                note.setSubjectName(ssub.getName());
                note.setEntityType(name);
                note.setDisType(DiscrepancyNoteType.get(note.getDiscrepancyNoteTypeId()));
                note.setResStatus(ResolutionStatus.get(note.getResolutionStatusId()));
                DiscrepancyNoteBean parent = noteTree.get(new Integer(pId));
                if (parent != null) {
                    parent.getChildren().add(note);
                }
            }
        }
    }
    UserAccountDAO udao = new UserAccountDAO(sm.getDataSource());
    HashMap<Integer, String> fvcInitAssigns = new HashMap<Integer, String>();
    for (int i = 0; i < notes.size(); i++) {
        DiscrepancyNoteBean note = (DiscrepancyNoteBean) notes.get(i);
        note.setColumn(column);
        note.setEntityId(entityId);
        note.setEntityType(name);
        note.setField(field);
        Date lastUpdatedDate = note.getCreatedDate();
        UserAccountBean lastUpdator = (UserAccountBean) udao.findByPK(note.getOwnerId());
        note.setLastUpdator(lastUpdator);
        note.setLastDateUpdated(lastUpdatedDate);
        int pId = note.getParentDnId();
        note.setDisType(DiscrepancyNoteType.get(note.getDiscrepancyNoteTypeId()));
        note.setResStatus(ResolutionStatus.get(note.getResolutionStatusId()));
        if (pId == 0) {
            noteTree.put(new Integer(note.getId()), note);
        }
    }
    for (int i = 0; i < notes.size(); i++) {
        DiscrepancyNoteBean note = (DiscrepancyNoteBean) notes.get(i);
        int pId = note.getParentDnId();
        if (itemId > 0) {
            note.setEntityName(item.getName());
            note.setEntityValue(itemData.getValue());
        }
        note.setSubjectName(ssub.getName());
        note.setEntityType(name);
        Date lastUpdatedDate = note.getCreatedDate();
        UserAccountBean lastUpdator = (UserAccountBean) udao.findByPK(note.getOwnerId());
        note.setLastUpdator(lastUpdator);
        note.setLastDateUpdated(lastUpdatedDate);
        note.setDisType(DiscrepancyNoteType.get(note.getDiscrepancyNoteTypeId()));
        note.setResStatus(ResolutionStatus.get(note.getResolutionStatusId()));
        if (pId > 0) {
            DiscrepancyNoteBean parent = noteTree.get(new Integer(pId));
            if (parent != null) {
                parent.getChildren().add(note);
                if (!note.getCreatedDate().before(parent.getLastDateUpdated())) {
                    parent.setLastDateUpdated(note.getCreatedDate());
                }
                if (note.getDiscrepancyNoteTypeId() == 1 && note.getAssignedUserId() > 0) {
                    int ownerId = note.getOwnerId();
                    if (fvcInitAssigns.containsKey(pId)) {
                        String f = fvcInitAssigns.get(pId);
                        String fn = note.getId() + "." + ownerId;
                        if (fn.compareTo(f) < 0) {
                            fvcInitAssigns.put(pId, fn);
                        }
                    } else {
                        fvcInitAssigns.put(pId, note.getId() + "." + ownerId);
                    }
                }
            }
        }
    }
    Set parents = noteTree.keySet();
    Iterator it = parents.iterator();
    while (it.hasNext()) {
        Integer key = (Integer) it.next();
        DiscrepancyNoteBean note = noteTree.get(key);
        note.setNumChildren(note.getChildren().size());
        note.setEntityType(name);
        if (!boxDNMap.containsKey(key)) {
            DiscrepancyNoteBean dn = new DiscrepancyNoteBean();
            dn.setId(key);
            int dnTypeId = note.getDiscrepancyNoteTypeId();
            dn.setDiscrepancyNoteTypeId(dnTypeId);
            if (dnTypeId == 3) {
                // Query
                dn.setAssignedUserId(note.getOwnerId());
            } else if (dnTypeId == 1) {
                // FVC
                if (fvcInitAssigns.containsKey(key)) {
                    String[] s = fvcInitAssigns.get(key).split("\\.");
                    int i = Integer.parseInt(s.length == 2 ? s[1].trim() : "0");
                    dn.setAssignedUserId(i);
                }
            }
            Role r = currentRole.getRole();
            // currentStudy.getId() != currentStudy.getParentStudyId()) {
            if (r.equals(Role.RESEARCHASSISTANT) || r.equals(Role.RESEARCHASSISTANT2) || r.equals(Role.INVESTIGATOR)) {
                if (dn.getDiscrepancyNoteTypeId() == DiscrepancyNoteType.QUERY.getId() && note.getResStatus().getId() == ResolutionStatus.UPDATED.getId()) {
                    dn.setResolutionStatusId(ResolutionStatus.UPDATED.getId());
                } else {
                    dn.setResolutionStatusId(ResolutionStatus.RESOLVED.getId());
                }
                if (dn.getAssignedUserId() > 0) {
                    autoviews.put(key, 1);
                } else {
                    autoviews.put(key, 0);
                }
            // copied from CreateDiscrepancyNoteServlet
            // request.setAttribute("autoView", "0");
            // hide the panel, tbh
            } else {
                if (note.getResStatus().getId() == ResolutionStatus.RESOLVED.getId()) {
                    dn.setResolutionStatusId(ResolutionStatus.CLOSED.getId());
                } else if (note.getResStatus().getId() == ResolutionStatus.CLOSED.getId()) {
                    dn.setResolutionStatusId(ResolutionStatus.UPDATED.getId());
                } else if (r.equals(Role.MONITOR)) {
                    dn.setResolutionStatusId(ResolutionStatus.UPDATED.getId());
                } else if (dn.getDiscrepancyNoteTypeId() == 1) {
                    dn.setResolutionStatusId(ResolutionStatus.RESOLVED.getId());
                } else {
                    dn.setResolutionStatusId(ResolutionStatus.UPDATED.getId());
                }
                autoviews.put(key, 1);
                if (dn.getAssignedUserId() > 0) {
                } else {
                    dn.setAssignedUserId(preUserId);
                }
            }
            boxDNMap.put(key, dn);
        }
    }
    session.setAttribute(BOX_DN_MAP, boxDNMap);
    session.setAttribute(AUTOVIEWS, autoviews);
    // noteTree is a Hashmap mapping note id to a parent note, with all the
    // child notes
    // stored in the children List.
    // BWP 3029>>make sure the parent note has an updated resolution status
    // and
    // updated date
    fixStatusUpdatedDate(noteTree);
    request.setAttribute(DIS_NOTES, noteTree);
    // copied from CreatediscrepancyNoteServlet generateUserAccounts
    StudyDAO studyDAO = new StudyDAO(sm.getDataSource());
    StudyBean subjectStudy = studyDAO.findByStudySubjectId(subjectId);
    int studyId = currentStudy.getId();
    ArrayList<UserAccountBean> userAccounts = new ArrayList();
    if (currentStudy.getParentStudyId() > 0) {
        userAccounts = udao.findAllUsersByStudyOrSite(studyId, currentStudy.getParentStudyId(), subjectId);
    } else if (subjectStudy.getParentStudyId() > 0) {
        userAccounts = udao.findAllUsersByStudyOrSite(subjectStudy.getId(), subjectStudy.getParentStudyId(), subjectId);
    } else {
        userAccounts = udao.findAllUsersByStudyOrSite(studyId, 0, subjectId);
    }
    request.setAttribute(USER_ACCOUNTS, userAccounts);
    request.setAttribute(VIEW_DN_LINK, this.getPageServletFileName());
    // audit log items (from ViewItemAuditLogServlet.java)
    AuditDAO adao = new AuditDAO(sm.getDataSource());
    if (name.equalsIgnoreCase("studysub")) {
        name = "study_subject";
    } else if (name.equalsIgnoreCase("eventcrf")) {
        name = "event_crf";
    } else if (name.equalsIgnoreCase("studyevent")) {
        name = "study_event";
    } else if (name.equalsIgnoreCase("itemdata")) {
        name = "item_data";
    }
    ArrayList itemAuditEvents = adao.findItemAuditEvents(entityId, name);
    request.setAttribute("itemAudits", itemAuditEvents);
    forwardPage(Page.VIEW_DISCREPANCY_NOTE);
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) ItemDAO(org.akaza.openclinica.dao.submit.ItemDAO) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) LinkedHashMap(java.util.LinkedHashMap) ResolutionStatus(org.akaza.openclinica.bean.core.ResolutionStatus) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) ArrayList(java.util.ArrayList) List(java.util.List) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) DiscrepancyNoteDAO(org.akaza.openclinica.dao.managestudy.DiscrepancyNoteDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) FormDiscrepancyNotes(org.akaza.openclinica.control.form.FormDiscrepancyNotes) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) Role(org.akaza.openclinica.bean.core.Role) SubjectBean(org.akaza.openclinica.bean.submit.SubjectBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) DiscrepancyNoteBean(org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean) Set(java.util.Set) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) SubjectDAO(org.akaza.openclinica.dao.submit.SubjectDAO) InsufficientPermissionException(org.akaza.openclinica.web.InsufficientPermissionException) ItemDataDAO(org.akaza.openclinica.dao.submit.ItemDataDAO) AuditDAO(org.akaza.openclinica.dao.admin.AuditDAO) DiscrepancyNoteType(org.akaza.openclinica.bean.core.DiscrepancyNoteType) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) Iterator(java.util.Iterator) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) Date(java.util.Date) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) SimpleDateFormat(java.text.SimpleDateFormat)

Example 5 with AuditDAO

use of org.akaza.openclinica.dao.admin.AuditDAO in project OpenClinica by OpenClinica.

the class ViewItemAuditLogServlet method processRequest.

public void processRequest() throws Exception {
    AuditDAO adao = new AuditDAO(sm.getDataSource());
    FormProcessor fp = new FormProcessor(request);
    String auditTable = fp.getString("auditTable");
    if (auditTable.equalsIgnoreCase("studysub")) {
        auditTable = "study_subject";
    } else if (auditTable.equalsIgnoreCase("eventcrf")) {
        auditTable = "event_crf";
    } else if (auditTable.equalsIgnoreCase("studyevent")) {
        auditTable = "study_event";
    } else if (auditTable.equalsIgnoreCase("itemdata")) {
        auditTable = "item_data";
    }
    int entityId = fp.getInt("entityId");
    ArrayList itemAuditEvents = adao.findItemAuditEvents(entityId, auditTable);
    request.setAttribute("itemAudits", itemAuditEvents);
    forwardPage(Page.AUDIT_LOGS_ITEMS);
}
Also used : AuditDAO(org.akaza.openclinica.dao.admin.AuditDAO) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) ArrayList(java.util.ArrayList)

Aggregations

AuditDAO (org.akaza.openclinica.dao.admin.AuditDAO)8 ArrayList (java.util.ArrayList)6 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)6 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)6 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)6 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)6 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)5 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)5 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)5 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)5 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)5 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)5 SubjectDAO (org.akaza.openclinica.dao.submit.SubjectDAO)5 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)4 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)4 SubjectBean (org.akaza.openclinica.bean.submit.SubjectBean)4 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)4 Iterator (java.util.Iterator)3 List (java.util.List)3 AuditBean (org.akaza.openclinica.bean.admin.AuditBean)3