use of org.akaza.openclinica.domain.datamap.EventCrf in project OpenClinica by OpenClinica.
the class OdmController method generateFormData.
private ODMcomplexTypeDefinitionFormData generateFormData(FormLayoutBean formLayout, StudyEventBean nextEvent, EventCRFBean eventCRFBean, CRFBean crfBean, String formUrl, boolean itemDataExists) {
ODMcomplexTypeDefinitionFormData formData = new ODMcomplexTypeDefinitionFormData();
formData.setFormOID(formLayout.getOid());
formData.setFormName(crfBean.getName());
formData.setVersionDescription(formLayout.getDescription());
formData.setUrl(formUrl);
if (eventCRFBean == null) {
formData.setStatus("Not Started");
} else {
EventCrf eventCrf = eventCrfDao.findById(eventCRFBean.getId());
if (!itemDataExists) {
formData.setStatus("Not Started");
} else {
formData.setStatus(eventCRFBean.getStatus().getName());
}
if (eventCrf.getDateUpdated() != null) {
// returns time as UTC
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
formData.setStatusChangeTimeStamp(sdf.format(eventCrf.getDateUpdated()));
}
}
return formData;
}
use of org.akaza.openclinica.domain.datamap.EventCrf in project OpenClinica by OpenClinica.
the class OpenRosaSubmissionController method createEventCrf.
private EventCrf createEventCrf(FormLayout formLayout, StudyEvent studyEvent, StudySubject studySubject, UserAccount user) {
EventCrf eventCrf = new EventCrf();
CrfVersion crfVersion = crfVersionDao.findAllByCrfId(formLayout.getCrf().getCrfId()).get(0);
Date currentDate = new Date();
eventCrf.setAnnotations("");
eventCrf.setDateCreated(currentDate);
eventCrf.setCrfVersion(crfVersion);
eventCrf.setFormLayout(formLayout);
eventCrf.setInterviewerName("");
eventCrf.setDateInterviewed(null);
eventCrf.setUserAccount(user);
eventCrf.setStatusId(org.akaza.openclinica.domain.Status.AVAILABLE.getCode());
// setCompletionStatusId(1);
eventCrf.setCompletionStatus(completionStatusDao.findByCompletionStatusId(1));
eventCrf.setStudySubject(studySubject);
eventCrf.setStudyEvent(studyEvent);
eventCrf.setValidateString("");
eventCrf.setValidatorAnnotations("");
eventCrf.setUpdateId(user.getUserId());
eventCrf.setDateUpdated(new Date());
eventCrf.setValidatorId(0);
eventCrf.setOldStatusId(0);
eventCrf.setSdvUpdateId(0);
eventCrf = eventCrfDao.saveOrUpdate(eventCrf);
logger.debug("*********CREATED EVENT CRF");
return eventCrf;
}
use of org.akaza.openclinica.domain.datamap.EventCrf in project OpenClinica by OpenClinica.
the class FSItemProcessor method resetSdvStatus.
private void resetSdvStatus(SubmissionContainer container) {
EventCrf eventCrf = container.getEventCrf();
eventCrf.setSdvStatus(false);
eventCrf.setSdvUpdateId(container.getUser().getUserId());
eventCrfDao.saveOrUpdate(eventCrf);
}
use of org.akaza.openclinica.domain.datamap.EventCrf in project OpenClinica by OpenClinica.
the class EventProcessor method createEventCrf.
private EventCrf createEventCrf(FormLayout formLayout, StudyEvent studyEvent, StudySubject studySubject, UserAccount user) {
EventCrf eventCrf = new EventCrf();
CrfVersion crfVersion = crfVersionDao.findAllByCrfId(formLayout.getCrf().getCrfId()).get(0);
Date currentDate = new Date();
eventCrf.setAnnotations("");
eventCrf.setDateCreated(currentDate);
eventCrf.setCrfVersion(crfVersion);
eventCrf.setFormLayout(formLayout);
eventCrf.setInterviewerName("");
eventCrf.setDateInterviewed(null);
eventCrf.setUserAccount(user);
eventCrf.setStatusId(Status.AVAILABLE.getCode());
// setCompletionStatusId(1);
eventCrf.setCompletionStatus(completionStatusDao.findByCompletionStatusId(1));
eventCrf.setStudySubject(studySubject);
eventCrf.setStudyEvent(studyEvent);
eventCrf.setValidateString("");
eventCrf.setValidatorAnnotations("");
eventCrf.setUpdateId(user.getUserId());
eventCrf.setDateUpdated(new Date());
eventCrf.setValidatorId(0);
eventCrf.setOldStatusId(0);
eventCrf.setSdvUpdateId(0);
eventCrf = eventCrfDao.saveOrUpdate(eventCrf);
logger.debug("*********CREATED EVENT CRF");
return eventCrf;
}
use of org.akaza.openclinica.domain.datamap.EventCrf in project OpenClinica by OpenClinica.
the class StudyEventController method completeData.
@Transactional
private void completeData(StudyEvent studyEvent, List<EventDefinitionCrf> eventDefCrfs, List<EventCrf> eventCrfs) throws Exception {
boolean completeStudyEvent = true;
// Loop thru event CRFs and complete all that are participant events.
for (EventDefinitionCrf eventDefCrf : eventDefCrfs) {
boolean foundEventCrfMatch = false;
for (EventCrf eventCrf : eventCrfs) {
if (eventDefCrf.getCrf().getCrfId() == eventCrf.getCrfVersion().getCrf().getCrfId()) {
foundEventCrfMatch = true;
if (eventDefCrf.getParicipantForm()) {
eventCrf.setStatusId(Status.UNAVAILABLE.getCode());
eventCrfDao.saveOrUpdate(eventCrf);
} else if (eventCrf.getStatusId() != Status.UNAVAILABLE.getCode())
completeStudyEvent = false;
}
}
if (!foundEventCrfMatch && !eventDefCrf.getParicipantForm())
completeStudyEvent = false;
}
// Complete study event only if there are no uncompleted, non-participant forms.
if (completeStudyEvent) {
studyEvent.setSubjectEventStatusId(4);
StudyEventChangeDetails changeDetails = new StudyEventChangeDetails(true, false);
StudyEventContainer container = new StudyEventContainer(studyEvent, changeDetails);
studyEventDao.saveOrUpdateTransactional(container);
}
}
Aggregations