use of org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean in project OpenClinica by OpenClinica.
the class EventDefinitionCRFDAO method buildEventDefinitionCRFListByStudyEventDefinitionForStudy.
public Map<Integer, SortedSet<EventDefinitionCRFBean>> buildEventDefinitionCRFListByStudyEventDefinitionForStudy(Integer studySubjectId) {
// <== Must be called first
this.setTypesExpected();
HashMap<Integer, Object> param = new HashMap<Integer, Object>();
int i = 1;
param.put(i++, studySubjectId);
List selectResult = select(digester.getQuery("buildEventDefinitionCRFListByStudyEventDefinitionForStudy"), param);
Map<Integer, SortedSet<EventDefinitionCRFBean>> result = new HashMap<Integer, SortedSet<EventDefinitionCRFBean>>();
Iterator it = selectResult.iterator();
while (it.hasNext()) {
EventDefinitionCRFBean bean = (EventDefinitionCRFBean) this.getEntityFromHashMap((HashMap) it.next());
Integer studyEventDefinitionId = bean.getStudyEventDefinitionId();
if (!result.containsKey(studyEventDefinitionId)) {
result.put(studyEventDefinitionId, new TreeSet<EventDefinitionCRFBean>(new EventDefinitionCRFComparator()));
}
result.get(studyEventDefinitionId).add(bean);
}
return result;
}
use of org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean in project OpenClinica by OpenClinica.
the class EventDefinitionCRFDAO method findAllActiveParentsByEventDefinitionId.
public Collection findAllActiveParentsByEventDefinitionId(int definitionId) {
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(definitionId));
String sql = digester.getQuery("findAllActiveParentsByEventDefinitionId");
ArrayList alist = this.select(sql, variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
EventDefinitionCRFBean eb = (EventDefinitionCRFBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean in project OpenClinica by OpenClinica.
the class EventDefinitionCRFDAO method findAllByEventDefinitionIdAndSiteIdAndParentStudyId.
public Collection findAllByEventDefinitionIdAndSiteIdAndParentStudyId(int definitionId, int siteId, int parentStudyId) {
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(definitionId));
variables.put(new Integer(2), new Integer(siteId));
variables.put(new Integer(3), new Integer(parentStudyId));
variables.put(new Integer(4), new Integer(definitionId));
variables.put(new Integer(5), new Integer(siteId));
String sql = digester.getQuery("findAllByEventDefinitionIdAndSiteIdAndParentStudyId");
ArrayList alist = this.select(sql, variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
EventDefinitionCRFBean eb = (EventDefinitionCRFBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean in project OpenClinica by OpenClinica.
the class EventDefinitionCRFDAO method findByStudyEventIdAndCRFVersionIdAndSiteIdAndParentStudyId.
public EventDefinitionCRFBean findByStudyEventIdAndCRFVersionIdAndSiteIdAndParentStudyId(int studyEventId, int crfVersionId, int siteId, int parentStudyId) {
EventDefinitionCRFBean answer = new EventDefinitionCRFBean();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(studyEventId));
variables.put(new Integer(2), new Integer(crfVersionId));
variables.put(new Integer(3), new Integer(siteId));
variables.put(new Integer(4), new Integer(parentStudyId));
variables.put(new Integer(5), new Integer(siteId));
String sql = digester.getQuery("findByStudyEventIdAndCRFVersionIdAndSiteIdAndParentStudyId");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
while (it.hasNext()) {
answer = (EventDefinitionCRFBean) this.getEntityFromHashMap((HashMap) it.next());
}
return answer;
}
use of org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean in project OpenClinica by OpenClinica.
the class StudySubjectServiceImpl method getUncompletedCRFs.
private ArrayList<DisplayEventDefinitionCRFBean> getUncompletedCRFs(List eventDefinitionCRFs, List eventCRFs, SubjectEventStatus status, Set<Integer> nonEmptyEventCrf, Map<Integer, CRFVersionBean> crfVersionById, Map<Integer, CRFBean> crfById) {
int i;
HashMap<Integer, Boolean> completed = new HashMap<Integer, Boolean>();
HashMap<Integer, EventCRFBean> startedButIncompleted = new HashMap<Integer, EventCRFBean>();
ArrayList<DisplayEventDefinitionCRFBean> answer = new ArrayList<DisplayEventDefinitionCRFBean>();
for (i = 0; i < eventDefinitionCRFs.size(); i++) {
EventDefinitionCRFBean edcrf = (EventDefinitionCRFBean) eventDefinitionCRFs.get(i);
completed.put(new Integer(edcrf.getCrfId()), Boolean.FALSE);
startedButIncompleted.put(new Integer(edcrf.getCrfId()), new EventCRFBean());
}
for (i = 0; i < eventCRFs.size(); i++) {
EventCRFBean ecrf = (EventCRFBean) eventCRFs.get(i);
// System.out.println("########event crf id:" + ecrf.getId());
// int crfId =
// crfVersionDao.getCRFIdFromCRFVersionId(ecrf.getCRFVersionId());
int crfId = crfVersionById.get(ecrf.getCRFVersionId()).getCrfId();
if (nonEmptyEventCrf.contains(ecrf.getId())) {
// this crf has data
// already
completed.put(new Integer(crfId), Boolean.TRUE);
} else {
// event crf got created, but no data entered
startedButIncompleted.put(new Integer(crfId), ecrf);
}
}
// TODO possible relation to 1689 here, tbh
for (i = 0; i < eventDefinitionCRFs.size(); i++) {
DisplayEventDefinitionCRFBean dedc = new DisplayEventDefinitionCRFBean();
EventDefinitionCRFBean edcrf = (EventDefinitionCRFBean) eventDefinitionCRFs.get(i);
// available (i.e., not removed)
if (edcrf.getStatus().equals(Status.AVAILABLE)) {
dedc.setEdc(edcrf);
// below added tbh, 112007 to fix bug 1943
if (status.equals(SubjectEventStatus.LOCKED)) {
dedc.setStatus(Status.LOCKED);
}
Boolean b = completed.get(new Integer(edcrf.getCrfId()));
EventCRFBean ev = startedButIncompleted.get(new Integer(edcrf.getCrfId()));
if (b == null || !b.booleanValue()) {
dedc.setEventCRF(ev);
answer.add(dedc);
}
}
}
return answer;
}
Aggregations