use of org.akaza.openclinica.bean.core.SubjectEventStatus in project OpenClinica by OpenClinica.
the class ListDiscNotesForCRFTableFactory method singleEventDivBuilder.
private void singleEventDivBuilder(HtmlBuilder eventDiv, SubjectBean subject, Integer rowCount, List<StudyEventBean> studyEvents, StudyEventDefinitionBean sed, StudySubjectBean studySubject) {
String tableHeaderRowLeftStyleClass = "table_header_row_left";
String click_for_more_options = resword.getString("click_for_more_options");
String schedule = resword.getString("schedule");
String view = resword.getString("view") + "/" + resword.getString("enter_data");
String edit = resword.getString("edit");
;
String remove = resword.getString("remove");
;
String subjectText = resword.getString("subject");
;
String eventText = resword.getString("event");
;
SubjectEventStatus eventStatus = studyEvents.size() == 0 ? SubjectEventStatus.NOT_SCHEDULED : studyEvents.get(0).getSubjectEventStatus();
// String studyEventName = studyEvents.size() == 0 ? "" :
// studyEvents.get(0).getName();
String studyEventId = studyEvents.size() == 0 ? "" : String.valueOf(studyEvents.get(0).getId());
Status eventSysStatus = studySubject.getStatus();
String studySubjectLabel = studySubject.getLabel();
eventDiv.td(0).styleClass(tableHeaderRowLeftStyleClass).close();
eventDiv.append(subjectText).append(": ").append(studySubjectLabel).br();
eventDiv.append(eventText).append(": ").append(sed.getName()).br();
eventDiv.append("Status").append(":").append(eventStatus.getName()).br();
eventDiv.tdEnd();
eventDiv.td(0).styleClass(tableHeaderRowLeftStyleClass).align("right").close();
linkBuilder(eventDiv, studySubjectLabel, rowCount, studyEvents, sed);
eventDiv.tdEnd();
eventDiv.trEnd(0);
eventDiv.tr(0).id("Menu_off_" + studySubjectLabel + "_" + sed.getId() + "_" + rowCount).style("display: all").close();
eventDiv.td(0).styleClass("table_cell_left").colspan("2").close().append("<i>").append(click_for_more_options).append("</i>").tdEnd();
eventDiv.trEnd(0);
eventDiv.tr(0).id("Menu_on_" + studySubjectLabel + "_" + sed.getId() + "_" + rowCount).style("display: none").close();
eventDiv.td(0).colspan("2").close();
eventDiv.table(0).border("0").cellpadding("0").cellspacing("0").width("100%").close();
if (eventSysStatus.getId() == Status.AVAILABLE.getId() || eventSysStatus == Status.SIGNED) {
if (eventStatus == SubjectEventStatus.NOT_SCHEDULED && currentRole.getRole() != Role.MONITOR) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
createNewStudyEventLinkBuilder(eventDiv, studySubject.getId(), sed, schedule);
eventDiv.tdEnd().trEnd(0);
} else if (eventStatus == SubjectEventStatus.COMPLETED) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
if ((currentRole.getRole() == Role.STUDYDIRECTOR || currentUser.isSysAdmin()) && studyBean.getStatus() == Status.AVAILABLE) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
updateStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, edit);
eventDiv.tdEnd().trEnd(0);
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
removeStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, remove);
eventDiv.tdEnd().trEnd(0);
}
} else if (eventStatus == SubjectEventStatus.LOCKED) {
eventDiv.tdEnd().trEnd(0);
if (currentRole.getRole() == Role.STUDYDIRECTOR || currentUser.isSysAdmin()) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
if (studyBean.getStatus() == Status.AVAILABLE) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
removeStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, remove);
eventDiv.tdEnd().trEnd(0);
}
}
} else {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
if ((currentRole.getRole() == Role.STUDYDIRECTOR || currentUser.isSysAdmin()) && studyBean.getStatus() == Status.AVAILABLE) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
updateStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, edit);
eventDiv.tdEnd().trEnd(0);
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
removeStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, remove);
eventDiv.tdEnd().trEnd(0);
}
}
}
if (eventSysStatus == Status.DELETED || eventSysStatus == Status.AUTO_DELETED) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
}
eventDiv.tableEnd(0).tdEnd().trEnd(0);
eventDiv.tableEnd(0);
eventDiv.divEnd().divEnd().divEnd().divEnd().divEnd().divEnd().divEnd().divEnd().divEnd().divEnd().divEnd();
iconLinkBuilder(eventDiv, studySubjectLabel, rowCount, studyEvents, sed);
}
use of org.akaza.openclinica.bean.core.SubjectEventStatus in project OpenClinica by OpenClinica.
the class ListStudySubjectTableFactory method linksDivBuilder.
private void linksDivBuilder(HtmlBuilder eventDiv, SubjectBean subject, Integer rowCount, List<StudyEventBean> studyEvents, StudyEventDefinitionBean sed, StudySubjectBean studySubject, StudyEventBean currentEvent) {
Status eventSysStatus = studySubject.getStatus();
SubjectEventStatus eventStatus = currentEvent.getSubjectEventStatus();
String studyEventId = String.valueOf(currentEvent.getId());
String view = resword.getString("view") + "/" + resword.getString("enter_data");
String edit = resword.getString("edit");
String remove = resword.getString("remove");
if (eventSysStatus.getId() == Status.AVAILABLE.getId() || eventSysStatus == Status.SIGNED) {
if (eventStatus == SubjectEventStatus.COMPLETED) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell").close();
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
if ((currentRole.getRole() == Role.STUDYDIRECTOR || currentUser.isSysAdmin()) && studyBean.getStatus() == Status.AVAILABLE) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell").close();
updateStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, edit);
eventDiv.tdEnd().trEnd(0);
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell").close();
removeStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, remove);
eventDiv.tdEnd().trEnd(0);
}
} else if (eventStatus == SubjectEventStatus.LOCKED) {
if (currentRole.getRole() == Role.STUDYDIRECTOR || currentUser.isSysAdmin()) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell").close();
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
if (studyBean.getStatus() == Status.AVAILABLE) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell").close();
removeStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, remove);
eventDiv.tdEnd().trEnd(0);
}
}
} else {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left");
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
if ((currentRole.getRole() == Role.STUDYDIRECTOR || currentUser.isSysAdmin()) && studyBean.getStatus() == Status.AVAILABLE) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
updateStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, edit);
eventDiv.tdEnd().trEnd(0);
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
removeStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, remove);
eventDiv.tdEnd().trEnd(0);
}
}
}
if (eventSysStatus == Status.DELETED || eventSysStatus == Status.AUTO_DELETED) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell").close();
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
}
}
use of org.akaza.openclinica.bean.core.SubjectEventStatus in project OpenClinica by OpenClinica.
the class ListStudySubjectTableFactory method singleEventDivBuilder.
private void singleEventDivBuilder(HtmlBuilder eventDiv, SubjectBean subject, Integer rowCount, List<StudyEventBean> studyEvents, StudyEventDefinitionBean sed, StudySubjectBean studySubject) {
String tableHeaderRowStyleClass = "table_header_row";
String tableHeaderRowLeftStyleClass = "table_header_row_left";
String add_another_occurrence = resword.getString("add_another_occurrence");
String click_for_more_options = resword.getString("click_for_more_options");
String schedule = resword.getString("schedule");
String view = resword.getString("view") + "/" + resword.getString("enter_data");
String edit = resword.getString("edit");
String remove = resword.getString("remove");
String occurrence_x_of = resword.getString("ocurrence");
String subjectText = resword.getString("subject");
String eventText = resword.getString("event");
String status = resword.getString("status");
SubjectEventStatus eventStatus = studyEvents.size() == 0 ? SubjectEventStatus.NOT_SCHEDULED : studyEvents.get(0).getSubjectEventStatus();
String studyEventName = studyEvents.size() == 0 ? "" : studyEvents.get(0).getName();
String studyEventId = studyEvents.size() == 0 ? "" : String.valueOf(studyEvents.get(0).getId());
Status eventSysStatus = studySubject.getStatus();
String studySubjectLabel = studySubject.getLabel();
eventDiv.td(0).styleClass(tableHeaderRowLeftStyleClass).close();
eventDiv.append(subjectText).append(": ").append(studySubjectLabel).br();
eventDiv.append(eventText).append(": ").append(sed.getName()).br();
if (!sed.isRepeating()) {
eventDiv.append(resword.getString("status")).append(":").append(eventStatus.getName()).br();
eventDiv.tdEnd();
eventDiv.td(0).styleClass(tableHeaderRowLeftStyleClass).align("right").close();
linkBuilder(eventDiv, studySubjectLabel, rowCount, studyEvents, sed);
eventDiv.tdEnd();
} else {
eventDiv.tdEnd();
eventDiv.td(0).styleClass(tableHeaderRowLeftStyleClass).align("right").close();
linkBuilder(eventDiv, studySubjectLabel, rowCount, studyEvents, sed);
eventDiv.tdEnd();
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass(tableHeaderRowStyleClass).colspan("2").close();
eventDiv.bold().append(occurrence_x_of).append("#1 of 1").br();
if (studyEvents.size() > 0) {
eventDiv.append(formatDate(studyEvents.get(0).getDateStarted())).br();
eventDiv.append(status + " : " + studyEvents.get(0).getSubjectEventStatus().getName());
} else {
eventDiv.append(status + " : " + SubjectEventStatus.NOT_SCHEDULED.getName());
}
eventDiv.boldEnd().tdEnd().trEnd(0);
if (eventStatus != SubjectEventStatus.NOT_SCHEDULED && eventSysStatus != Status.DELETED && eventSysStatus != Status.AUTO_DELETED) {
eventDiv.tr(0).close().td(0).styleClass("table_cell_left").close();
eventDiv.ahref("CreateNewStudyEvent?studySubjectId=" + studySubject.getId() + "&studyEventDefinition=" + sed.getId(), add_another_occurrence);
eventDiv.tdEnd().trEnd(0);
}
}
eventDiv.trEnd(0);
eventDiv.tr(0).id("Menu_off_" + studySubjectLabel + "_" + sed.getId() + "_" + rowCount).style("display: all").close();
eventDiv.td(0).styleClass("table_cell_left").colspan("2").close().append("<i>").append(click_for_more_options).append("</i>").tdEnd();
eventDiv.trEnd(0);
eventDiv.tr(0).id("Menu_on_" + studySubjectLabel + "_" + sed.getId() + "_" + rowCount).style("display: none").close();
eventDiv.td(0).colspan("2").close();
eventDiv.table(0).border("0").cellpadding("0").cellspacing("0").width("100%").close();
if (eventSysStatus.getId() == Status.AVAILABLE.getId() || eventSysStatus == Status.SIGNED) {
if (eventStatus == SubjectEventStatus.NOT_SCHEDULED && currentRole.getRole() != Role.MONITOR && !studyBean.getStatus().isFrozen()) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
createNewStudyEventLinkBuilder(eventDiv, studySubject.getId(), sed, schedule);
eventDiv.tdEnd().trEnd(0);
} else if (eventStatus == SubjectEventStatus.COMPLETED) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
if ((currentRole.getRole() == Role.STUDYDIRECTOR || currentUser.isSysAdmin()) && studyBean.getStatus() == Status.AVAILABLE) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
updateStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, edit);
eventDiv.tdEnd().trEnd(0);
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
removeStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, remove);
eventDiv.tdEnd().trEnd(0);
}
} else if (eventStatus == SubjectEventStatus.LOCKED) {
eventDiv.tdEnd().trEnd(0);
if (currentRole.getRole() == Role.STUDYDIRECTOR || currentUser.isSysAdmin()) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
if (studyBean.getStatus() == Status.AVAILABLE) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
removeStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, remove);
eventDiv.tdEnd().trEnd(0);
}
}
} else {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left");
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
if ((currentRole.getRole() == Role.STUDYDIRECTOR || currentUser.isSysAdmin()) && studyBean.getStatus() == Status.AVAILABLE) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
updateStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, edit);
eventDiv.tdEnd().trEnd(0);
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
removeStudyEventLinkBuilder(eventDiv, studySubject.getId(), studyEventId, remove);
eventDiv.tdEnd().trEnd(0);
}
}
}
if (eventSysStatus == Status.DELETED || eventSysStatus == Status.AUTO_DELETED) {
eventDiv.tr(0).valign("top").close();
eventDiv.td(0).styleClass("table_cell_left").close();
enterDataForStudyEventLinkBuilder(eventDiv, studyEventId, view);
eventDiv.tdEnd().trEnd(0);
}
eventDiv.tableEnd(0).tdEnd().trEnd(0);
eventDiv.tableEnd(0);
eventDiv.divEnd().divEnd().divEnd().divEnd().divEnd().divEnd().divEnd().divEnd().divEnd().divEnd().divEnd();
iconLinkBuilder(eventDiv, studySubjectLabel, rowCount, studyEvents, sed);
}
use of org.akaza.openclinica.bean.core.SubjectEventStatus in project OpenClinica by OpenClinica.
the class ListStudySubjectTableFactory method setDataAndLimitVariables.
@Override
public void setDataAndLimitVariables(TableFacade tableFacade) {
Limit limit = tableFacade.getLimit();
FindSubjectsFilter subjectFilter = getSubjectFilter(limit);
if (!limit.isComplete()) {
int totalRows = getStudySubjectDAO().getCountWithFilter(subjectFilter, getStudyBean());
tableFacade.setTotalRows(totalRows);
}
FindSubjectsSort subjectSort = getSubjectSort(limit);
int rowStart = limit.getRowSelect().getRowStart();
int rowEnd = limit.getRowSelect().getRowEnd();
Collection<StudySubjectBean> items = getStudySubjectDAO().getWithFilterAndSort(getStudyBean(), subjectFilter, subjectSort, rowStart, rowEnd);
Collection<HashMap<Object, Object>> theItems = new ArrayList<HashMap<Object, Object>>();
for (StudySubjectBean studySubjectBean : items) {
HashMap<Object, Object> theItem = new HashMap<Object, Object>();
theItem.put("studySubject", studySubjectBean);
theItem.put("studySubject.label", studySubjectBean.getLabel());
theItem.put("studySubject.status", studySubjectBean.getStatus());
theItem.put("enrolledAt", ((StudyBean) getStudyDAO().findByPK(studySubjectBean.getStudyId())).getIdentifier());
theItem.put("studySubject.oid", studySubjectBean.getOid());
theItem.put("studySubject.secondaryLabel", studySubjectBean.getSecondaryLabel());
SubjectBean subjectBean = (SubjectBean) getSubjectDAO().findByPK(studySubjectBean.getSubjectId());
theItem.put("subject", subjectBean);
theItem.put("subject.charGender", subjectBean.getGender());
// Get All study events for this study subject and then put list in
// HashMap with study event definition id as
// key and a list of study events as the value.
List<StudyEventBean> allStudyEventsForStudySubject = getStudyEventDAO().findAllByStudySubject(studySubjectBean);
HashMap<Integer, List<StudyEventBean>> allStudyEventsForStudySubjectBySedId = new HashMap<Integer, List<StudyEventBean>>();
theItem.put("isSignable", isSignable(allStudyEventsForStudySubject, studySubjectBean));
for (StudyEventBean studyEventBean : allStudyEventsForStudySubject) {
if (allStudyEventsForStudySubjectBySedId.get(studyEventBean.getStudyEventDefinitionId()) == null) {
ArrayList<StudyEventBean> a = new ArrayList<StudyEventBean>();
a.add(studyEventBean);
allStudyEventsForStudySubjectBySedId.put(studyEventBean.getStudyEventDefinitionId(), a);
} else {
allStudyEventsForStudySubjectBySedId.get(studyEventBean.getStudyEventDefinitionId()).add(studyEventBean);
}
}
SubjectGroupMapBean subjectGroupMapBean;
for (StudyGroupClassBean studyGroupClass : getStudyGroupClasses()) {
subjectGroupMapBean = getSubjectGroupMapDAO().findAllByStudySubjectAndStudyGroupClass(studySubjectBean.getId(), studyGroupClass.getId());
if (null != subjectGroupMapBean) {
theItem.put("sgc_" + studyGroupClass.getId(), subjectGroupMapBean.getStudyGroupId());
theItem.put("grpName_sgc_" + studyGroupClass.getId(), subjectGroupMapBean.getStudyGroupName());
}
}
subjectGroupMapBean = null;
for (StudyEventDefinitionBean studyEventDefinition : getStudyEventDefinitions()) {
List<StudyEventBean> studyEvents = allStudyEventsForStudySubjectBySedId.get(studyEventDefinition.getId());
SubjectEventStatus subjectEventStatus = null;
studyEvents = studyEvents == null ? new ArrayList<StudyEventBean>() : studyEvents;
if (studyEvents.size() < 1) {
subjectEventStatus = SubjectEventStatus.NOT_SCHEDULED;
} else {
for (StudyEventBean studyEventBean : studyEvents) {
if (studyEventBean.getSampleOrdinal() == 1) {
subjectEventStatus = studyEventBean.getSubjectEventStatus();
break;
}
}
}
theItem.put("sed_" + studyEventDefinition.getId(), subjectEventStatus.getId());
theItem.put("sed_" + studyEventDefinition.getId() + "_studyEvents", studyEvents);
theItem.put("sed_" + studyEventDefinition.getId() + "_object", studyEventDefinition);
}
theItems.add(theItem);
}
// Do not forget to set the items back on the tableFacade.
tableFacade.setItems(theItems);
}
use of org.akaza.openclinica.bean.core.SubjectEventStatus in project OpenClinica by OpenClinica.
the class BatchCRFMigrationController method executeMigrationAction.
public void executeMigrationAction(HelperObject helperObject, EventCRFBean eventCRFBean) {
Session session = helperObject.getSession();
EventCrf eventCrf = helperObject.getEventCrfDao().findById(eventCRFBean.getId());
StudyEvent studyEvent = helperObject.getStudyEventDao().findById(eventCRFBean.getStudyEventId());
FormLayout formLayout = helperObject.getFormLayoutDao().findById(helperObject.getTargetCrfVersionBean().getId());
StudySubject studySubject = helperObject.getStudySubjectDao().findById(eventCRFBean.getStudySubjectId());
eventCrf.setSdvStatus(false);
eventCrf.setDateUpdated(new Date());
eventCrf.setSdvUpdateId(helperObject.getUserAccountBean().getId());
eventCrf.setUpdateId(helperObject.getUserAccountBean().getId());
eventCrf.setFormLayout(formLayout);
session.saveOrUpdate(eventCrf);
String status_before_update = null;
SubjectEventStatus eventStatus = null;
if (studySubject.getStatus() == Status.SIGNED) {
status_before_update = auditDao().findLastStatus("study_subject", studySubject.getStudySubjectId(), "8");
if (status_before_update != null && status_before_update.length() == 1) {
int subject_status = Integer.parseInt(status_before_update);
Status status = Status.getByCode(subject_status);
studySubject.setStatus(status);
}
studySubject.setUpdateId(helperObject.getUserAccountBean().getId());
session.saveOrUpdate(studySubject);
}
studyEvent.setUpdateId(helperObject.getUserAccountBean().getId());
studyEvent.setDateUpdated(new Date());
status_before_update = auditDao().findLastStatus("study_event", studyEvent.getStudyEventId(), "8");
if (status_before_update != null && status_before_update.length() == 1) {
int status = Integer.parseInt(status_before_update);
eventStatus = SubjectEventStatus.get(status);
studyEvent.setSubjectEventStatusId(eventStatus.getId());
}
session.saveOrUpdate(studyEvent);
}
Aggregations