use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class EventCRFDAO method findAllStudySubjectByCRFVersion.
public ArrayList findAllStudySubjectByCRFVersion(int versionId) {
this.setTypesExpected();
// ss.label, sed.name as sed_name, s.name as study_name
this.setTypeExpected(24, TypeNames.STRING);
this.setTypeExpected(25, TypeNames.STRING);
this.setTypeExpected(26, TypeNames.STRING);
if ("oracle".equalsIgnoreCase(CoreResources.getDBName())) {
// r
this.setTypeExpected(25, TypeNames.STRING);
// r
this.setTypeExpected(26, TypeNames.STRING);
// r
this.setTypeExpected(27, TypeNames.STRING);
}
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(versionId));
ArrayList alist = this.select(digester.getQuery("findAllStudySubjectByCRFVersion"), variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
HashMap hm = (HashMap) it.next();
EventCRFBean eb = (EventCRFBean) this.getEntityFromHashMap(hm);
eb.setStudySubjectName((String) hm.get("label"));
eb.setEventName((String) hm.get("sed_name"));
eb.setStudyName((String) hm.get("study_name"));
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class EventCRFDAO method buildEventCrfListByStudyEvent.
public Map<Integer, SortedSet<EventCRFBean>> buildEventCrfListByStudyEvent(Integer studySubjectId) {
// <== Must be called first
this.setTypesExpected();
Map<Integer, SortedSet<EventCRFBean>> result = new HashMap<Integer, SortedSet<EventCRFBean>>();
HashMap<Integer, Object> param = new HashMap<Integer, Object>();
int i = 1;
param.put(i++, studySubjectId);
List selectResult = select(digester.getQuery("buildEventCrfListByStudyEvent"), param);
Iterator it = selectResult.iterator();
while (it.hasNext()) {
EventCRFBean bean = (EventCRFBean) this.getEntityFromHashMap((HashMap) it.next());
Integer studyEventId = bean.getStudyEventId();
if (!result.containsKey(studyEventId)) {
result.put(studyEventId, new TreeSet<EventCRFBean>(new Comparator<EventCRFBean>() {
public int compare(EventCRFBean o1, EventCRFBean o2) {
Integer id1 = o1.getId();
Integer id2 = o2.getId();
return id1.compareTo(id2);
}
}));
}
result.get(studyEventId).add(bean);
}
return result;
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class EventCRFDAO method findByEventCrfVersion.
// TODO: to get rid of warning refactor executeFindAllQuery method in
// superclass
public EventCRFBean findByEventCrfVersion(StudyEventBean studyEvent, CRFVersionBean crfVersion) {
EventCRFBean eventCrfBean = null;
HashMap<Integer, Integer> variables = new HashMap<Integer, Integer>();
variables.put(new Integer(1), new Integer(studyEvent.getId()));
variables.put(new Integer(2), new Integer(crfVersion.getId()));
ArrayList<EventCRFBean> eventCrfs = executeFindAllQuery("findByEventCrfVersion", variables);
if (!eventCrfs.isEmpty() && eventCrfs.size() == 1) {
eventCrfBean = eventCrfs.get(0);
}
return eventCrfBean;
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class EventCRFDAO method getWithFilterAndSort.
public ArrayList<EventCRFBean> getWithFilterAndSort(int studyId, int parentStudyId, EventCRFSDVFilter filter, EventCRFSDVSort sort, int rowStart, int rowEnd) {
ArrayList<EventCRFBean> eventCRFs = new ArrayList<EventCRFBean>();
setTypesExpected();
HashMap variables = new HashMap();
variables.put(1, studyId);
variables.put(2, parentStudyId);
String sql = digester.getQuery("getWithFilterAndSort");
sql = sql + filter.execute("");
// sql = sql + sort.execute("");
// major hack
sql = sql + " order By ec.date_created ASC ";
if ("oracle".equalsIgnoreCase(CoreResources.getDBName())) {
// sql += " ) where rownum <= " + rowEnd + " and rownum >" + rowStart + " ";
sql += " )x)where r between " + (rowStart + 1) + " and " + rowEnd;
} else {
sql = sql + " LIMIT " + (rowEnd - rowStart) + " OFFSET " + rowStart;
}
ArrayList rows = this.select(sql, variables);
Iterator it = rows.iterator();
while (it.hasNext()) {
EventCRFBean eventCRF = (EventCRFBean) this.getEntityFromHashMap((HashMap) it.next());
eventCRFs.add(eventCRF);
}
return eventCRFs;
}
use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.
the class EventCRFDAO method getEventCRFsBySDVRequirement.
public ArrayList getEventCRFsBySDVRequirement(int studyId, int parentStudyId, int limit, int offset, Integer... sdvCode) {
HashMap variables = new HashMap();
variables.put(1, studyId);
variables.put(2, parentStudyId);
this.setTypesExpected();
String sql = digester.getQuery("getEventCRFsBySDVRequirement");
sql += " AND ( ";
for (int i = 0; i < sdvCode.length; i++) {
sql += i != 0 ? " OR " : "";
sql += " source_data_verification_code = " + sdvCode[i];
}
sql += " ) )) limit " + limit + " offset " + offset;
ArrayList alist = this.select(sql, variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
EventCRFBean eb = (EventCRFBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
Aggregations