use of org.akaza.openclinica.dao.managestudy.StudyEventDAO in project OpenClinica by OpenClinica.
the class NotificationActionProcessor method getStudyEvent.
public StudyEventBean getStudyEvent(StudySubjectBean ssBean, DataSource ds) {
StudyEventDAO studyEventDao = new StudyEventDAO(ds);
StudyEventBean seBean = (StudyEventBean) studyEventDao.getNextScheduledEvent(ssBean.getOid());
return seBean;
}
use of org.akaza.openclinica.dao.managestudy.StudyEventDAO in project OpenClinica by OpenClinica.
the class ImportDataHelper method createEventCRF.
public EventCRFBean createEventCRF(HashMap<String, String> importedObject) {
EventCRFBean eventCrfBean = null;
int studyEventId = importedObject.get("study_event_id") == null ? -1 : Integer.parseInt(importedObject.get("study_event_id"));
String crfVersionName = importedObject.get("crf_version_name") == null ? "" : importedObject.get("crf_version_name").toString();
String crfName = importedObject.get("crf_name") == null ? "" : importedObject.get("crf_name").toString();
String eventDefinitionCRFName = importedObject.get("event_definition_crf_name") == null ? "" : importedObject.get("event_definition_crf_name").toString();
String subjectName = importedObject.get("subject_name") == null ? "" : importedObject.get("subject_name").toString();
String studyName = importedObject.get("study_name") == null ? "" : importedObject.get("study_name").toString();
logger.info("found the following: study event id " + studyEventId + ", crf version name " + crfVersionName + ", crf name " + crfName + ", event def crf name " + eventDefinitionCRFName + ", subject name " + subjectName + ", study name " + studyName);
// << tbh
int eventCRFId = 0;
EventCRFDAO eventCrfDao = new EventCRFDAO(sm.getDataSource());
StudyDAO studyDao = new StudyDAO(sm.getDataSource());
StudySubjectDAO studySubjectDao = new StudySubjectDAO(sm.getDataSource());
StudyEventDefinitionDAO studyEventDefinistionDao = new StudyEventDefinitionDAO(sm.getDataSource());
CRFVersionDAO crfVersionDao = new CRFVersionDAO(sm.getDataSource());
StudyEventDAO studyEventDao = new StudyEventDAO(sm.getDataSource());
CRFDAO crfdao = new CRFDAO(sm.getDataSource());
SubjectDAO subjectDao = new SubjectDAO(sm.getDataSource());
StudyBean studyBean = (StudyBean) studyDao.findByName(studyName);
// .findByPK(studyId);
// generate the subject bean first, so that we can have the subject id
// below...
SubjectBean subjectBean = // .findByUniqueIdentifierAndStudy(subjectName,
subjectDao.findByUniqueIdentifier(subjectName);
StudySubjectBean studySubjectBean = studySubjectDao.findBySubjectIdAndStudy(subjectBean.getId(), studyBean);
// .findByLabelAndStudy(subjectName, studyBean);
logger.info("::: found study subject id here: " + studySubjectBean.getId() + " with the following: subject ID " + subjectBean.getId() + " study bean name " + studyBean.getName());
StudyEventBean studyEventBean = (StudyEventBean) studyEventDao.findByPK(studyEventId);
// TODO need to replace, can't really replace
logger.info("found study event status: " + studyEventBean.getStatus().getName());
// [study] event should be scheduled, event crf should be not started
CRFVersionBean crfVersion = (CRFVersionBean) crfVersionDao.findByFullName(crfVersionName, crfName);
// .findByPK(crfVersionId);
// replaced by findByName(name, version)
logger.info("found crf version name here: " + crfVersion.getName());
EntityBean crf = crfdao.findByPK(crfVersion.getCrfId());
logger.info("found crf name here: " + crf.getName());
// trying it again up here since down there doesn't seem to work, tbh
StudyEventDefinitionBean studyEventDefinitionBean = (StudyEventDefinitionBean) studyEventDefinistionDao.findByName(eventDefinitionCRFName);
if (studySubjectBean.getId() <= 0 && studyEventBean.getId() <= 0 && crfVersion.getId() <= 0 && studyBean.getId() <= 0 && studyEventDefinitionBean.getId() <= 0) {
logger.info("Throw an Exception, One of the provided ids is not valid");
}
// >> tbh repeating items:
ArrayList eventCrfBeans = eventCrfDao.findByEventSubjectVersion(studyEventBean, studySubjectBean, crfVersion);
// TODO repeating items here? not yet
if (eventCrfBeans.size() > 1) {
logger.info("found more than one");
}
if (!eventCrfBeans.isEmpty() && eventCrfBeans.size() == 1) {
eventCrfBean = (EventCRFBean) eventCrfBeans.get(0);
logger.info("This EventCrfBean was found");
}
if (!eventCrfBeans.isEmpty() && eventCrfBeans.size() > 1) {
logger.info("Throw a System exception , result should either be 0 or 1");
}
if (eventCrfBean == null) {
StudyBean studyWithSED = studyBean;
if (studyBean.getParentStudyId() > 0) {
studyWithSED = new StudyBean();
studyWithSED.setId(studyBean.getParentStudyId());
}
AuditableEntityBean studyEvent = studyEventDao.findByPKAndStudy(studyEventId, studyWithSED);
if (studyEvent.getId() <= 0) {
logger.info("Hello Exception");
}
eventCrfBean = new EventCRFBean();
// eventCrfBean.setCrfVersion(crfVersion);
if (eventCRFId == 0) {
// ???
if (studyBean.getStudyParameterConfig().getInterviewerNameDefault().equals("blank")) {
eventCrfBean.setInterviewerName("");
} else {
// default will be event's owner name
eventCrfBean.setInterviewerName(studyEventBean.getOwner().getName());
}
if (!studyBean.getStudyParameterConfig().getInterviewDateDefault().equals("blank")) {
if (studyEventBean.getDateStarted() != null) {
// default
eventCrfBean.setDateInterviewed(studyEventBean.getDateStarted());
// date
} else {
// logger.info("evnet start date is null, so date
// interviewed is null");
eventCrfBean.setDateInterviewed(null);
}
} else {
eventCrfBean.setDateInterviewed(null);
}
eventCrfBean.setAnnotations("");
eventCrfBean.setCreatedDate(new Date());
eventCrfBean.setCRFVersionId(crfVersion.getId());
// eventCrfBean.setCrfVersion((CRFVersionBean)crfVersion);
eventCrfBean.setOwner(ub);
// eventCrfBean.setCrf((CRFBean)crf);
eventCrfBean.setStatus(Status.AVAILABLE);
eventCrfBean.setCompletionStatusId(1);
// problem with the line below
eventCrfBean.setStudySubjectId(studySubjectBean.getId());
eventCrfBean.setStudyEventId(studyEventId);
eventCrfBean.setValidateString("");
eventCrfBean.setValidatorAnnotations("");
try {
eventCrfBean = (EventCRFBean) eventCrfDao.create(eventCrfBean);
// TODO review
// eventCrfBean.setCrfVersion((CRFVersionBean)crfVersion);
// eventCrfBean.setCrf((CRFBean)crf);
} catch (Exception ee) {
logger.info(ee.getMessage());
logger.info("throws with crf version id " + crfVersion.getId() + " and study event id " + studyEventId + " study subject id " + studySubjectBean.getId());
}
// note that you need to catch an exception if the numbers are
// bogus, ie you can throw an error here
// however, putting the try catch allows you to pass which is
// also bad
// logger.info("CREATED EVENT CRF");
} else {
// there is an event CRF already, only need to update
// is the status not started???
logger.info("*** already-started event CRF with msg: " + eventCrfBean.getStatus().getName());
if (eventCrfBean.getStatus().equals(Status.PENDING)) {
logger.info("Not Started???");
}
eventCrfBean = (EventCRFBean) eventCrfDao.findByPK(eventCRFId);
eventCrfBean.setCRFVersionId(crfVersion.getId());
eventCrfBean.setUpdatedDate(new Date());
eventCrfBean.setUpdater(ub);
eventCrfBean = (EventCRFBean) eventCrfDao.update(eventCrfBean);
// eventCrfBean.setCrfVersion((CRFVersionBean)crfVersion);
// eventCrfBean.setCrf((CRFBean)crf);
}
if (eventCrfBean.getId() <= 0) {
logger.info("error");
} else {
// TODO change status here, tbh
// 2/08 this part seems to work, tbh
studyEventBean.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
studyEventBean.setUpdater(ub);
studyEventBean.setUpdatedDate(new Date());
studyEventDao.update(studyEventBean);
}
}
eventCrfBean.setCrfVersion(crfVersion);
eventCrfBean.setCrf((CRFBean) crf);
// repeating?
return eventCrfBean;
}
use of org.akaza.openclinica.dao.managestudy.StudyEventDAO in project OpenClinica by OpenClinica.
the class ImportDataRuleRunnerContainer method initRuleSetsAndTargets.
/**
* Populate importDataTrueRuleSets and variableAndValue.
* Precondition: import data file passed validation which means all OIDs are not empty.
* @param ds
* @param studyBean
* @param subjectDataBean
* @param ruleSetService
*/
@Transactional
public void initRuleSetsAndTargets(DataSource ds, StudyBean studyBean, SubjectDataBean subjectDataBean, RuleSetServiceInterface ruleSetService) {
this.shouldRunRules = this.shouldRunRules == null ? Boolean.FALSE : this.shouldRunRules;
this.importDataTrueRuleSets = this.importDataTrueRuleSets == null ? new ArrayList<RuleSetBean>() : this.importDataTrueRuleSets;
this.variableAndValue = this.variableAndValue == null ? new HashMap<String, String>() : this.variableAndValue;
studyOid = studyBean.getOid();
studySubjectOid = subjectDataBean.getSubjectOID();
StudySubjectBean studySubject = new StudySubjectDAO<String, ArrayList>(ds).findByOid(studySubjectOid);
HashMap<String, StudyEventDefinitionBean> seds = new HashMap<String, StudyEventDefinitionBean>();
HashMap<String, CRFVersionBean> cvs = new HashMap<String, CRFVersionBean>();
ArrayList<StudyEventDataBean> studyEventDataBeans = subjectDataBean.getStudyEventData();
for (StudyEventDataBean studyEventDataBean : studyEventDataBeans) {
String sedOid = studyEventDataBean.getStudyEventOID();
StudyEventDefinitionBean sed;
if (seds.containsKey(sedOid))
sed = seds.get(sedOid);
else {
sed = new StudyEventDefinitionDAO<String, ArrayList>(ds).findByOid(sedOid);
seds.put(sedOid, sed);
}
ArrayList<FormDataBean> formDataBeans = studyEventDataBean.getFormData();
for (FormDataBean formDataBean : formDataBeans) {
String cvOid = formDataBean.getFormOID();
CRFVersionBean crfVersion;
if (cvs.containsKey(cvOid))
crfVersion = cvs.get(cvOid);
else {
crfVersion = new CRFVersionDAO<String, ArrayList>(ds).findByOid(cvOid);
cvs.put(cvOid, crfVersion);
}
String sedOrd = studyEventDataBean.getStudyEventRepeatKey();
Integer sedOrdinal = sedOrd != null && !sedOrd.isEmpty() ? Integer.valueOf(sedOrd) : 1;
StudyEventBean studyEvent = (StudyEventBean) new StudyEventDAO(ds).findByStudySubjectIdAndDefinitionIdAndOrdinal(studySubject.getId(), sed.getId(), sedOrdinal);
List<RuleSetBean> ruleSets = ruleSetService.getRuleSetsByCrfStudyAndStudyEventDefinition(studyBean, sed, crfVersion);
//Set<String> targetItemOids = new HashSet<String>();
if (ruleSets != null && !ruleSets.isEmpty()) {
ruleSets = filterByImportDataEntryTrue(ruleSets);
if (ruleSets != null && !ruleSets.isEmpty()) {
ruleSets = ruleSetService.filterByStatusEqualsAvailable(ruleSets);
ruleSets = ruleSetService.filterRuleSetsByStudyEventOrdinal(ruleSets, studyEvent, crfVersion, sed);
//ruleSets = ruleSetService.filterRuleSetsByHiddenItems(ruleSets, eventCrfBean, crfVersion, new ArrayList<ItemBean>());
shouldRunRules = ruleSetService.shouldRunRulesForRuleSets(ruleSets, Phase.IMPORT);
if (shouldRunRules != null && shouldRunRules == Boolean.TRUE) {
//targetItemOids = collectTargetItemOids(ruleSets);
HashMap<String, Integer> grouped = new HashMap<String, Integer>();
ArrayList<ImportItemGroupDataBean> itemGroupDataBeans = formDataBean.getItemGroupData();
for (ImportItemGroupDataBean itemGroupDataBean : itemGroupDataBeans) {
ArrayList<ImportItemDataBean> itemDataBeans = itemGroupDataBean.getItemData();
for (ImportItemDataBean importItemDataBean : itemDataBeans) {
//if(targetItemOids.contains(importItemDataBean.getItemOID())) {
ItemBean item = new ItemDAO<String, ArrayList>(ds).findByOid(importItemDataBean.getItemOID()).get(0);
String igOid = itemGroupDataBean.getItemGroupOID();
String igOrd = itemGroupDataBean.getItemGroupRepeatKey();
Integer igOrdinal = igOrd != null && !igOrd.isEmpty() ? Integer.valueOf(igOrd) : 1;
//logic from DataEntryServlet method: populateRuleSpecificHashMaps()
if (isRepeatIGForSure(ds, crfVersion.getId(), igOid, igOrdinal, item.getId())) {
String key1 = igOid + "[" + igOrdinal + "]." + importItemDataBean.getItemOID();
String key = igOid + "." + importItemDataBean.getItemOID();
variableAndValue.put(key1, importItemDataBean.getValue());
if (grouped.containsKey(key)) {
grouped.put(key, grouped.get(key) + 1);
} else {
grouped.put(key, 1);
}
} else {
variableAndValue.put(importItemDataBean.getItemOID(), importItemDataBean.getValue());
grouped.put(importItemDataBean.getItemOID(), 1);
}
//
//}
}
}
ruleSets = ruleSetService.solidifyGroupOrdinalsUsingFormProperties(ruleSets, grouped);
importDataTrueRuleSets.addAll(ruleSets);
}
}
}
}
}
}
use of org.akaza.openclinica.dao.managestudy.StudyEventDAO in project OpenClinica by OpenClinica.
the class DeleteEventCRFServlet method processRequest.
@Override
public void processRequest() throws Exception {
FormProcessor fp = new FormProcessor(request);
int studySubId = fp.getInt(STUDY_SUB_ID, true);
int eventCRFId = fp.getInt(EVENT_CRF_ID);
String action = request.getParameter("action");
StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
StudySubjectDAO subdao = new StudySubjectDAO(sm.getDataSource());
EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
StudyDAO sdao = new StudyDAO(sm.getDataSource());
if (eventCRFId == 0) {
addPageMessage(respage.getString("please_choose_an_event_CRF_to_delete"));
request.setAttribute("id", new Integer(studySubId).toString());
forwardPage(Page.VIEW_STUDY_SUBJECT_SERVLET);
} else {
EventCRFBean eventCRF = (EventCRFBean) ecdao.findByPK(eventCRFId);
StudySubjectBean studySub = (StudySubjectBean) subdao.findByPK(studySubId);
request.setAttribute("studySub", studySub);
// construct info needed on view event crf page
CRFDAO cdao = new CRFDAO(sm.getDataSource());
CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
int crfVersionId = eventCRF.getCRFVersionId();
CRFBean cb = cdao.findByVersionId(crfVersionId);
eventCRF.setCrf(cb);
CRFVersionBean cvb = (CRFVersionBean) cvdao.findByPK(crfVersionId);
eventCRF.setCrfVersion(cvb);
// then get the definition so we can call
// DisplayEventCRFBean.setFlags
int studyEventId = eventCRF.getStudyEventId();
StudyEventBean event = (StudyEventBean) sedao.findByPK(studyEventId);
int studyEventDefinitionId = sedao.getDefinitionIdFromStudyEventId(studyEventId);
StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
StudyEventDefinitionBean sed = (StudyEventDefinitionBean) seddao.findByPK(studyEventDefinitionId);
event.setStudyEventDefinition(sed);
request.setAttribute("event", event);
EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(sm.getDataSource());
StudyBean study = (StudyBean) sdao.findByPK(studySub.getStudyId());
EventDefinitionCRFBean edc = edcdao.findByStudyEventDefinitionIdAndCRFId(study, studyEventDefinitionId, cb.getId());
DisplayEventCRFBean dec = new DisplayEventCRFBean();
dec.setEventCRF(eventCRF);
dec.setFlags(eventCRF, ub, currentRole, edc.isDoubleEntry());
// find all item data
ItemDataDAO iddao = new ItemDataDAO(sm.getDataSource());
dnDao = new DiscrepancyNoteDAO(sm.getDataSource());
ArrayList<ItemDataBean> itemData = iddao.findAllByEventCRFId(eventCRF.getId());
request.setAttribute("items", itemData);
if ("confirm".equalsIgnoreCase(action)) {
request.setAttribute("displayEventCRF", dec);
forwardPage(Page.DELETE_EVENT_CRF);
} else {
logger.info("submit to delete the event CRF from event");
// OC-6303 Deleting Event CRF resets Show / Hide logic
// delete records from DynamicItemForm and DynamicItemGroup
// getDynamicsItemFormMetadataDao().delete(eventCRFId);
// getDynamicsItemGroupMetadataDao().delete(eventCRFId);
eventCRF.setOldStatus(eventCRF.getStatus());
eventCRF.setStatus(Status.RESET);
eventCRF.setUpdater(ub);
ecdao.update(eventCRF);
for (ItemDataBean itemdata : itemData) {
// OC-6343 Rule behaviour must be reset if an Event CRF is deleted
// delete the records from ruleActionRunLogDao
List<RuleActionRunLogBean> ruleActionRunLog = getRuleActionRunLogDao().findAllItemData(itemdata.getId());
if (ruleActionRunLog.size() != 0) {
getRuleActionRunLogDao().delete(itemdata.getId());
}
// OC-6344 Notes & Discrepancies must be set to "closed" when event CRF is deleted
// parentDiscrepancyNoteList is the list of the parent DNs records only
ArrayList<DiscrepancyNoteBean> parentDiscrepancyNoteList = getDnDao().findParentNotesOnlyByItemData(itemdata.getId());
for (DiscrepancyNoteBean parentDiscrepancyNote : parentDiscrepancyNoteList) {
if (parentDiscrepancyNote.getResolutionStatusId() != 4) {
// if the DN's resolution status is
// not set to Closed
String description = resword.getString("dn_auto-closed_description");
String detailedNotes = resword.getString("dn_auto_closed_detailed_notes");
// create new DN record , new DN Map record , also update the parent record
createDiscrepancyNoteBean(description, detailedNotes, itemdata.getId(), study, ub, parentDiscrepancyNote);
}
}
iddao = new ItemDataDAO(sm.getDataSource());
ifmdao = new ItemFormMetadataDAO(sm.getDataSource());
ItemDataBean idBean = (ItemDataBean) iddao.findByPK(itemdata.getId());
ItemFormMetadataBean ifmBean = ifmdao.findByItemIdAndCRFVersionId(idBean.getItemId(), crfVersionId);
// Updating Dn_item_data_map actovated column into false for the existing DNs
ArrayList<DiscrepancyNoteBean> dnBeans = getDnDao().findExistingNotesForItemData(itemdata.getId());
if (dnBeans.size() != 0) {
DiscrepancyNoteBean dnBean = new DiscrepancyNoteBean();
dnBean.setEntityId(itemdata.getId());
dnBean.setActivated(false);
getDnDao().updateDnMapActivation(dnBean);
}
// Default Values are not addressed
itemdata.setValue("");
itemdata.setOldStatus(itemdata.getStatus());
itemdata.setOwner(ub);
itemdata.setStatus(Status.AVAILABLE);
itemdata.setUpdater(ub);
iddao.updateUser(itemdata);
iddao.update(itemdata);
}
// OC-6291 event_crf status change
eventCRF.setOldStatus(eventCRF.getStatus());
eventCRF.setStatus(Status.AVAILABLE);
eventCRF.setUpdater(ub);
ecdao.update(eventCRF);
if (event.getSubjectEventStatus().isCompleted() || event.getSubjectEventStatus().isSigned()) {
event.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
event.setUpdater(ub);
sedao = new StudyEventDAO(sm.getDataSource());
sedao.update(event);
}
String emailBody = respage.getString("the_event_CRF") + cb.getName() + respage.getString("has_been_deleted_from_the_event") + event.getStudyEventDefinition().getName() + ". " + respage.getString("has_been_deleted_from_the_event_cont");
addPageMessage(emailBody);
// sendEmail(emailBody);
request.setAttribute("id", new Integer(studySubId).toString());
forwardPage(Page.VIEW_STUDY_SUBJECT_SERVLET);
}
}
}
use of org.akaza.openclinica.dao.managestudy.StudyEventDAO 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);
}
Aggregations