use of org.akaza.openclinica.domain.datamap.EventDefinitionCrf in project OpenClinica by OpenClinica.
the class OdmImportServiceImpl method updateEventDefinitionCrf.
private EventDefinitionCrf updateEventDefinitionCrf(EventDefinitionCrfDTO edcObj) {
EventDefinitionCrf eventDefinitionCrf = edcObj.getEventDefinitionCrf();
eventDefinitionCrf = populateEventDefinitionCrf(new EventDefinitionCrfDTO(edcObj));
eventDefinitionCrf.setUpdateId(edcObj.getUserAccount().getUserId());
eventDefinitionCrf.setDateUpdated(new Date());
return eventDefinitionCrf;
}
use of org.akaza.openclinica.domain.datamap.EventDefinitionCrf in project OpenClinica by OpenClinica.
the class OdmImportServiceImpl method saveOrUpdateEventDefnCrf.
private EventDefinitionCrf saveOrUpdateEventDefnCrf(EventDefinitionCrfDTO edcObj) {
EventDefinitionCrf eventDefinitionCrf = edcObj.getEventDefinitionCrf();
if (eventDefinitionCrf == null) {
eventDefinitionCrf = new EventDefinitionCrf();
edcObj.setEventDefinitionCrf(eventDefinitionCrf);
eventDefinitionCrf = getEventDefinitionCrfDao().saveOrUpdate(populateEventDefinitionCrf(new EventDefinitionCrfDTO(edcObj)));
} else {
eventDefinitionCrf = getEventDefinitionCrfDao().saveOrUpdate(updateEventDefinitionCrf(new EventDefinitionCrfDTO(edcObj)));
}
return eventDefinitionCrf;
}
use of org.akaza.openclinica.domain.datamap.EventDefinitionCrf in project OpenClinica by OpenClinica.
the class EventDefinitionCrfDao method findByStudyEventDefinitionIdAndCRFIdAndStudyId.
@SuppressWarnings("unchecked")
public EventDefinitionCrf findByStudyEventDefinitionIdAndCRFIdAndStudyId(Integer studyEventDefinitionId, Integer crfId, Integer studyId) {
String query = "from " + getDomainClassName() + " do where do.studyEventDefinition.studyEventDefinitionId = :studyeventdefid " + " and do.study.studyId = :studyid and do.crf.crfId = :crfid";
Query q = getCurrentSession().createQuery(query);
q.setInteger("studyeventdefid", studyEventDefinitionId);
q.setInteger("studyid", studyId);
q.setInteger("crfid", crfId);
return (EventDefinitionCrf) q.uniqueResult();
}
use of org.akaza.openclinica.domain.datamap.EventDefinitionCrf 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);
}
}
use of org.akaza.openclinica.domain.datamap.EventDefinitionCrf in project OpenClinica by OpenClinica.
the class GenerateClinicalDataServiceImpl method getFormDataForClinicalStudy.
private ArrayList<ExportFormDataBean> getFormDataForClinicalStudy(StudySubject ss, StudyEvent se, String formVersionOID) {
List<ExportFormDataBean> formDataBean = new ArrayList<ExportFormDataBean>();
boolean formCheck = true;
if (formVersionOID != null)
formCheck = false;
boolean hiddenCrfCheckPassed = true;
List<CrfBean> hiddenCrfs = new ArrayList<CrfBean>();
for (EventCrf ecrf : se.getEventCrfs()) {
List<EventDefinitionCrf> edcs = se.getStudyEventDefinition().getEventDefinitionCrfs();
hiddenCrfCheckPassed = true;
int siteId = 0;
int parentStudyId = 0;
Study study = ss.getStudy();
if (study.getStudy() != null && isActiveRoleAtSite) {
// it is site subject
siteId = study.getStudyId();
parentStudyId = study.getStudy().getStudyId();
hiddenCrfs = listOfHiddenCrfs(siteId, parentStudyId, edcs, ecrf);
if (hiddenCrfs.contains(ecrf.getCrfVersion().getCrf())) {
hiddenCrfCheckPassed = false;
}
}
// This logic is to use the same method for both S_OID/SS_OID/*/* and full path
if (hiddenCrfCheckPassed) {
if (!formCheck) {
if (ecrf.getCrfVersion().getOcOid().equals(formVersionOID))
formCheck = true;
else
formCheck = false;
}
if (formCheck) {
ExportFormDataBean dataBean = new ExportFormDataBean();
dataBean.setItemGroupData(fetchItemData(ecrf.getCrfVersion().getItemGroupMetadatas(), ecrf.getEventCrfId(), ecrf.getCrfVersion().getVersioningMaps(), ecrf));
dataBean.setFormOID(ecrf.getCrfVersion().getOcOid());
if (ecrf.getDateInterviewed() != null)
dataBean.setInterviewDate(ecrf.getDateInterviewed() + "");
if (ecrf.getInterviewerName() != null)
dataBean.setInterviewerName(ecrf.getInterviewerName());
// dataBean.setStatus(EventCRFStatus.getByCode(Integer.valueOf(ecrf.getStatus().getCode())).getI18nDescription(getLocale()));
dataBean.setStatus(fetchEventCRFStatus(ecrf));
if (ecrf.getCrfVersion().getName() != null)
dataBean.setCrfVersion(ecrf.getCrfVersion().getName());
if (collectAudits)
dataBean.setAuditLogs(fetchAuditLogs(ecrf.getEventCrfId(), "event_crf", ecrf.getCrfVersion().getOcOid(), null));
if (collectDns)
dataBean.setDiscrepancyNotes(fetchDiscrepancyNotes(ecrf));
formDataBean.add(dataBean);
if (formVersionOID != null)
formCheck = false;
}
}
}
return (ArrayList<ExportFormDataBean>) formDataBean;
}
Aggregations