use of org.akaza.openclinica.domain.SourceDataVerification in project OpenClinica by OpenClinica.
the class SDVUtil method prepareSDVSelectElements.
public void prepareSDVSelectElements(HttpServletRequest request, StudyBean studyBean) {
// Study event statuses
List<String> studyEventStatuses = new ArrayList<String>();
for (org.akaza.openclinica.domain.Status stat : org.akaza.openclinica.domain.Status.values()) {
studyEventStatuses.add(stat.getDescription());
}
request.setAttribute("studyEventStatuses", studyEventStatuses);
// SDV requirements
List<String> sdvRequirements = new ArrayList<String>();
for (SourceDataVerification sdvRequire : SourceDataVerification.values()) {
sdvRequirements.add(sdvRequire.getDescription());
}
request.setAttribute("sdvRequirements", SourceDataVerification.values());
// study event definitions
StudyEventDefinitionDAO studyEventDefinitionDAO = new StudyEventDefinitionDAO(dataSource);
List<StudyEventDefinitionBean> studyEventDefinitionBeans = new ArrayList<StudyEventDefinitionBean>();
studyEventDefinitionBeans = studyEventDefinitionDAO.findAllByStudy(studyBean);
request.setAttribute("studyEventDefinitions", studyEventDefinitionBeans);
// study event status
request.setAttribute("studyEventStatuses", Status.toArrayList());
// event CRF status
request.setAttribute("eventCRFDStatuses", SubjectEventStatus.toArrayList());
StudyEventDAO studyEventDAO = new StudyEventDAO(dataSource);
List<StudyEventBean> studyEventBeans = studyEventDAO.findAllByStudy(studyBean);
List<EventCRFBean> eventCRFBeans = getAllEventCRFs(studyEventBeans);
SortedSet<String> eventCRFNames = new TreeSet<String>();
for (EventCRFBean bean : eventCRFBeans) {
eventCRFNames.add(getCRFName(bean.getCRFVersionId()));
}
request.setAttribute("eventCRFNames", eventCRFNames);
}
use of org.akaza.openclinica.domain.SourceDataVerification in project OpenClinica by OpenClinica.
the class SDVRequirementFilter method getOptions.
@Override
protected List<Option> getOptions() {
List<Option> options = new ArrayList<Option>();
String optionA = SourceDataVerification.AllREQUIRED.toString() + " & " + SourceDataVerification.PARTIALREQUIRED.toString();
options.add(new Option(optionA, optionA));
for (SourceDataVerification sdv : SourceDataVerification.values()) {
if (sdv != SourceDataVerification.NOTAPPLICABLE) {
options.add(new Option(sdv.toString(), sdv.toString()));
}
}
return options;
}
use of org.akaza.openclinica.domain.SourceDataVerification in project OpenClinica by OpenClinica.
the class SDVUtil method getSubjectRows.
/*
* Generate the rows for the study table. Each row represents an Event CRF.
*/
public Collection<SubjectSDVContainer> getSubjectRows(List<EventCRFBean> eventCRFBeans, HttpServletRequest request) {
if (eventCRFBeans == null || eventCRFBeans.isEmpty()) {
return new ArrayList<SubjectSDVContainer>();
}
getEventNamesForEventCRFs(eventCRFBeans);
StudySubjectDAO studySubjectDAO = new StudySubjectDAO(dataSource);
SubjectDAO subjectDAO = new SubjectDAO(dataSource);
StudyDAO studyDAO = new StudyDAO(dataSource);
StudyEventDAO studyEventDAO = new StudyEventDAO(dataSource);
EventDefinitionCRFDAO eventDefinitionCRFDAO = new EventDefinitionCRFDAO(dataSource);
StudySubjectBean studySubjectBean = null;
SubjectBean subjectBean = null;
StudyEventBean studyEventBean = null;
StudyBean studyBean = null;
EventDefinitionCRFBean eventDefinitionCRFBean = null;
Collection<SubjectSDVContainer> allRows = new ArrayList<SubjectSDVContainer>();
SubjectSDVContainer tempSDVBean = null;
StringBuilder actions = new StringBuilder("");
for (EventCRFBean crfBean : eventCRFBeans) {
tempSDVBean = new SubjectSDVContainer();
studySubjectBean = (StudySubjectBean) studySubjectDAO.findByPK(crfBean.getStudySubjectId());
studyEventBean = (StudyEventBean) studyEventDAO.findByPK(crfBean.getStudyEventId());
subjectBean = (SubjectBean) subjectDAO.findByPK(studySubjectBean.getSubjectId());
// find out the study's identifier
studyBean = (StudyBean) studyDAO.findByPK(studySubjectBean.getStudyId());
tempSDVBean.setStudyIdentifier(studyBean.getIdentifier());
eventDefinitionCRFBean = eventDefinitionCRFDAO.findByStudyEventIdAndCRFVersionId(studyBean, studyEventBean.getId(), crfBean.getCRFVersionId());
SourceDataVerification sourceData = eventDefinitionCRFBean.getSourceDataVerification();
if (sourceData != null) {
tempSDVBean.setSdvRequirementDefinition(sourceData.toString());
} else {
tempSDVBean.setSdvRequirementDefinition("");
}
tempSDVBean.setCrfNameVersion(getCRFName(crfBean.getCRFVersionId()) + "/ " + getCRFVersionName(crfBean.getCRFVersionId()));
if (crfBean.getStatus() != null) {
Integer status = crfBean.getStage().getId();
if (studyEventBean.getSubjectEventStatus() == SubjectEventStatus.LOCKED || studyEventBean.getSubjectEventStatus() == SubjectEventStatus.STOPPED || studyEventBean.getSubjectEventStatus() == SubjectEventStatus.SKIPPED) {
status = DataEntryStage.LOCKED.getId();
}
tempSDVBean.setCrfStatus(getCRFStatusIconPath(status, request, studySubjectBean.getId(), crfBean.getId(), crfBean.getCRFVersionId()));
}
tempSDVBean.setStudyEventStatus(studyEventBean.getStatus().getName());
// TODO: I18N Date must be formatted properly
Locale locale = LocaleResolver.getLocale(request);
SimpleDateFormat sdformat = I18nFormatUtil.getDateFormat(locale);
if (studySubjectBean.getEnrollmentDate() != null) {
tempSDVBean.setEnrollmentDate(sdformat.format(studySubjectBean.getEnrollmentDate()));
} else {
// tempSDVBean.setEnrollmentDate("unknown");
}
// TODO: I18N Date must be formatted properly
// Fix OC 1888
StudyEventDAO sedao = new StudyEventDAO(dataSource);
StudyEventBean seBean = (StudyEventBean) sedao.findByPK(crfBean.getStudyEventId());
tempSDVBean.setEventDate(sdformat.format(seBean.getDateStarted()));
// if (crfBean.getCreatedDate() != null) {
// tempSDVBean.setEventDate(sdformat.format(crfBean.getCreatedDate()));
// } else {
// //tempSDVBean.setEventDate("unknown");
//
// }
// crfBean.getEventName()
tempSDVBean.setEventName(crfBean.getEventName());
// The checkbox is next to the study subject id
StringBuilder sdvStatus = new StringBuilder("");
// to cancel this transaction."
if (crfBean.isSdvStatus() && studyBean.getStatus().isLocked()) {
sdvStatus.append(getIconForSdvStatusPrefix()).append("DoubleCheck").append(ICON_FORCRFSTATUS_SUFFIX).append("</a></center>");
} else if (crfBean.isSdvStatus() && !studyBean.getStatus().isLocked()) {
sdvStatus.append("<center><a href='javascript:void(0)' onclick='prompt(document.sdvForm,");
sdvStatus.append(crfBean.getId());
sdvStatus.append(")'>");
sdvStatus.append(getIconForSdvStatusPrefix()).append("DoubleCheck").append(ICON_FORCRFSTATUS_SUFFIX).append("</a></center>");
} else {
sdvStatus.append("<center><input style='margin-right: 5px' type='checkbox' ").append("class='sdvCheck'").append(" name='").append(CHECKBOX_NAME).append(crfBean.getId()).append("' /></center>");
}
// sdvStatus.append(studySubjectBean.getLabel());
tempSDVBean.setSdvStatus(sdvStatus.toString());
tempSDVBean.setStudySubjectId(studySubjectBean.getLabel());
if (subjectBean != null) {
tempSDVBean.setPersonId(subjectBean.getUniqueIdentifier());
} else {
tempSDVBean.setPersonId("");
}
// studySubjectBean.getSecondaryLabel()
tempSDVBean.setSecondaryId(studySubjectBean.getSecondaryLabel());
String statusName = studySubjectBean.getStatus().getName();
int statusId = studySubjectBean.getStatus().getId();
if (statusName != null) {
tempSDVBean.setStudySubjectStatus(statusName);
}
// TODO: I18N Date must be formatted properly
if (crfBean.getUpdatedDate() != null) {
tempSDVBean.setLastUpdatedDate(sdformat.format(crfBean.getUpdatedDate()));
} else {
tempSDVBean.setLastUpdatedDate("unknown");
}
if (crfBean.getUpdater() != null) {
tempSDVBean.setLastUpdatedBy(crfBean.getUpdater().getFirstName() + " " + crfBean.getUpdater().getLastName());
}
actions = new StringBuilder("");
// append("<input type='hidden' name='crfId' value='").append(crfBean.getId()).append("'").append("/> ")
if (!crfBean.isSdvStatus()) {
StringBuilder jsCodeString = new StringBuilder("this.form.method='GET'; this.form.action='").append(request.getContextPath()).append("/pages/handleSDVGet").append("';").append("this.form.crfId.value='").append(crfBean.getId()).append("';").append("this.form.submit();");
if (!studyBean.getStatus().isLocked()) {
actions.append("<input type=\"submit\" class=\"button_medium\" value=\"SDV\" name=\"sdvSubmit\" ").append("onclick=\"").append(jsCodeString.toString()).append("\" />");
}
}
// Only implement the view icon if it is a event crf request
/*
* String bool = (String) request.getAttribute("isViewSubjectRequest");
* if(! "y".equalsIgnoreCase(bool)){
* StringBuilder urlPrefix = new
* StringBuilder("<a href='javascript:void(0)' onclick=\"document.location.href='");
* StringBuilder path = new
* StringBuilder(request.getContextPath()).append("/pages/viewAllSubjectSDV?studyId=").append(
* studySubjectBean.getStudyId()).append("&studySubjectId=");
* path.append(studySubjectBean.getId());
*
* urlPrefix.append(path).append("'\">");
* actions.append(" ").append(urlPrefix).append(VIEW_ICON_HTML).append("</a>");
* }
*/
tempSDVBean.setSdvStatusActions(actions.toString());
allRows.add(tempSDVBean);
}
return allRows;
}
Aggregations