use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class CrfBusinessLogicHelper method areAllCompleted.
protected boolean areAllCompleted(StudyEventBean seBean, StudyBean study) {
EventDefinitionCRFDAO edcDao = new EventDefinitionCRFDAO(ds);
EventCRFDAO eventCrfDao = new EventCRFDAO(ds);
ArrayList allCRFs = eventCrfDao.findAllByStudyEvent(seBean);
ArrayList allEDCs = (ArrayList) edcDao.findAllActiveByEventDefinitionId(study, seBean.getStudyEventDefinitionId());
boolean eventCompleted = true;
logger.info("found all crfs: " + allCRFs.size());
logger.info("found all edcs: " + allEDCs.size());
for (int i = 0; i < allCRFs.size(); i++) {
EventCRFBean ec = (EventCRFBean) allCRFs.get(i);
// logger.info("found a crf name from event crf bean: " +
// ec.getCrf().getName());
logger.info("found a event name from event crf bean: " + ec.getEventName() + " crf version id: " + ec.getCRFVersionId());
if (!ec.getStatus().equals(Status.UNAVAILABLE) || allCRFs.size() < allEDCs.size()) {
eventCompleted = false;
break;
}
}
logger.info("returning for are all completed: " + eventCompleted);
return eventCompleted;
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class EventCRFDAO method create.
public EntityBean create(EntityBean eb) {
EventCRFBean ecb = (EventCRFBean) eb;
HashMap variables = new HashMap();
HashMap nullVars = new HashMap();
variables.put(new Integer(1), new Integer(ecb.getStudyEventId()));
variables.put(new Integer(2), new Integer(ecb.getCRFVersionId()));
Date interviewed = ecb.getDateInterviewed();
if (interviewed != null) {
variables.put(new Integer(3), ecb.getDateInterviewed());
} else {
variables.put(new Integer(3), null);
nullVars.put(new Integer(3), new Integer(Types.DATE));
}
logger.debug("created: ecb.getInterviewerName()" + ecb.getInterviewerName());
variables.put(new Integer(4), ecb.getInterviewerName());
variables.put(new Integer(5), new Integer(ecb.getCompletionStatusId()));
variables.put(new Integer(6), new Integer(ecb.getStatus().getId()));
variables.put(new Integer(7), ecb.getAnnotations());
variables.put(new Integer(8), new Integer(ecb.getOwnerId()));
variables.put(new Integer(9), new Integer(ecb.getStudySubjectId()));
variables.put(new Integer(10), ecb.getValidateString());
variables.put(new Integer(11), ecb.getValidatorAnnotations());
variables.put(new Integer(12), new Integer(ecb.getFormLayoutId()));
executeWithPK(digester.getQuery("create"), variables, nullVars);
if (isQuerySuccessful()) {
ecb.setId(getLatestPK());
}
return ecb;
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class ParticipantEventService method getNextParticipantEvent.
public StudyEventBean getNextParticipantEvent(StudySubjectBean studySubject) {
List<StudyEventBean> studyEvents = (ArrayList<StudyEventBean>) getStudyEventDAO().findAllBySubjectIdOrdered(studySubject.getId());
for (StudyEventBean studyEvent : studyEvents) {
// Skip to next event if study event is not in the right status
if (studyEvent.getStatus() != Status.AVAILABLE || (studyEvent.getSubjectEventStatus() != SubjectEventStatus.DATA_ENTRY_STARTED && studyEvent.getSubjectEventStatus() != SubjectEventStatus.SCHEDULED))
continue;
List<EventDefinitionCRFBean> eventDefCrfs = getEventDefCrfsForStudyEvent(studySubject, studyEvent);
for (EventDefinitionCRFBean eventDefCrf : eventDefCrfs) {
boolean participantForm = eventDefCrf.isParticipantForm();
if (participantForm) {
List<CRFVersionBean> crfVersions = getAllCrfVersions(eventDefCrf);
boolean eventCrfExists = false;
for (CRFVersionBean crfVersion : crfVersions) {
EventCRFBean eventCRF = getEventCRFDAO().findByEventCrfVersion(studyEvent, crfVersion);
if (eventCRF != null && eventCRF.getStatus() == Status.AVAILABLE)
return studyEvent;
else if (eventCRF != null)
eventCrfExists = true;
}
if (!eventCrfExists)
return studyEvent;
}
}
}
// Did not find a next participant event
return null;
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteUtil method injectParentDiscNotesIntoDisplayStudyEvents.
public void injectParentDiscNotesIntoDisplayStudyEvents(List<DisplayStudyEventBean> displayStudyBeans, Set<Integer> resolutionStatusIds, DataSource dataSource, int discNoteType) {
if (displayStudyBeans == null) {
return;
}
// booleans representing whether this method should only get
// DiscrepancyNoteBeans with
// certain resolution status or discrepancyNoteTypeId number.
boolean hasResolutionStatus = this.checkResolutionStatus(resolutionStatusIds);
boolean hasDiscNoteType = discNoteType >= 1 && discNoteType <= 4;
EventCRFDAO eventCRFDAO = new EventCRFDAO(dataSource);
DiscrepancyNoteDAO discrepancyNoteDAO = new DiscrepancyNoteDAO(dataSource);
StudyEventBean studyEventBean;
List<EventCRFBean> eventCRFBeans = new ArrayList<EventCRFBean>();
List<DiscrepancyNoteBean> foundDiscNotes = new ArrayList<DiscrepancyNoteBean>();
for (DisplayStudyEventBean dStudyEventBean : displayStudyBeans) {
studyEventBean = dStudyEventBean.getStudyEvent();
// All EventCRFs for a study event
eventCRFBeans = eventCRFDAO.findAllByStudyEvent(studyEventBean);
for (EventCRFBean eventCrfBean : eventCRFBeans) {
// Find ItemData type notes associated with an event crf
foundDiscNotes = discrepancyNoteDAO.findParentItemDataDNotesFromEventCRF(eventCrfBean);
// filter for any specified disc note type
if (!foundDiscNotes.isEmpty() && hasDiscNoteType) {
// only include disc notes that have the specified disc note
// type id
foundDiscNotes = filterforDiscNoteType(foundDiscNotes, discNoteType);
}
if (!foundDiscNotes.isEmpty()) {
if (!hasResolutionStatus) {
studyEventBean.getDiscBeanList().addAll(foundDiscNotes);
} else {
// session variable
for (DiscrepancyNoteBean discBean : foundDiscNotes) {
for (int statusId : resolutionStatusIds) {
if (discBean.getResolutionStatusId() == statusId) {
studyEventBean.getDiscBeanList().add(discBean);
}
}
}
}
}
}
// end for(EventCRFBean...
}
// end for (DisplayStudyEventBean
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class ExtractBean method getCRFCompletionDate.
protected String getCRFCompletionDate(int h, int i, int j) {
StudyEventBean seb = getEvent(h, i, j);
EventCRFBean eventCRF = null;
if (seb.getEventCRFs().size() > 0) {
eventCRF = (EventCRFBean) seb.getEventCRFs().get(0);
}
// need
return eventCRF.getDateValidateCompleted() == null ? sdf.format(eventCRF.getDateCompleted()) : sdf.format(eventCRF.getDateValidateCompleted());
// to
// be
// fixed?
}
Aggregations