Search in sources :

Example 6 with EventCRFBean

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;
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 7 with EventCRFBean

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;
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) HashMap(java.util.HashMap) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) SortedSet(java.util.SortedSet) Comparator(java.util.Comparator)

Example 8 with EventCRFBean

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;
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) HashMap(java.util.HashMap)

Example 9 with 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;
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 10 with EventCRFBean

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;
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Aggregations

EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)198 ArrayList (java.util.ArrayList)118 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)89 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)85 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)68 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)64 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)63 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)62 HashMap (java.util.HashMap)54 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)52 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)52 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)48 Date (java.util.Date)47 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)47 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)44 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)43 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)42 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)41 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)41 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)41