use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO method findAnotherBySameLabelInSites.
public EntityBean findAnotherBySameLabelInSites(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("findAnotherBySameLabelInSites");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
eb = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
}
return eb;
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO method findTheGreatestLabel.
public int findTheGreatestLabel() {
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);
}
int greatestLabel = 0;
for (int i = 0; i < answer.size(); i++) {
StudySubjectBean sb = (StudySubjectBean) answer.get(i);
int labelInt = 0;
try {
labelInt = Integer.parseInt(sb.getLabel());
} catch (NumberFormatException ne) {
labelInt = 0;
}
if (labelInt > greatestLabel) {
greatestLabel = labelInt;
}
}
return greatestLabel;
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO method findByPK.
@Override
public EntityBean findByPK(int ID) {
StudySubjectBean eb = new StudySubjectBean();
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 = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
}
return eb;
}
use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.
the class StudySubjectDAO method getCountofStudySubjectsAtStudy.
public Integer getCountofStudySubjectsAtStudy(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("getCountofStudySubjectsAtStudy");
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 getCountWithFilter.
public Integer getCountWithFilter(ListDiscNotesSubjectFilter 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;
}
}
Aggregations