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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations