Search in sources :

Example 6 with AuditLogsBean

use of org.akaza.openclinica.bean.odmbeans.AuditLogsBean in project OpenClinica by OpenClinica.

the class GenerateClinicalDataServiceImpl method setExportSubjectDataBean.

@SuppressWarnings("unchecked")
private ExportSubjectDataBean setExportSubjectDataBean(StudySubject studySubj, Study study, List<StudyEvent> studyEvents, String formVersionOID) {
    ExportSubjectDataBean exportSubjectDataBean = new ExportSubjectDataBean();
    if (subjectBelongsToStudy(study, studySubj)) {
        // exportSubjectDataBean.setAuditLogs(studySubj.getA)
        if (studySubj.getSubject().getDateOfBirth() != null)
            exportSubjectDataBean.setDateOfBirth(studySubj.getSubject().getDateOfBirth() + "");
        exportSubjectDataBean.setSubjectGender(studySubj.getSubject().getGender() + "");
        for (SubjectGroupMap subjGrpMap : studySubj.getSubjectGroupMaps()) {
            SubjectGroupDataBean subjGrpDataBean = new SubjectGroupDataBean();
            subjGrpDataBean.setStudyGroupClassId("SGC_" + subjGrpMap.getStudyGroupClass().getStudyGroupClassId());
            subjGrpDataBean.setStudyGroupClassName(subjGrpMap.getStudyGroup().getStudyGroupClass().getName());
            subjGrpDataBean.setStudyGroupName(subjGrpMap.getStudyGroup().getName());
            exportSubjectDataBean.getSubjectGroupData().add(subjGrpDataBean);
        }
        exportSubjectDataBean.setStudySubjectId(studySubj.getLabel());
        if (studySubj.getSubject().getUniqueIdentifier() != null)
            exportSubjectDataBean.setUniqueIdentifier(studySubj.getSubject().getUniqueIdentifier());
        exportSubjectDataBean.setSecondaryId(studySubj.getSecondaryLabel());
        exportSubjectDataBean.setStatus(studySubj.getStatus().toString());
        if (isCollectAudits())
            exportSubjectDataBean.setAuditLogs(fetchAuditLogs(studySubj.getStudySubjectId(), "study_subject", studySubj.getOcOid(), null));
        AuditLogsBean subjectGroupMapLogs = fetchAuditLogs(studySubj.getStudySubjectId(), "subject_group_map", studySubj.getOcOid(), null);
        AuditLogsBean subjectLogs = fetchAuditLogs(studySubj.getSubject().getSubjectId(), "subject", studySubj.getOcOid(), null);
        exportSubjectDataBean.getAuditLogs().getAuditLogs().addAll(subjectGroupMapLogs.getAuditLogs());
        exportSubjectDataBean.getAuditLogs().getAuditLogs().addAll(subjectLogs.getAuditLogs());
        Collections.sort(exportSubjectDataBean.getAuditLogs().getAuditLogs());
        if (isCollectDns())
            exportSubjectDataBean.setDiscrepancyNotes(fetchDiscrepancyNotes(studySubj));
        exportSubjectDataBean.setExportStudyEventData(setExportStudyEventDataBean(studySubj, studyEvents, formVersionOID));
        exportSubjectDataBean.setSubjectOID(studySubj.getOcOid());
        exportSubjectDataBean.setEnrollmentDate(studySubj.getEnrollmentDate() + "");
    }
    return exportSubjectDataBean;
}
Also used : SubjectGroupDataBean(org.akaza.openclinica.bean.submit.crfdata.SubjectGroupDataBean) SubjectGroupMap(org.akaza.openclinica.domain.datamap.SubjectGroupMap) AuditLogsBean(org.akaza.openclinica.bean.odmbeans.AuditLogsBean) ExportSubjectDataBean(org.akaza.openclinica.bean.submit.crfdata.ExportSubjectDataBean)

Aggregations

AuditLogsBean (org.akaza.openclinica.bean.odmbeans.AuditLogsBean)6 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 HashMap (java.util.HashMap)4 Iterator (java.util.Iterator)4 LinkedHashMap (java.util.LinkedHashMap)4 AuditLogBean (org.akaza.openclinica.bean.odmbeans.AuditLogBean)4 ExportSubjectDataBean (org.akaza.openclinica.bean.submit.crfdata.ExportSubjectDataBean)2 SimpleDateFormat (java.text.SimpleDateFormat)1 ExportFormDataBean (org.akaza.openclinica.bean.submit.crfdata.ExportFormDataBean)1 ExportStudyEventDataBean (org.akaza.openclinica.bean.submit.crfdata.ExportStudyEventDataBean)1 ImportItemDataBean (org.akaza.openclinica.bean.submit.crfdata.ImportItemDataBean)1 SubjectGroupDataBean (org.akaza.openclinica.bean.submit.crfdata.SubjectGroupDataBean)1 AuditLogEvent (org.akaza.openclinica.domain.datamap.AuditLogEvent)1 SubjectGroupMap (org.akaza.openclinica.domain.datamap.SubjectGroupMap)1