use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteDAO method getViewNotesWithFilterAndSort.
/*
* public ArrayList<DiscrepancyNoteBean> getViewNotesWithFilterAndSort(StudyBean currentStudy, ListNotesFilter
* filter, ListNotesSort sort, int rowStart,
* int rowEnd) {
* ArrayList<DiscrepancyNoteBean> discNotes = new ArrayList<DiscrepancyNoteBean>();
* setTypesExpected();
* this.setTypeExpected(12, TypeNames.STRING);
* this.setTypeExpected(13, TypeNames.INT);
* this.setTypeExpected(14, TypeNames.INT);
* this.setTypeExpected(15, TypeNames.INT);
*
* HashMap variables = new HashMap();
* variables.put(Integer.valueOf(1), currentStudy.getId());
* variables.put(Integer.valueOf(2), currentStudy.getId());
* variables.put(Integer.valueOf(3), currentStudy.getId());
* variables.put(Integer.valueOf(4), currentStudy.getId());
* variables.put(Integer.valueOf(5), currentStudy.getId());
* variables.put(Integer.valueOf(6), currentStudy.getId());
* variables.put(Integer.valueOf(7), currentStudy.getId());
* variables.put(Integer.valueOf(8), currentStudy.getId());
* variables.put(Integer.valueOf(9), currentStudy.getId());
* variables.put(Integer.valueOf(10), currentStudy.getId());
*
* String sql = "";
* if ("oracle".equalsIgnoreCase(CoreResources.getDBName())) {
* sql = sql + "SELECT * FROM ( SELECT x.*, ROWNUM as rnum FROM (";
* }
* sql = sql + digester.getQuery("findAllSubjectDNByStudy");
* sql = sql + filter.execute("");
* sql += " UNION ";
* sql += digester.getQuery("findAllStudySubjectDNByStudy");
* sql += filter.execute("");
* sql += " UNION ";
* sql += digester.getQuery("findAllStudyEventDNByStudy");
* sql += filter.execute("");
* sql += " UNION ";
* sql += digester.getQuery("findAllEventCrfDNByStudy");
* if (currentStudy.isSite(currentStudy.getParentStudyId())) {
* sql += " and ec.event_crf_id not in ( " + this.findSiteHiddenEventCrfIdsString(currentStudy) + " ) ";
* }
* sql += filter.execute("");
* sql += " UNION ";
* sql += digester.getQuery("findAllItemDataDNByStudy");
* if (currentStudy.isSite(currentStudy.getParentStudyId())) {
* sql += " and ec.event_crf_id not in ( " + this.findSiteHiddenEventCrfIdsString(currentStudy) + " ) ";
* }
* sql += filter.execute("");
*
* if ("oracle".equalsIgnoreCase(CoreResources.getDBName())) {
* sql += ") x ) WHERE rnum BETWEEN " + (rowStart + 1) + " and " + rowEnd;
* sql += sort.execute("");
* } else {
* sql += sort.execute("");
* sql += " LIMIT " + (rowEnd - rowStart) + " OFFSET " + rowStart;
* }
* // System.out.println(sql);
* ArrayList rows = select(sql, variables);
*
* Iterator it = rows.iterator();
* while (it.hasNext()) {
* DiscrepancyNoteBean discBean = (DiscrepancyNoteBean) this.getEntityFromHashMap((HashMap) it.next());
* discBean = findSingleMapping(discBean);
* discNotes.add(discBean);
* }
* return discNotes;
* }
*/
public ArrayList<DiscrepancyNoteBean> getViewNotesWithFilterAndSort(StudyBean currentStudy, ListNotesFilter filter, ListNotesSort sort) {
ArrayList<DiscrepancyNoteBean> discNotes = new ArrayList<DiscrepancyNoteBean>();
setTypesExpected();
this.setTypeExpected(12, TypeNames.STRING);
this.setTypeExpected(13, TypeNames.INT);
this.setTypeExpected(14, TypeNames.INT);
this.setTypeExpected(15, TypeNames.INT);
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), currentStudy.getId());
variables.put(Integer.valueOf(2), currentStudy.getId());
variables.put(Integer.valueOf(3), currentStudy.getId());
variables.put(Integer.valueOf(4), currentStudy.getId());
variables.put(Integer.valueOf(5), currentStudy.getId());
variables.put(Integer.valueOf(6), currentStudy.getId());
variables.put(Integer.valueOf(7), currentStudy.getId());
variables.put(Integer.valueOf(8), currentStudy.getId());
variables.put(Integer.valueOf(9), currentStudy.getId());
variables.put(Integer.valueOf(10), currentStudy.getId());
String sql = "";
// if ("oracle".equalsIgnoreCase(CoreResources.getDBName())) {
// sql = sql + "SELECT * FROM ( SELECT x.*, ROWNUM as rnum FROM (";
// }
sql = sql + digester.getQuery("findAllSubjectDNByStudy");
sql = sql + filter.execute("");
sql += " UNION ";
sql += digester.getQuery("findAllStudySubjectDNByStudy");
sql += filter.execute("");
sql += " UNION ";
sql += digester.getQuery("findAllStudyEventDNByStudy");
sql += filter.execute("");
sql += " UNION ";
sql += digester.getQuery("findAllEventCrfDNByStudy");
if (currentStudy.isSite(currentStudy.getParentStudyId())) {
sql += " and ec.event_crf_id not in ( " + this.findSiteHiddenEventCrfIdsString(currentStudy) + " ) ";
}
sql += filter.execute("");
sql += " UNION ";
sql += digester.getQuery("findAllItemDataDNByStudy");
if (currentStudy.isSite(currentStudy.getParentStudyId())) {
sql += " and ec.event_crf_id not in ( " + this.findSiteHiddenEventCrfIdsString(currentStudy) + " ) ";
}
sql += filter.execute("");
sql += sort.execute("");
ArrayList rows = select(sql, variables);
Iterator it = rows.iterator();
while (it.hasNext()) {
DiscrepancyNoteBean discBean = (DiscrepancyNoteBean) this.getEntityFromHashMap((HashMap) it.next());
discBean = findSingleMapping(discBean);
discNotes.add(discBean);
}
return discNotes;
}
use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteDAO method getWithFilterAndSort.
public ArrayList<DiscrepancyNoteBean> getWithFilterAndSort(StudyBean currentStudy, ListNotesFilter filter, ListNotesSort sort, int rowStart, int rowEnd) {
ArrayList<DiscrepancyNoteBean> discNotes = new ArrayList<DiscrepancyNoteBean>();
setTypesExpected();
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), currentStudy.getId());
variables.put(Integer.valueOf(2), currentStudy.getId());
String sql = digester.getQuery("getWithFilterAndSort");
sql = sql + filter.execute("");
if ("oracle".equalsIgnoreCase(CoreResources.getDBName())) {
sql += " AND rownum <= " + rowEnd + " and rownum >" + rowStart;
sql = sql + sort.execute("");
} else {
sql = sql + sort.execute("");
sql = sql + " LIMIT " + (rowEnd - rowStart) + " OFFSET " + rowStart;
}
ArrayList rows = select(sql, variables);
Iterator it = rows.iterator();
while (it.hasNext()) {
DiscrepancyNoteBean discBean = (DiscrepancyNoteBean) this.getEntityFromHashMap((HashMap) it.next());
discBean = findSingleMapping(discBean);
discNotes.add(discBean);
}
return discNotes;
}
use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteDAO method getEventCrfDNCountWithFilter.
public Integer getEventCrfDNCountWithFilter(ListNotesFilter filter, Integer currentStudyId) {
DiscrepancyNoteBean discrepancyNoteBean = new DiscrepancyNoteBean();
setTypesExpected();
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), currentStudyId);
variables.put(Integer.valueOf(2), currentStudyId);
String sql = digester.getQuery("getEventCrfDNCountWithFilter");
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;
}
}
use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteDAO method findAllStudyEventByStudiesAndSubjectId.
public ArrayList findAllStudyEventByStudiesAndSubjectId(StudyBean currentStudy, StudyBean subjectStudy, int studySubjectId) {
this.setTypesExpected();
ArrayList alist = new ArrayList();
// ss.label
this.setTypeExpected(12, TypeNames.STRING);
// date_start
this.setTypeExpected(13, TypeNames.DATE);
// sed_name
this.setTypeExpected(14, TypeNames.STRING);
// column_name
this.setTypeExpected(15, TypeNames.STRING);
// study_event_id
this.setTypeExpected(16, TypeNames.INT);
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), Integer.valueOf(currentStudy.getId()));
variables.put(Integer.valueOf(2), Integer.valueOf(subjectStudy.getId()));
variables.put(Integer.valueOf(3), Integer.valueOf(currentStudy.getId()));
variables.put(Integer.valueOf(4), Integer.valueOf(studySubjectId));
alist = this.select(digester.getQuery("findAllStudyEventByStudiesAndSubjectId"), variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
HashMap hm = (HashMap) it.next();
DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
eb.setSubjectName((String) hm.get("label"));
eb.setEventName((String) hm.get("sed_name"));
eb.setEventStart((Date) hm.get("date_start"));
eb.setColumn((String) hm.get("column_name"));
eb.setEntityId(((Integer) hm.get("study_event_id")).intValue());
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteDAO method findAllStudySubjectByStudiesAndStudySubjectId.
public ArrayList<DiscrepancyNoteBean> findAllStudySubjectByStudiesAndStudySubjectId(StudyBean currentStudy, StudyBean subjectStudy, int studySubjectId) {
this.setTypesExpected();
ArrayList alist = new ArrayList();
// ss.label
this.setTypeExpected(12, TypeNames.STRING);
// column_name
this.setTypeExpected(13, TypeNames.STRING);
// study_subject_id
this.setTypeExpected(14, TypeNames.INT);
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), Integer.valueOf(currentStudy.getId()));
variables.put(Integer.valueOf(2), Integer.valueOf(subjectStudy.getId()));
variables.put(Integer.valueOf(3), Integer.valueOf(subjectStudy.getId()));
variables.put(Integer.valueOf(4), Integer.valueOf(studySubjectId));
alist = this.select(digester.getQuery("findAllStudySubjectByStudiesAndStudySubjectId"), variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
HashMap hm = (HashMap) it.next();
DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
eb.setSubjectName((String) hm.get("label"));
eb.setColumn((String) hm.get("column_name"));
eb.setEntityId(((Integer) hm.get("study_subject_id")).intValue());
al.add(eb);
}
return al;
}
Aggregations