use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class RemoveEventCRFServlet method processRequest.
@Override
public void processRequest() throws Exception {
FormProcessor fp = new FormProcessor(request);
// eventCRFId
int eventCRFId = fp.getInt("id");
// studySubjectId
int studySubId = fp.getInt("studySubId");
checkStudyLocked("ViewStudySubject?id" + studySubId, respage.getString("current_study_locked"));
StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
StudySubjectDAO subdao = new StudySubjectDAO(sm.getDataSource());
EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
StudyDAO sdao = new StudyDAO(sm.getDataSource());
if (eventCRFId == 0) {
addPageMessage(respage.getString("please_choose_an_event_CRF_to_remove"));
request.setAttribute("id", new Integer(studySubId).toString());
forwardPage(Page.VIEW_STUDY_SUBJECT_SERVLET);
} else {
EventCRFBean eventCRF = (EventCRFBean) ecdao.findByPK(eventCRFId);
StudySubjectBean studySub = (StudySubjectBean) subdao.findByPK(studySubId);
request.setAttribute("studySub", studySub);
// construct info needed on view event crf page
CRFDAO cdao = new CRFDAO(sm.getDataSource());
CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
int crfVersionId = eventCRF.getCRFVersionId();
CRFBean cb = cdao.findByVersionId(crfVersionId);
eventCRF.setCrf(cb);
CRFVersionBean cvb = (CRFVersionBean) cvdao.findByPK(crfVersionId);
eventCRF.setCrfVersion(cvb);
// then get the definition so we can call
// DisplayEventCRFBean.setFlags
int studyEventId = eventCRF.getStudyEventId();
StudyEventBean event = (StudyEventBean) sedao.findByPK(studyEventId);
int studyEventDefinitionId = sedao.getDefinitionIdFromStudyEventId(studyEventId);
StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
StudyEventDefinitionBean sed = (StudyEventDefinitionBean) seddao.findByPK(studyEventDefinitionId);
event.setStudyEventDefinition(sed);
request.setAttribute("event", event);
EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(sm.getDataSource());
StudyBean study = (StudyBean) sdao.findByPK(studySub.getStudyId());
EventDefinitionCRFBean edc = edcdao.findByStudyEventDefinitionIdAndCRFId(study, studyEventDefinitionId, cb.getId());
DisplayEventCRFBean dec = new DisplayEventCRFBean();
dec.setEventCRF(eventCRF);
dec.setFlags(eventCRF, ub, currentRole, edc.isDoubleEntry());
// find all item data
ItemDataDAO iddao = new ItemDataDAO(sm.getDataSource());
ArrayList itemData = iddao.findAllByEventCRFId(eventCRF.getId());
request.setAttribute("items", itemData);
String action = request.getParameter("action");
if ("confirm".equalsIgnoreCase(action)) {
if (eventCRF.getStatus().equals(Status.DELETED) || eventCRF.getStatus().equals(Status.AUTO_DELETED)) {
addPageMessage(respage.getString("this_event_CRF_is_removed_for_this_study") + " " + respage.getString("please_contact_sysadmin_for_more_information"));
request.setAttribute("id", new Integer(studySubId).toString());
forwardPage(Page.VIEW_STUDY_SUBJECT_SERVLET);
return;
}
request.setAttribute("displayEventCRF", dec);
forwardPage(Page.REMOVE_EVENT_CRF);
} else {
logger.info("submit to remove the event CRF from study");
eventCRF.setStatus(Status.DELETED);
eventCRF.setUpdater(ub);
eventCRF.setUpdatedDate(new Date());
ecdao.update(eventCRF);
// remove all the item data
for (int a = 0; a < itemData.size(); a++) {
ItemDataBean item = (ItemDataBean) itemData.get(a);
if (!item.getStatus().equals(Status.DELETED)) {
item.setStatus(Status.AUTO_DELETED);
item.setUpdater(ub);
item.setUpdatedDate(new Date());
iddao.update(item);
DiscrepancyNoteDAO dnDao = new DiscrepancyNoteDAO(sm.getDataSource());
List dnNotesOfRemovedItem = dnDao.findExistingNotesForItemData(item.getId());
if (!dnNotesOfRemovedItem.isEmpty()) {
DiscrepancyNoteBean itemParentNote = null;
for (Object obj : dnNotesOfRemovedItem) {
if (((DiscrepancyNoteBean) obj).getParentDnId() == 0) {
itemParentNote = (DiscrepancyNoteBean) obj;
}
}
DiscrepancyNoteBean dnb = new DiscrepancyNoteBean();
if (itemParentNote != null) {
dnb.setParentDnId(itemParentNote.getId());
dnb.setDiscrepancyNoteTypeId(itemParentNote.getDiscrepancyNoteTypeId());
}
dnb.setResolutionStatusId(ResolutionStatus.CLOSED.getId());
dnb.setStudyId(currentStudy.getId());
dnb.setAssignedUserId(ub.getId());
dnb.setOwner(ub);
dnb.setEntityType(DiscrepancyNoteBean.ITEM_DATA);
dnb.setEntityId(item.getId());
dnb.setColumn("value");
dnb.setCreatedDate(new Date());
dnb.setDescription("The item has been removed, this Discrepancy Note has been Closed.");
dnDao.create(dnb);
dnDao.createMapping(dnb);
itemParentNote.setResolutionStatusId(ResolutionStatus.CLOSED.getId());
dnDao.update(itemParentNote);
}
}
}
String emailBody = respage.getString("the_event_CRF") + " " + cb.getName() + " " + respage.getString("has_been_removed_from_the_event") + event.getStudyEventDefinition().getName() + ". " + respage.getString("has_been_removed_from_the_event_cont");
addPageMessage(emailBody);
sendEmail(emailBody);
request.setAttribute("id", new Integer(studySubId).toString());
forwardPage(Page.VIEW_STUDY_SUBJECT_SERVLET);
}
}
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class RestoreSiteServlet method processRequest.
@Override
public void processRequest() throws Exception {
StudyDAO sdao = new StudyDAO(sm.getDataSource());
String idString = request.getParameter("id");
logger.info("site id:" + idString);
int siteId = Integer.valueOf(idString.trim()).intValue();
StudyBean study = (StudyBean) sdao.findByPK(siteId);
// find all user and roles
UserAccountDAO udao = new UserAccountDAO(sm.getDataSource());
ArrayList userRoles = udao.findAllByStudyId(siteId);
// find all subjects
StudySubjectDAO ssdao = new StudySubjectDAO(sm.getDataSource());
ArrayList subjects = ssdao.findAllByStudy(study);
// find all events
StudyEventDefinitionDAO sefdao = new StudyEventDefinitionDAO(sm.getDataSource());
ArrayList definitions = sefdao.findAllByStudy(study);
String action = request.getParameter("action");
if (StringUtil.isBlank(idString)) {
addPageMessage(respage.getString("please_choose_a_site_to_restore"));
forwardPage(Page.SITE_LIST_SERVLET);
} else {
if ("confirm".equalsIgnoreCase(action)) {
// site can be restored when its parent study is not "removed"
// -- YW -6-21-2007
StudyBean parentstudy = (StudyBean) sdao.findByPK(study.getParentStudyId());
if (!"removed".equals(parentstudy.getStatus().getName())) {
request.setAttribute("siteToRestore", study);
request.setAttribute("userRolesToRestore", userRoles);
request.setAttribute("subjectsToRestore", subjects);
// request.setAttribute("definitionsToRestore",
// definitions);
} else {
MessageFormat mf = new MessageFormat("");
mf.applyPattern(respage.getString("choosen_site_cannot_restored"));
Object[] arguments = { study.getName(), parentstudy.getName() };
addPageMessage(mf.format(arguments));
forwardPage(Page.STUDY_LIST_SERVLET);
}
forwardPage(Page.RESTORE_SITE);
} else {
logger.info("submit to restore the site");
// change all statuses to unavailable
StudyDAO studao = new StudyDAO(sm.getDataSource());
study.setStatus(study.getOldStatus());
study.setUpdater(ub);
study.setUpdatedDate(new Date());
studao.update(study);
// restore all users and roles
for (int i = 0; i < userRoles.size(); i++) {
StudyUserRoleBean role = (StudyUserRoleBean) userRoles.get(i);
if (role.getStatus().equals(Status.AUTO_DELETED)) {
role.setStatus(Status.AVAILABLE);
role.setUpdater(ub);
role.setUpdatedDate(new Date());
// YW << So study_user_role table status_id field can be
// updated
udao.updateStudyUserRole(role, role.getUserName());
}
// YW 06-18-2007 >>
}
// study
if (study.getId() == currentStudy.getId()) {
currentStudy.setStatus(Status.AVAILABLE);
StudyUserRoleBean r = (new UserAccountDAO(sm.getDataSource())).findRoleByUserNameAndStudyId(ub.getName(), currentStudy.getId());
StudyUserRoleBean rInParent = (new UserAccountDAO(sm.getDataSource())).findRoleByUserNameAndStudyId(ub.getName(), currentStudy.getParentStudyId());
// according to logic in SecureController.java: inherited
// role from parent study, pick the higher role
currentRole.setRole(Role.max(r.getRole(), rInParent.getRole()));
}
// YW >>
// restore all study_group
StudyGroupDAO sgdao = new StudyGroupDAO(sm.getDataSource());
SubjectGroupMapDAO sgmdao = new SubjectGroupMapDAO(sm.getDataSource());
ArrayList groups = sgdao.findAllByStudy(study);
for (int i = 0; i < groups.size(); i++) {
StudyGroupBean group = (StudyGroupBean) groups.get(i);
if (group.getStatus().equals(Status.AUTO_DELETED)) {
group.setStatus(Status.AVAILABLE);
group.setUpdater(ub);
group.setUpdatedDate(new Date());
sgdao.update(group);
// all subject_group_map
ArrayList subjectGroupMaps = sgmdao.findAllByStudyGroupId(group.getId());
for (int j = 0; j < subjectGroupMaps.size(); j++) {
SubjectGroupMapBean sgMap = (SubjectGroupMapBean) subjectGroupMaps.get(j);
if (sgMap.getStatus().equals(Status.AUTO_DELETED)) {
sgMap.setStatus(Status.AVAILABLE);
sgMap.setUpdater(ub);
sgMap.setUpdatedDate(new Date());
sgmdao.update(sgMap);
}
}
}
}
// restore all events with subjects
EventDefinitionCRFDAO edcdao = new EventDefinitionCRFDAO(sm.getDataSource());
StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
for (int i = 0; i < subjects.size(); i++) {
StudySubjectBean subject = (StudySubjectBean) subjects.get(i);
if (subject.getStatus().equals(Status.AUTO_DELETED)) {
subject.setStatus(Status.AVAILABLE);
subject.setUpdater(ub);
subject.setUpdatedDate(new Date());
ssdao.update(subject);
ArrayList events = sedao.findAllByStudySubject(subject);
EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
for (int j = 0; j < events.size(); j++) {
StudyEventBean event = (StudyEventBean) events.get(j);
if (event.getStatus().equals(Status.AUTO_DELETED)) {
event.setStatus(Status.AVAILABLE);
event.setUpdater(ub);
event.setUpdatedDate(new Date());
sedao.update(event);
ArrayList eventCRFs = ecdao.findAllByStudyEvent(event);
ItemDataDAO iddao = new ItemDataDAO(sm.getDataSource());
for (int k = 0; k < eventCRFs.size(); k++) {
// YW << fix broken page for storing site
EventCRFBean eventCRF = (EventCRFBean) eventCRFs.get(k);
// >> YW
if (eventCRF.getStatus().equals(Status.AUTO_DELETED)) {
eventCRF.setStatus(eventCRF.getOldStatus());
eventCRF.setUpdater(ub);
eventCRF.setUpdatedDate(new Date());
ecdao.update(eventCRF);
ArrayList itemDatas = iddao.findAllByEventCRFId(eventCRF.getId());
for (int a = 0; a < itemDatas.size(); a++) {
ItemDataBean item = (ItemDataBean) itemDatas.get(a);
if (item.getStatus().equals(Status.AUTO_DELETED)) {
item.setStatus(item.getOldStatus());
item.setUpdater(ub);
item.setUpdatedDate(new Date());
iddao.update(item);
}
}
}
}
}
}
}
}
// for subjects
DatasetDAO datadao = new DatasetDAO(sm.getDataSource());
ArrayList dataset = datadao.findAllByStudyId(study.getId());
for (int i = 0; i < dataset.size(); i++) {
DatasetBean data = (DatasetBean) dataset.get(i);
data.setStatus(Status.AVAILABLE);
data.setUpdater(ub);
data.setUpdatedDate(new Date());
datadao.update(data);
}
addPageMessage(respage.getString("this_site_has_been_restored_succesfully"));
String fromListSite = (String) session.getAttribute("fromListSite");
if (fromListSite != null && fromListSite.equals("yes") && currentRole.getRole().equals(Role.STUDYDIRECTOR)) {
session.removeAttribute("fromListSite");
forwardPage(Page.SITE_LIST_SERVLET);
} else {
session.removeAttribute("fromListSite");
if (currentRole.getRole().equals(Role.ADMIN)) {
forwardPage(Page.STUDY_LIST_SERVLET);
} else {
forwardPage(Page.SITE_LIST_SERVLET);
}
}
}
}
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class RestoreStudyEventServlet method getDisplayEventCRFs.
/**
* Each of the event CRFs with its corresponding CRFBean. Then generates a
* list of DisplayEventCRFBeans, one for each event CRF.
*
* @param eventCRFs
* The list of event CRFs for this study event.
* @param eventDefinitionCRFs
* The list of event definition CRFs for this study event.
* @return The list of DisplayEventCRFBeans for this study event.
*/
private ArrayList getDisplayEventCRFs(ArrayList eventCRFs, ArrayList eventDefinitionCRFs) {
ArrayList answer = new ArrayList();
HashMap definitionsById = new HashMap();
int i;
for (i = 0; i < eventDefinitionCRFs.size(); i++) {
EventDefinitionCRFBean edc = (EventDefinitionCRFBean) eventDefinitionCRFs.get(i);
definitionsById.put(new Integer(edc.getStudyEventDefinitionId()), edc);
}
StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
CRFDAO cdao = new CRFDAO(sm.getDataSource());
CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
for (i = 0; i < eventCRFs.size(); i++) {
EventCRFBean ecb = (EventCRFBean) eventCRFs.get(i);
// populate the event CRF with its crf bean
int crfVersionId = ecb.getCRFVersionId();
CRFBean cb = cdao.findByVersionId(crfVersionId);
ecb.setCrf(cb);
CRFVersionBean cvb = (CRFVersionBean) cvdao.findByPK(crfVersionId);
ecb.setCrfVersion(cvb);
// then get the definition so we can call
// DisplayEventCRFBean.setFlags
int studyEventId = ecb.getStudyEventId();
int studyEventDefinitionId = sedao.getDefinitionIdFromStudyEventId(studyEventId);
EventDefinitionCRFBean edc = (EventDefinitionCRFBean) definitionsById.get(new Integer(studyEventDefinitionId));
DisplayEventCRFBean dec = new DisplayEventCRFBean();
dec.setFlags(ecb, ub, currentRole, edc.isDoubleEntry());
answer.add(dec);
}
return answer;
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class AdministrativeEditingServlet method mayProceed.
/*
* (non-Javadoc)
*
* @see org.akaza.openclinica.control.core.SecureController#mayProceed()
*/
@Override
protected void mayProceed(HttpServletRequest request, HttpServletResponse response) throws InsufficientPermissionException {
mayAccess(request);
locale = LocaleResolver.getLocale(request);
HttpSession session = request.getSession();
FormProcessor fp = new FormProcessor(request);
UserAccountBean ub = (UserAccountBean) request.getSession().getAttribute(USER_BEAN_NAME);
StudyUserRoleBean currentRole = (StudyUserRoleBean) request.getSession().getAttribute("userRole");
// <
// resexception=ResourceBundle.getBundle(
// "org.akaza.openclinica.i18n.exceptions",locale);
// < respage =
// ResourceBundle.getBundle("org.akaza.openclinica.i18n.page_messages",
// locale);
getInputBeans(request);
EventCRFBean ecb = (EventCRFBean) request.getAttribute(INPUT_EVENT_CRF);
String fromResolvingNotes = fp.getString("fromResolvingNotes", true);
if (StringUtil.isBlank(fromResolvingNotes)) {
session.removeAttribute(ViewNotesServlet.WIN_LOCATION);
session.removeAttribute(ViewNotesServlet.NOTES_TABLE);
checkStudyLocked(Page.LIST_STUDY_SUBJECTS, respage.getString("current_study_locked"), request, response);
checkStudyFrozen(Page.LIST_STUDY_SUBJECTS, respage.getString("current_study_frozen"), request, response);
}
request.setAttribute("fromResolvingNotes", fromResolvingNotes);
LOGGER.debug(" +++++++++++++++++++ " + ecb.getStudyEventId());
// StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
// StudyEventBean sEvent = (StudyEventBean)
// sedao.findByPK(ecb.getStudyEventId());
// if (sEvent.getSubjectEventStatus().equals(SubjectEventStatus.SIGNED))
// {
// sEvent.setSubjectEventStatus(SubjectEventStatus.COMPLETED);
// sEvent.setUpdater(ub);
// sEvent.setUpdatedDate(new Date());
// sedao.update(sEvent);
// }
DataEntryStage stage = ecb.getStage();
Role r = currentRole.getRole();
session.setAttribute("mayProcessUploading", "true");
if (!SubmitDataServlet.maySubmitData(ub, currentRole)) {
session.setAttribute("mayProcessUploading", "false");
String exceptionName = resexception.getString("no_permission_validation");
String noAccessMessage = respage.getString("not_perform_administrative_editing_CRF");
addPageMessage(noAccessMessage, request);
throw new InsufficientPermissionException(Page.MENU, exceptionName, "1");
}
LOGGER.info("stage name:" + stage.getName());
if (stage.equals(DataEntryStage.DOUBLE_DATA_ENTRY_COMPLETE)) {
// {
if (r.equals(Role.MONITOR)) {
session.setAttribute("mayProcessUploading", "false");
addPageMessage(respage.getString("no_have_correct_privilege_current_study") + respage.getString("change_study_contact_sysadmin"), request);
throw new InsufficientPermissionException(Page.LIST_STUDY_SUBJECTS_SERVLET, resexception.getString("no_permission_administrative_editing"), "1");
}
} else {
session.setAttribute("mayProcessUploading", "false");
addPageMessage(respage.getString("not_perform_administrative_editing_because"), request);
throw new InsufficientPermissionException(Page.LIST_STUDY_SUBJECTS_SERVLET, resexception.getString("not_correct_stage"), "1");
}
return;
}
use of org.akaza.openclinica.bean.submit.EventCRFBean 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());
FormLayoutDAO fldao = new FormLayoutDAO(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.setFormLayout((FormLayoutBean) fldao.findByPK(eventCRF.getFormLayoutId()));
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);
}
}
Aggregations