Search in sources :

Example 6 with StudySubjectBean

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

the class StudySubjectDAO method findByOid.

public StudySubjectBean findByOid(String oid) {
    StudySubjectBean studySubjectBean = new StudySubjectBean();
    setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), oid);
    String sql = digester.getQuery("findByOid");
    ArrayList rows = this.select(sql, variables);
    Iterator it = rows.iterator();
    if (it.hasNext()) {
        studySubjectBean = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
        return studySubjectBean;
    } else {
        return null;
    }
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 7 with StudySubjectBean

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

the class StudySubjectDAO method getCountWithFilter.

public Integer getCountWithFilter(ListDiscNotesForCRFFilter filter, StudyBean currentStudy) {
    StudySubjectBean studySubjectBean = new StudySubjectBean();
    setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), currentStudy.getId());
    variables.put(new Integer(2), currentStudy.getId());
    String sql = digester.getQuery("getCountWithFilterListDiscNotes");
    sql += filter.execute("");
    ArrayList rows = this.select(sql, variables);
    Iterator it = rows.iterator();
    if (it.hasNext()) {
        Integer count = (Integer) ((HashMap) it.next()).get("count");
        return count;
    } else {
        return null;
    }
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 8 with StudySubjectBean

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

the class StudySubjectDAO method findByOidAndStudy.

public StudySubjectBean findByOidAndStudy(String oid, int studyId) {
    StudySubjectBean studySubjectBean = new StudySubjectBean();
    setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), oid);
    variables.put(new Integer(2), new Integer(studyId));
    variables.put(new Integer(3), new Integer(studyId));
    String sql = digester.getQuery("findByOidAndStudy");
    ArrayList rows = this.select(sql, variables);
    Iterator it = rows.iterator();
    if (it.hasNext()) {
        studySubjectBean = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
        return studySubjectBean;
    } else {
        return null;
    }
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 9 with StudySubjectBean

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

the class StudySubjectDAO method update.

/* this function allows to run transactional updates for an action */
public EntityBean update(EntityBean eb, Connection con) {
    StudySubjectBean sb = (StudySubjectBean) eb;
    HashMap variables = new HashMap();
    HashMap nullVars = new HashMap();
    // UPDATE study_subject SET LABEL=?, SUBJECT_ID=?, STUDY_ID=?,
    // STATUS_ID=?, ENROLLMENT_DATE=?, DATE_UPDATED=?,
    // UPDATE_ID=?, SECONDARY_LABEL=? WHERE STUDY_SUBJECT_ID=?
    int ind = 1;
    variables.put(new Integer(ind), sb.getLabel());
    ind++;
    variables.put(new Integer(ind), new Integer(sb.getSubjectId()));
    ind++;
    variables.put(new Integer(ind), new Integer(sb.getStudyId()));
    ind++;
    variables.put(new Integer(ind), new Integer(sb.getStatus().getId()));
    ind++;
    Date enrollmentDate = sb.getEnrollmentDate();
    if (enrollmentDate == null) {
        nullVars.put(new Integer(ind), new Integer(Types.DATE));
        variables.put(new Integer(ind), null);
        ind++;
    } else {
        variables.put(new Integer(ind), enrollmentDate);
        ind++;
    }
    // date_updated is set to now()
    // variables.put(new Integer(ind), new java.util.Date());
    // ind++;
    variables.put(new Integer(ind), new Integer(sb.getUpdater().getId()));
    ind++;
    variables.put(new Integer(ind), sb.getSecondaryLabel());
    ind++;
    if (sb.getTime_zone() == null || sb.getTime_zone().equals("")) {
        nullVars.put(new Integer(ind), new Integer(TypeNames.STRING));
        variables.put(new Integer(ind), "");
    } else {
        variables.put(new Integer(ind), sb.getTime_zone());
    }
    ind++;
    variables.put(new Integer(ind), new Integer(sb.getId()));
    ind++;
    String sql = digester.getQuery("update");
    if (con == null) {
        this.execute(sql, variables, nullVars);
    } else {
        this.execute(sql, variables, nullVars, con);
    }
    return sb;
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap) Date(java.util.Date)

Example 10 with StudySubjectBean

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

the class StudySubjectDAO method findAll.

@Override
public Collection findAll() {
    this.setTypesExpected();
    String sql = digester.getQuery("findAll");
    ArrayList alist = this.select(sql);
    ArrayList answer = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        StudySubjectBean eb = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
        answer.add(eb);
    }
    return answer;
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Aggregations

StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)155 ArrayList (java.util.ArrayList)102 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)86 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)71 HashMap (java.util.HashMap)66 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)66 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)57 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)52 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)52 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)49 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)45 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)43 Date (java.util.Date)42 Iterator (java.util.Iterator)38 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)35 SubjectBean (org.akaza.openclinica.bean.submit.SubjectBean)29 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)26 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)26 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)26 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)23