Search in sources :

Example 1 with EventCrf

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;
}
Also used : EventCrf(org.akaza.openclinica.domain.datamap.EventCrf) ODMcomplexTypeDefinitionFormData(org.cdisc.ns.odm.v130.ODMcomplexTypeDefinitionFormData) SimpleDateFormat(java.text.SimpleDateFormat)

Example 2 with EventCrf

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;
}
Also used : EventCrf(org.akaza.openclinica.domain.datamap.EventCrf) CrfVersion(org.akaza.openclinica.domain.datamap.CrfVersion) Date(java.util.Date)

Example 3 with 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);
}
Also used : EventCrf(org.akaza.openclinica.domain.datamap.EventCrf)

Example 4 with 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;
}
Also used : EventCrf(org.akaza.openclinica.domain.datamap.EventCrf) CrfVersion(org.akaza.openclinica.domain.datamap.CrfVersion) Date(java.util.Date)

Example 5 with 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);
    }
}
Also used : EventCrf(org.akaza.openclinica.domain.datamap.EventCrf) StudyEventChangeDetails(org.akaza.openclinica.patterns.ocobserver.StudyEventChangeDetails) EventDefinitionCrf(org.akaza.openclinica.domain.datamap.EventDefinitionCrf) StudyEventContainer(org.akaza.openclinica.patterns.ocobserver.StudyEventContainer) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

EventCrf (org.akaza.openclinica.domain.datamap.EventCrf)16 CrfVersion (org.akaza.openclinica.domain.datamap.CrfVersion)9 Date (java.util.Date)6 StudyEvent (org.akaza.openclinica.domain.datamap.StudyEvent)6 StudySubject (org.akaza.openclinica.domain.datamap.StudySubject)5 EventDefinitionCrf (org.akaza.openclinica.domain.datamap.EventDefinitionCrf)4 Study (org.akaza.openclinica.domain.datamap.Study)4 StudyEventDefinition (org.akaza.openclinica.domain.datamap.StudyEventDefinition)4 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Item (org.akaza.openclinica.domain.datamap.Item)2 PFormCache (org.akaza.openclinica.web.pform.PFormCache)2 ResponseEntity (org.springframework.http.ResponseEntity)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 StringReader (java.io.StringReader)1 List (java.util.List)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1