use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO method findByLabelAndStudy.
public StudySubjectBean findByLabelAndStudy(String label, StudyBean study) {
StudySubjectBean answer = new StudySubjectBean();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), label);
variables.put(new Integer(2), new Integer(study.getId()));
variables.put(new Integer(3), new Integer(study.getId()));
String sql = digester.getQuery("findByLabelAndStudy");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
answer = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
}
return answer;
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO 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()));
String sql = digester.getQuery("findAllWithStudyEvent");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
while (it.hasNext()) {
StudySubjectBean ssb = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
answer.add(ssb);
}
return answer;
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO method getCountofStudySubjectsAtStudyOrSite.
public Integer getCountofStudySubjectsAtStudyOrSite(StudyBean currentStudy) {
StudySubjectBean studySubjectBean = new StudySubjectBean();
setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), currentStudy.getId());
String sql = digester.getQuery("getCountofStudySubjectsAtStudyOrSite");
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;
}
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO method getWithFilterAndSort.
public ArrayList<StudySubjectBean> getWithFilterAndSort(StudyBean currentStudy, ListDiscNotesSubjectFilter filter, ListDiscNotesSubjectSort sort, int rowStart, int rowEnd) {
ArrayList<StudySubjectBean> studySubjects = new ArrayList<StudySubjectBean>();
setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), currentStudy.getId());
variables.put(new Integer(2), currentStudy.getId());
String sql = digester.getQuery("getWithFilterAndSortListDiscNotes");
sql = sql + filter.execute("");
if ("oracle".equalsIgnoreCase(CoreResources.getDBName())) {
sql += " )x) where r between " + (rowStart + 1) + " and " + rowEnd;
sql = sql + sort.execute("");
} else {
sql = sql + sort.execute("");
sql = sql + " LIMIT " + (rowEnd - rowStart) + " OFFSET " + rowStart;
}
ArrayList rows = this.select(sql, variables);
Iterator it = rows.iterator();
while (it.hasNext()) {
StudySubjectBean studySubjectBean = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
studySubjects.add(studySubjectBean);
}
return studySubjects;
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO method findAnotherBySameLabel.
public EntityBean findAnotherBySameLabel(String label, int studyId, int studySubjectId) {
StudySubjectBean eb = new StudySubjectBean();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), label);
variables.put(new Integer(2), new Integer(studyId));
variables.put(new Integer(3), new Integer(studySubjectId));
String sql = digester.getQuery("findAnotherBySameLabel");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
eb = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
}
return eb;
}
Aggregations