Search in sources :

Example 86 with StudyEventDefinitionBean

use of org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean in project OpenClinica by OpenClinica.

the class StudyEventDefinitionDAO method findByEventDefinitionCRFId.

/**
     * @param eventDefinitionCRFId
     *            The id of an event definition crf.
     * @return the study event definition bean for the specified event
     *         definition crf.
     */
public StudyEventDefinitionBean findByEventDefinitionCRFId(int eventDefinitionCRFId) {
    StudyEventDefinitionBean answer = new StudyEventDefinitionBean();
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(eventDefinitionCRFId));
    String sql = digester.getQuery("findByEventDefinitionCRFId");
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        answer = (StudyEventDefinitionBean) this.getEntityFromHashMap((HashMap) it.next());
    }
    return answer;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)

Example 87 with StudyEventDefinitionBean

use of org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean in project OpenClinica by OpenClinica.

the class StudyEventDefinitionDAO method getEntityFromHashMap.

public Object getEntityFromHashMap(HashMap hm) {
    StudyEventDefinitionBean eb = new StudyEventDefinitionBean();
    this.setEntityAuditInformation(eb, hm);
    // set dates and ints first, then strings
    // create a sub-function in auditable entity dao that can do this?
    Integer sedId = (Integer) hm.get("study_event_definition_id");
    eb.setId(sedId.intValue());
    Integer studyId = (Integer) hm.get("study_id");
    eb.setStudyId(studyId.intValue());
    Integer ordinal = (Integer) hm.get("ordinal");
    eb.setOrdinal(ordinal.intValue());
    Boolean repeating = (Boolean) hm.get("repeating");
    eb.setRepeating(repeating.booleanValue());
    // below functions changed by get entity audit information functions
    /*
         * Integer ownerId = (Integer)hm.get("owner_id");
         * eb.setOwnerId(ownerId.intValue()); Integer updaterId =
         * (Integer)hm.get("update_id"); eb.setUpdaterId(updaterId.intValue());
         * Integer statusId = (Integer)hm.get("status_id");
         * eb.setStatus(Status.get(statusId.intValue()));
         *
         * Date dateCreated = (Date)hm.get("date_created"); Date dateUpdated =
         * (Date)hm.get("date_updated"); eb.setCreatedDate(dateCreated);
         * eb.setUpdatedDate(dateUpdated);
         */
    eb.setName((String) hm.get("name"));
    eb.setDescription((String) hm.get("description"));
    eb.setType((String) hm.get("type"));
    eb.setCategory((String) hm.get("category"));
    eb.setOid((String) hm.get("oc_oid"));
    return eb;
}
Also used : StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)

Example 88 with StudyEventDefinitionBean

use of org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean in project OpenClinica by OpenClinica.

the class StudyEventDefinitionDAO method findByStudySubject.

/**
     *
     * @param studySubjectId
     * @return
     */
public Map<Integer, StudyEventDefinitionBean> findByStudySubject(int studySubjectId) {
    // <== Must be called first
    this.setTypesExpected();
    HashMap<Integer, Object> param = new HashMap<Integer, Object>();
    param.put(1, studySubjectId);
    List selectResult = select(digester.getQuery("findByStudySubject"), param);
    Map<Integer, StudyEventDefinitionBean> result = new HashMap<Integer, StudyEventDefinitionBean>();
    Iterator it = selectResult.iterator();
    while (it.hasNext()) {
        StudyEventDefinitionBean bean = (StudyEventDefinitionBean) this.getEntityFromHashMap((HashMap) it.next());
        result.put(bean.getId(), bean);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)

Example 89 with StudyEventDefinitionBean

use of org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean in project OpenClinica by OpenClinica.

the class StudyEventDefinitionDAO method findAllWithStudyEvent.

public ArrayList findAllWithStudyEvent(StudyBean currentStudy) {
    ArrayList answer = new ArrayList();
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(currentStudy.getId()));
    variables.put(new Integer(2), new Integer(currentStudy.getId()));
    ArrayList alist = this.select(digester.getQuery("findAllWithStudyEvent"), variables);
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        StudyEventDefinitionBean seb = (StudyEventDefinitionBean) this.getEntityFromHashMap((HashMap) it.next());
        answer.add(seb);
    }
    return answer;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)

Example 90 with StudyEventDefinitionBean

use of org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean in project OpenClinica by OpenClinica.

the class StudyEventDefinitionDAO method update.

public EntityBean update(EntityBean eb) {
    StudyEventDefinitionBean sedb = (StudyEventDefinitionBean) eb;
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(sedb.getStudyId()));
    variables.put(new Integer(2), sedb.getName());
    variables.put(new Integer(3), sedb.getDescription());
    variables.put(new Integer(4), new Boolean(sedb.isRepeating()));
    variables.put(new Integer(5), sedb.getType());
    variables.put(new Integer(6), sedb.getCategory());
    variables.put(new Integer(7), new Integer(sedb.getStatus().getId()));
    variables.put(new Integer(8), new Integer(sedb.getUpdaterId()));
    variables.put(new Integer(9), new Integer(sedb.getOrdinal()));
    variables.put(new Integer(10), new Integer(sedb.getId()));
    this.execute(digester.getQuery("update"), variables);
    return eb;
}
Also used : HashMap(java.util.HashMap) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)

Aggregations

StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)155 ArrayList (java.util.ArrayList)109 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)85 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)65 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)61 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)61 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)56 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)55 HashMap (java.util.HashMap)51 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)51 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)50 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)49 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)49 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)48 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)45 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)45 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)42 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)39 Date (java.util.Date)37 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)37