use of org.akaza.openclinica.dao.submit.SubjectDAO in project OpenClinica by OpenClinica.
the class PrintDataEntryServlet method processRequest.
@Override
public void processRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
FormProcessor fp = new FormProcessor(request);
boolean isSubmitted = false;
int eventCRFId = fp.getInt("ecId");
// JN:The following were the the global variables, moved as local.
EventCRFBean ecb;
SectionDAO sdao = new SectionDAO(getDataSource());
ArrayList<SectionBean> allSectionBeans = new ArrayList<SectionBean>();
ArrayList sectionBeans = new ArrayList();
String age = "";
StudyBean currentStudy = (StudyBean) request.getSession().getAttribute("study");
SectionBean sb = (SectionBean) request.getAttribute(SECTION_BEAN);
// Whether IE6 or IE7 is involved
String isIE = fp.getString("ie");
if ("y".equalsIgnoreCase(isIE)) {
request.setAttribute("isInternetExplorer", "true");
}
if (eventCRFId == 0) {
ecb = new EventCRFBean();
// super.ecb.setCRFVersionId(sb.getCRFVersionId());
} else {
EventCRFDAO ecdao = new EventCRFDAO(getDataSource());
ecb = (EventCRFBean) ecdao.findByPK(eventCRFId);
// Get all the SectionBeans attached to this ECB
ArrayList sects = sdao.findAllByCRFVersionId(ecb.getCRFVersionId());
for (int i = 0; i < sects.size(); i++) {
sb = (SectionBean) sects.get(i);
// super.sb = sb;
int sectId = sb.getId();
if (sectId > 0) {
allSectionBeans.add((SectionBean) sdao.findByPK(sectId));
}
}
// This is the StudySubjectBean
StudySubjectDAO ssdao = new StudySubjectDAO(getDataSource());
StudySubjectBean sub = (StudySubjectBean) ssdao.findByPK(ecb.getStudySubjectId());
// This is the SubjectBean
SubjectDAO subjectDao = new SubjectDAO(getDataSource());
int subjectId = sub.getSubjectId();
int studyId = sub.getStudyId();
SubjectBean subject = (SubjectBean) subjectDao.findByPK(subjectId);
StudyEventDAO sedao = new StudyEventDAO(getDataSource());
StudyEventBean se = (StudyEventBean) sedao.findByPK(ecb.getStudyEventId());
StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(getDataSource());
StudyEventDefinitionBean sed = (StudyEventDefinitionBean) seddao.findByPK(se.getStudyEventDefinitionId());
se.setStudyEventDefinition(sed);
// Let us process the age
if (currentStudy.getStudyParameterConfig().getCollectDob().equals("1")) {
// YW 11-16-2007 enrollment-date is used for computing age
age = Utils.getInstacne().processAge(sub.getEnrollmentDate(), subject.getDateOfBirth());
}
// Get the study then the parent study
StudyDAO studydao = new StudyDAO(getDataSource());
StudyBean study = (StudyBean) studydao.findByPK(studyId);
if (study.getParentStudyId() > 0) {
// this is a site,find parent
StudyBean parentStudy = (StudyBean) studydao.findByPK(study.getParentStudyId());
request.setAttribute("studyTitle", parentStudy.getName() + " - " + study.getName());
} else {
request.setAttribute("studyTitle", study.getName());
}
request.setAttribute("studySubject", sub);
request.setAttribute("subject", subject);
request.setAttribute("studyEvent", se);
request.setAttribute("age", age);
request.setAttribute(INPUT_EVENT_CRF, ecb);
request.setAttribute(SECTION_BEAN, sb);
request.setAttribute(ALL_SECTION_BEANS, allSectionBeans);
// Get the section beans from super
sectionBeans = super.getAllDisplayBeans(request);
}
// Find out whether the sections involve groups
ItemGroupDAO itemGroupDao = new ItemGroupDAO(getDataSource());
// Find truely grouped tables, not groups with a name of 'Ungrouped'
// CRF VERSION ID WILL BE 0 IF "ecId" IS NOT IN THE QUERYSTRING
int crfVersionId = ecb.getCRFVersionId();
List<ItemGroupBean> itemGroupBeans = itemGroupDao.findOnlyGroupsByCRFVersionID(crfVersionId);
boolean sectionsHaveGroups = false;
if (itemGroupBeans.size() > 0) {
sectionsHaveGroups = true;
// get a DisplaySectionBean for each section of the CRF, sort them,
// then
// dispatch the request to a print JSP. the constructor for this
// handler takes
// a boolean value depending on whether an event or data is involved
// or not
DisplaySectionBeanHandler handler = new DisplaySectionBeanHandler(true, getDataSource(), getServletContext());
handler.setCrfVersionId(crfVersionId);
handler.setEventCRFId(eventCRFId);
List<DisplaySectionBean> displaySectionBeans = handler.getDisplaySectionBeans();
CRFVersionDAO crfVersionDAO = new CRFVersionDAO(getDataSource());
CRFDAO crfDao = new CRFDAO(getDataSource());
request.setAttribute("listOfDisplaySectionBeans", displaySectionBeans);
// Make available the CRF names and versions for
// the web page's header
CRFVersionBean crfverBean = (CRFVersionBean) crfVersionDAO.findByPK(crfVersionId);
request.setAttribute("crfVersionBean", crfverBean);
CRFBean crfBean = crfDao.findByVersionId(crfVersionId);
request.setAttribute("crfBean", crfBean);
// Set an attribute signaling that an event and/or data is involved
request.setAttribute("dataInvolved", "true");
}
request.setAttribute(BEAN_ANNOTATIONS, ecb.getAnnotations());
request.setAttribute("EventCRFBean", ecb);
// We do not need most of these attributes if groups are involved
if (!sectionsHaveGroups) {
request.setAttribute(INPUT_EVENT_CRF, ecb);
request.setAttribute(SECTION_BEAN, sb);
DisplaySectionBean dsb = super.getDisplayBean(false, false, request, isSubmitted);
request.setAttribute("allSections", sectionBeans);
request.setAttribute("displayAll", "1");
request.setAttribute(BEAN_DISPLAY, dsb);
request.setAttribute("sec", sb);
forwardPage(Page.VIEW_SECTION_DATA_ENTRY_PRINT, request, response);
} else {
// end if(! sectionsHaveGroups)
forwardPage(Page.VIEW_SECTION_DATA_ENTRY_PRINT_GROUPS, request, response);
}
}
use of org.akaza.openclinica.dao.submit.SubjectDAO in project OpenClinica by OpenClinica.
the class ReassignStudySubjectServlet method processRequest.
@Override
public void processRequest() throws Exception {
String action = request.getParameter("action");
StudyDAO sdao = new StudyDAO(sm.getDataSource());
StudySubjectDAO ssdao = new StudySubjectDAO(sm.getDataSource());
SubjectDAO subdao = new SubjectDAO(sm.getDataSource());
FormProcessor fp = new FormProcessor(request);
int studySubId = fp.getInt("id");
if (studySubId == 0) {
addPageMessage(respage.getString("please_choose_a_subject_to_reassign"));
forwardPage(Page.LIST_STUDY_SUBJECTS_SERVLET);
return;
} else {
StudySubjectBean studySub = (StudySubjectBean) ssdao.findByPK(studySubId);
int subjectId = studySub.getSubjectId();
request.setAttribute("studySub", studySub);
SubjectBean subject = (SubjectBean) subdao.findByPK(subjectId);
request.setAttribute("subject", subject);
SubjectGroupMapDAO sgmdao = new SubjectGroupMapDAO(sm.getDataSource());
ArrayList groupMaps = (ArrayList) sgmdao.findAllByStudySubject(studySubId);
if (StringUtil.isBlank(action)) {
ArrayList studies = null;
DisplayStudyBean displayStudy = new DisplayStudyBean();
StudyBean study = (StudyBean) sdao.findByPK(studySub.getStudyId());
if (study.getParentStudyId() > 0) {
// current in site
studies = (ArrayList) sdao.findAllByParent(study.getParentStudyId());
StudyBean parent = (StudyBean) sdao.findByPK(study.getParentStudyId());
displayStudy.setParent(parent);
// studies.add(parent);
displayStudy.setChildren(studies);
} else {
studies = (ArrayList) sdao.findAllByParent(study.getId());
displayStudy.setParent(study);
displayStudy.setChildren(studies);
// studies.add(study);
}
// request.setAttribute("studies", studies);
request.setAttribute("displayStudy", displayStudy);
forwardPage(Page.REASSIGN_STUDY_SUBJECT);
} else {
int studyId = fp.getInt("studyId");
if (studyId == 0) {
addPageMessage(respage.getString("please_choose_a_study_site_to_reassign_the_subject"));
forwardPage(Page.REASSIGN_STUDY_SUBJECT);
return;
}
StudyBean st = (StudyBean) sdao.findByPK(studyId);
if ("confirm".equalsIgnoreCase(action)) {
StudySubjectBean sub1 = (StudySubjectBean) ssdao.findAnotherBySameLabel(studySub.getLabel(), studyId, studySub.getId());
if (sub1.getId() > 0) {
addPageMessage(respage.getString("the_study_subject_ID_used_by_another_in_study_site"));
forwardPage(Page.REASSIGN_STUDY_SUBJECT);
return;
}
// YW << comment out this message
// if (groupMaps.size() > 0) {
// addPageMessage("Warning: This subject has Group data
// assoicated with current study,"
// + "the group data will be lost if it is reassigned to
// another study.");
// }
// YW >>
request.setAttribute("newStudy", st);
forwardPage(Page.REASSIGN_STUDY_SUBJECT_CONFIRM);
} else {
logger.info("submit to reassign the subject");
studySub.setUpdatedDate(new Date());
studySub.setUpdater(ub);
studySub.setStudyId(studyId);
ssdao.update(studySub);
for (int i = 0; i < groupMaps.size(); i++) {
SubjectGroupMapBean sgm = (SubjectGroupMapBean) groupMaps.get(i);
sgm.setUpdatedDate(new Date());
sgm.setUpdater(ub);
sgm.setStatus(Status.DELETED);
sgmdao.update(sgm);
}
MessageFormat mf = new MessageFormat("");
mf.applyPattern(respage.getString("subject_reassigned"));
Object[] arguments = { studySub.getLabel(), st.getName() };
addPageMessage(mf.format(arguments));
forwardPage(Page.LIST_STUDY_SUBJECTS_SERVLET);
}
}
}
}
use of org.akaza.openclinica.dao.submit.SubjectDAO in project OpenClinica by OpenClinica.
the class UpdateStudySubjectServlet method processRequest.
@Override
public void processRequest() throws Exception {
FormDiscrepancyNotes discNotes = null;
SubjectDAO sdao = new SubjectDAO(sm.getDataSource());
StudySubjectDAO subdao = new StudySubjectDAO(sm.getDataSource());
FormProcessor fp = new FormProcessor(request);
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_SERVLET, respage.getString("current_study_locked"));
checkStudyFrozen(Page.LIST_STUDY_SUBJECTS_SERVLET, respage.getString("current_study_frozen"));
}
// studySubjectId
int studySubId = fp.getInt("id", true);
if (studySubId == 0) {
addPageMessage(respage.getString("please_choose_study_subject_to_edit"));
forwardPage(Page.LIST_STUDY_SUBJECTS);
} else {
String action = fp.getString("action", true);
if (StringUtil.isBlank(action)) {
addPageMessage(respage.getString("no_action_specified"));
forwardPage(Page.LIST_STUDY_SUBJECTS);
return;
}
StudySubjectBean sub = (StudySubjectBean) subdao.findByPK(studySubId);
StudyGroupClassDAO sgcdao = new StudyGroupClassDAO(sm.getDataSource());
StudyGroupDAO sgdao = new StudyGroupDAO(sm.getDataSource());
SubjectGroupMapDAO sgmdao = new SubjectGroupMapDAO(sm.getDataSource());
ArrayList groupMaps = (ArrayList) sgmdao.findAllByStudySubject(studySubId);
HashMap gMaps = new HashMap();
for (int i = 0; i < groupMaps.size(); i++) {
SubjectGroupMapBean groupMap = (SubjectGroupMapBean) groupMaps.get(i);
gMaps.put(new Integer(groupMap.getStudyGroupClassId()), groupMap);
}
StudyDAO stdao = new StudyDAO(sm.getDataSource());
ArrayList classes = new ArrayList();
if (!"submit".equalsIgnoreCase(action)) {
// YW <<
int parentStudyId = currentStudy.getParentStudyId();
if (parentStudyId > 0) {
StudyBean parentStudy = (StudyBean) stdao.findByPK(parentStudyId);
classes = sgcdao.findAllActiveByStudy(parentStudy);
} else {
classes = sgcdao.findAllActiveByStudy(currentStudy);
}
// YW >>
for (int i = 0; i < classes.size(); i++) {
StudyGroupClassBean group = (StudyGroupClassBean) classes.get(i);
ArrayList studyGroups = sgdao.findAllByGroupClass(group);
group.setStudyGroups(studyGroups);
SubjectGroupMapBean gMap = (SubjectGroupMapBean) gMaps.get(new Integer(group.getId()));
if (gMap != null) {
group.setStudyGroupId(gMap.getStudyGroupId());
group.setGroupNotes(gMap.getNotes());
}
}
session.setAttribute("groups", classes);
}
if ("show".equalsIgnoreCase(action)) {
session.setAttribute("studySub", sub);
// below added tbh 092007
String enrollDateStr = sub.getEnrollmentDate() != null ? local_df.format(sub.getEnrollmentDate()) : "";
session.setAttribute("enrollDateStr", enrollDateStr);
// above added tbh 092007
discNotes = new FormDiscrepancyNotes();
session.setAttribute(AddNewSubjectServlet.FORM_DISCREPANCY_NOTES_NAME, discNotes);
forwardPage(Page.UPDATE_STUDY_SUBJECT);
} else if ("confirm".equalsIgnoreCase(action)) {
confirm(sgdao);
} else if ("submit".equalsIgnoreCase(action)) {
// submit to DB
StudySubjectBean subject = (StudySubjectBean) session.getAttribute("studySub");
subject.setUpdater(ub);
subdao.update(subject);
// save discrepancy notes into DB
FormDiscrepancyNotes fdn = (FormDiscrepancyNotes) session.getAttribute(AddNewSubjectServlet.FORM_DISCREPANCY_NOTES_NAME);
DiscrepancyNoteDAO dndao = new DiscrepancyNoteDAO(sm.getDataSource());
AddNewSubjectServlet.saveFieldNotes("enrollmentDate", fdn, dndao, subject.getId(), "studySub", currentStudy);
ArrayList groups = (ArrayList) session.getAttribute("groups");
if (!groups.isEmpty()) {
for (int i = 0; i < groups.size(); i++) {
StudyGroupClassBean sgc = (StudyGroupClassBean) groups.get(i);
/*We will be allowing users to remove a subject from all groups. Issue-4524*/
if (sgc.getStudyGroupId() == 0) {
Collection subjectGroups = sgmdao.findAllByStudySubject(subject.getId());
for (Iterator it = subjectGroups.iterator(); it.hasNext(); ) {
sgmdao.deleteTestGroupMap(((SubjectGroupMapBean) it.next()).getId());
}
} else {
SubjectGroupMapBean sgm = new SubjectGroupMapBean();
SubjectGroupMapBean gMap = (SubjectGroupMapBean) gMaps.get(new Integer(sgc.getId()));
sgm.setStudyGroupId(sgc.getStudyGroupId());
sgm.setNotes(sgc.getGroupNotes());
sgm.setStudyGroupClassId(sgc.getId());
sgm.setStudySubjectId(subject.getId());
sgm.setStatus(Status.AVAILABLE);
if (sgm.getStudyGroupId() > 0) {
if (gMap != null && gMap.getId() > 0) {
sgm.setUpdater(ub);
sgm.setId(gMap.getId());
sgmdao.update(sgm);
} else {
sgm.setOwner(ub);
sgmdao.create(sgm);
}
}
}
}
}
addPageMessage(respage.getString("study_subject_updated_succesfully"));
session.removeAttribute("studySub");
session.removeAttribute("groups");
session.removeAttribute("enrollDateStr");
session.removeAttribute(AddNewSubjectServlet.FORM_DISCREPANCY_NOTES_NAME);
request.setAttribute("id", new Integer(studySubId).toString());
forwardPage(Page.VIEW_STUDY_SUBJECT_SERVLET);
} else {
addPageMessage(respage.getString("no_action_specified"));
forwardPage(Page.LIST_STUDY_SUBJECTS);
return;
}
}
}
use of org.akaza.openclinica.dao.submit.SubjectDAO in project OpenClinica by OpenClinica.
the class RestoreStudySubjectServlet method processRequest.
@Override
public void processRequest() throws Exception {
// studySubjectId
String studySubIdString = request.getParameter("id");
String subIdString = request.getParameter("subjectId");
String studyIdString = request.getParameter("studyId");
SubjectDAO sdao = new SubjectDAO(sm.getDataSource());
StudySubjectDAO subdao = new StudySubjectDAO(sm.getDataSource());
if (StringUtil.isBlank(studySubIdString) || StringUtil.isBlank(subIdString) || StringUtil.isBlank(studyIdString)) {
addPageMessage(respage.getString("please_choose_study_subject_to_restore"));
forwardPage(Page.LIST_STUDY_SUBJECTS_SERVLET);
} else {
int studyId = Integer.valueOf(studyIdString.trim()).intValue();
int studySubId = Integer.valueOf(studySubIdString.trim()).intValue();
int subjectId = Integer.valueOf(subIdString.trim()).intValue();
SubjectBean subject = (SubjectBean) sdao.findByPK(subjectId);
StudySubjectBean studySub = (StudySubjectBean) subdao.findByPK(studySubId);
StudyDAO studydao = new StudyDAO(sm.getDataSource());
StudyBean study = (StudyBean) studydao.findByPK(studyId);
// find study events
StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
// ArrayList events = sedao.findAllByStudyAndStudySubjectId(study, studySubId);
ArrayList<DisplayStudyEventBean> displayEvents = ViewStudySubjectServlet.getDisplayStudyEventsForStudySubject(studySub, sm.getDataSource(), ub, currentRole);
String action = request.getParameter("action");
if ("confirm".equalsIgnoreCase(action)) {
if (studySub.getStatus().equals(Status.AVAILABLE)) {
addPageMessage(respage.getString("this_subject_is_already_available_for_study") + " " + respage.getString("please_contact_sysadmin_for_more_information"));
forwardPage(Page.LIST_STUDY_SUBJECTS_SERVLET);
return;
}
request.setAttribute("subject", subject);
request.setAttribute("study", study);
request.setAttribute("studySub", studySub);
request.setAttribute("events", displayEvents);
forwardPage(Page.RESTORE_STUDY_SUBJECT);
} else {
logger.info("submit to restore the subject from study");
// restore subject from study
studySub.setStatus(Status.AVAILABLE);
studySub.setUpdater(ub);
studySub.setUpdatedDate(new Date());
subdao.update(studySub);
// restore all study events
// restore all event crfs
EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
for (int j = 0; j < displayEvents.size(); j++) {
DisplayStudyEventBean dispEvent = displayEvents.get(j);
StudyEventBean event = dispEvent.getStudyEvent();
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++) {
EventCRFBean eventCRF = (EventCRFBean) eventCRFs.get(k);
if (eventCRF.getStatus().equals(Status.AUTO_DELETED)) {
eventCRF.setStatus(Status.AVAILABLE);
eventCRF.setUpdater(ub);
eventCRF.setUpdatedDate(new Date());
ecdao.update(eventCRF);
// remove all the item data
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(Status.AVAILABLE);
item.setUpdater(ub);
item.setUpdatedDate(new Date());
iddao.update(item);
}
}
}
}
}
String emailBody = respage.getString("the_subject") + " " + subject.getName() + " " + respage.getString("has_been_restored_to_the_study") + " " + study.getName() + ".";
addPageMessage(emailBody);
// try{
// sendEmail(emailBody);
// }catch (Exception ex){
// addPageMessage(respage.getString("mail_cannot_be_sent_to_admin"));
// }
forwardPage(Page.LIST_STUDY_SUBJECTS_SERVLET);
}
}
}
use of org.akaza.openclinica.dao.submit.SubjectDAO in project OpenClinica by OpenClinica.
the class RemoveStudySubjectServlet method processRequest.
@Override
public void processRequest() throws Exception {
// studySubjectId
String studySubIdString = request.getParameter("id");
String subIdString = request.getParameter("subjectId");
String studyIdString = request.getParameter("studyId");
SubjectDAO sdao = new SubjectDAO(sm.getDataSource());
StudySubjectDAO subdao = new StudySubjectDAO(sm.getDataSource());
if (StringUtil.isBlank(studySubIdString) || StringUtil.isBlank(subIdString) || StringUtil.isBlank(studyIdString)) {
addPageMessage(respage.getString("please_choose_a_study_subject_to_remove"));
forwardPage(Page.LIST_STUDY_SUBJECTS_SERVLET);
} else {
int studyId = Integer.valueOf(studyIdString.trim()).intValue();
int studySubId = Integer.valueOf(studySubIdString.trim()).intValue();
int subjectId = Integer.valueOf(subIdString.trim()).intValue();
SubjectBean subject = (SubjectBean) sdao.findByPK(subjectId);
StudySubjectBean studySub = (StudySubjectBean) subdao.findByPK(studySubId);
StudyDAO studydao = new StudyDAO(sm.getDataSource());
StudyBean study = (StudyBean) studydao.findByPK(studyId);
checkRoleByUserAndStudy(ub, study.getParentStudyId(), study.getId());
// find study events
StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
// ArrayList events = sedao.findAllByStudyAndStudySubjectId(study, studySubId);
ArrayList<DisplayStudyEventBean> displayEvents = ViewStudySubjectServlet.getDisplayStudyEventsForStudySubject(studySub, sm.getDataSource(), ub, currentRole);
String action = request.getParameter("action");
if ("confirm".equalsIgnoreCase(action)) {
if (!studySub.getStatus().equals(Status.AVAILABLE)) {
addPageMessage(respage.getString("this_subject_is_not_available_for_this_study") + " " + respage.getString("please_contact_sysadmin_for_more_information"));
forwardPage(Page.LIST_STUDY_SUBJECTS_SERVLET);
return;
}
request.setAttribute("subject", subject);
request.setAttribute("study", study);
request.setAttribute("studySub", studySub);
request.setAttribute("events", displayEvents);
forwardPage(Page.REMOVE_STUDY_SUBJECT);
} else {
logger.info("submit to remove the subject from study");
// remove subject from study
studySub.setStatus(Status.DELETED);
studySub.setUpdater(ub);
studySub.setUpdatedDate(new Date());
subdao.update(studySub);
// remove all study events
// remove all event crfs
EventCRFDAO ecdao = new EventCRFDAO(sm.getDataSource());
for (int j = 0; j < displayEvents.size(); j++) {
DisplayStudyEventBean dispEvent = displayEvents.get(j);
StudyEventBean event = dispEvent.getStudyEvent();
if (!event.getStatus().equals(Status.DELETED)) {
event.setStatus(Status.AUTO_DELETED);
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++) {
EventCRFBean eventCRF = (EventCRFBean) eventCRFs.get(k);
if (!eventCRF.getStatus().equals(Status.DELETED)) {
eventCRF.setStatus(Status.AUTO_DELETED);
eventCRF.setUpdater(ub);
eventCRF.setUpdatedDate(new Date());
ecdao.update(eventCRF);
// remove all the item data
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.DELETED)) {
item.setStatus(Status.AUTO_DELETED);
item.setUpdater(ub);
item.setUpdatedDate(new Date());
iddao.update(item);
}
}
}
}
}
}
String emailBody = respage.getString("the_subject") + " " + subject.getName() + " " + respage.getString("has_been_removed_from_the_study") + study.getName() + ".";
addPageMessage(emailBody);
// try{
// sendEmail(emailBody);
// }catch(Exception ex){
// addPageMessage(respage.getString("mail_cannot_be_sent_to_admin"));
// }
forwardPage(Page.LIST_STUDY_SUBJECTS_SERVLET);
}
}
}
Aggregations