Search in sources :

Example 41 with SubjectBean

use of org.akaza.openclinica.bean.submit.SubjectBean in project OpenClinica by OpenClinica.

the class SubjectDAO method findByUniqueIdentifierAndAnyStudy.

/**
 * Finds the subject which has the given identifier and is inside given
 * study
 *
 * @param uniqueIdentifier
 * @param studyId
 * @return
 */
public SubjectBean findByUniqueIdentifierAndAnyStudy(String uniqueIdentifier, int studyId) {
    SubjectBean answer = new SubjectBean();
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), uniqueIdentifier);
    variables.put(new Integer(2), new Integer(studyId));
    variables.put(new Integer(3), new Integer(studyId));
    String sql = digester.getQuery("findByUniqueIdentifierAndAnyStudy");
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        answer = (SubjectBean) this.getEntityFromHashMap((HashMap) it.next());
    }
    return answer;
}
Also used : SubjectBean(org.akaza.openclinica.bean.submit.SubjectBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 42 with SubjectBean

use of org.akaza.openclinica.bean.submit.SubjectBean in project OpenClinica by OpenClinica.

the class SubjectDAO method findByPK.

public EntityBean findByPK(int ID) {
    SubjectBean eb = new SubjectBean();
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(ID));
    String sql = digester.getQuery("findByPK");
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        eb = (SubjectBean) this.getEntityFromHashMap((HashMap) it.next());
    }
    return eb;
}
Also used : SubjectBean(org.akaza.openclinica.bean.submit.SubjectBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 43 with SubjectBean

use of org.akaza.openclinica.bean.submit.SubjectBean in project OpenClinica by OpenClinica.

the class SubjectDAO method findAllSubjectsAndStudies.

/**
 * findAllSubjectsAndStudies()
 *
 * For every subject find all studies that subject belongs to.
 *
 * smw
 */
public ArrayList findAllSubjectsAndStudies() {
    ArrayList answer = new ArrayList();
    this.setTypesExpected();
    // label from study_subject table
    this.setTypeExpected(13, TypeNames.CHAR);
    // unique_identifier from study table
    this.setTypeExpected(14, TypeNames.CHAR);
    String sql = digester.getQuery("findAllSubjectsAndStudies");
    ArrayList alist = this.select(sql);
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        HashMap hm = (HashMap) it.next();
        SubjectBean sb = (SubjectBean) this.getEntityFromHashMap(hm);
        sb.setLabel((String) hm.get("label"));
        sb.setStudyIdentifier((String) hm.get("study_unique_identifier"));
        answer.add(sb);
    }
    return answer;
}
Also used : SubjectBean(org.akaza.openclinica.bean.submit.SubjectBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 44 with SubjectBean

use of org.akaza.openclinica.bean.submit.SubjectBean in project OpenClinica by OpenClinica.

the class SubjectDAO method findAllChildrenByPK.

public Collection findAllChildrenByPK(int subjectId) {
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(subjectId));
    variables.put(new Integer(2), new Integer(subjectId));
    ArrayList alist = this.select(digester.getQuery("findAllChildrenByPK"), variables);
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        SubjectBean eb = (SubjectBean) this.getEntityFromHashMap((HashMap) it.next());
        al.add(eb);
    }
    return al;
}
Also used : SubjectBean(org.akaza.openclinica.bean.submit.SubjectBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 45 with SubjectBean

use of org.akaza.openclinica.bean.submit.SubjectBean in project OpenClinica by OpenClinica.

the class SubjectDAO method findByUniqueIdentifier.

public SubjectBean findByUniqueIdentifier(String uniqueIdentifier) {
    SubjectBean answer = new SubjectBean();
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), uniqueIdentifier);
    String sql = digester.getQuery("findByUniqueIdentifier");
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        answer = (SubjectBean) this.getEntityFromHashMap((HashMap) it.next());
    }
    return answer;
}
Also used : SubjectBean(org.akaza.openclinica.bean.submit.SubjectBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Aggregations

SubjectBean (org.akaza.openclinica.bean.submit.SubjectBean)50 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)44 ArrayList (java.util.ArrayList)37 HashMap (java.util.HashMap)26 SubjectDAO (org.akaza.openclinica.dao.submit.SubjectDAO)25 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)23 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)22 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)22 Date (java.util.Date)21 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)21 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)19 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)19 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)18 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)15 Iterator (java.util.Iterator)14 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)13 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)11 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)10 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)10 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)9