use of org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean in project OpenClinica by OpenClinica.
the class StudyEventDefinitionDAO method findByEventDefinitionCRFId.
/**
* @param eventDefinitionCRFId
* The id of an event definition crf.
* @return the study event definition bean for the specified event
* definition crf.
*/
public StudyEventDefinitionBean findByEventDefinitionCRFId(int eventDefinitionCRFId) {
StudyEventDefinitionBean answer = new StudyEventDefinitionBean();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(eventDefinitionCRFId));
String sql = digester.getQuery("findByEventDefinitionCRFId");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
answer = (StudyEventDefinitionBean) this.getEntityFromHashMap((HashMap) it.next());
}
return answer;
}
use of org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean in project OpenClinica by OpenClinica.
the class StudyEventDefinitionDAO method getEntityFromHashMap.
public Object getEntityFromHashMap(HashMap hm) {
StudyEventDefinitionBean eb = new StudyEventDefinitionBean();
this.setEntityAuditInformation(eb, hm);
// set dates and ints first, then strings
// create a sub-function in auditable entity dao that can do this?
Integer sedId = (Integer) hm.get("study_event_definition_id");
eb.setId(sedId.intValue());
Integer studyId = (Integer) hm.get("study_id");
eb.setStudyId(studyId.intValue());
Integer ordinal = (Integer) hm.get("ordinal");
eb.setOrdinal(ordinal.intValue());
Boolean repeating = (Boolean) hm.get("repeating");
eb.setRepeating(repeating.booleanValue());
// below functions changed by get entity audit information functions
/*
* Integer ownerId = (Integer)hm.get("owner_id");
* eb.setOwnerId(ownerId.intValue()); Integer updaterId =
* (Integer)hm.get("update_id"); eb.setUpdaterId(updaterId.intValue());
* Integer statusId = (Integer)hm.get("status_id");
* eb.setStatus(Status.get(statusId.intValue()));
*
* Date dateCreated = (Date)hm.get("date_created"); Date dateUpdated =
* (Date)hm.get("date_updated"); eb.setCreatedDate(dateCreated);
* eb.setUpdatedDate(dateUpdated);
*/
eb.setName((String) hm.get("name"));
eb.setDescription((String) hm.get("description"));
eb.setType((String) hm.get("type"));
eb.setCategory((String) hm.get("category"));
eb.setOid((String) hm.get("oc_oid"));
return eb;
}
use of org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean in project OpenClinica by OpenClinica.
the class StudyEventDefinitionDAO method findByStudySubject.
/**
*
* @param studySubjectId
* @return
*/
public Map<Integer, StudyEventDefinitionBean> findByStudySubject(int studySubjectId) {
// <== Must be called first
this.setTypesExpected();
HashMap<Integer, Object> param = new HashMap<Integer, Object>();
param.put(1, studySubjectId);
List selectResult = select(digester.getQuery("findByStudySubject"), param);
Map<Integer, StudyEventDefinitionBean> result = new HashMap<Integer, StudyEventDefinitionBean>();
Iterator it = selectResult.iterator();
while (it.hasNext()) {
StudyEventDefinitionBean bean = (StudyEventDefinitionBean) this.getEntityFromHashMap((HashMap) it.next());
result.put(bean.getId(), bean);
}
return result;
}
use of org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean in project OpenClinica by OpenClinica.
the class StudyEventDefinitionDAO 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()));
ArrayList alist = this.select(digester.getQuery("findAllWithStudyEvent"), variables);
Iterator it = alist.iterator();
while (it.hasNext()) {
StudyEventDefinitionBean seb = (StudyEventDefinitionBean) this.getEntityFromHashMap((HashMap) it.next());
answer.add(seb);
}
return answer;
}
use of org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean in project OpenClinica by OpenClinica.
the class StudyEventDefinitionDAO method update.
public EntityBean update(EntityBean eb) {
StudyEventDefinitionBean sedb = (StudyEventDefinitionBean) eb;
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(sedb.getStudyId()));
variables.put(new Integer(2), sedb.getName());
variables.put(new Integer(3), sedb.getDescription());
variables.put(new Integer(4), new Boolean(sedb.isRepeating()));
variables.put(new Integer(5), sedb.getType());
variables.put(new Integer(6), sedb.getCategory());
variables.put(new Integer(7), new Integer(sedb.getStatus().getId()));
variables.put(new Integer(8), new Integer(sedb.getUpdaterId()));
variables.put(new Integer(9), new Integer(sedb.getOrdinal()));
variables.put(new Integer(10), new Integer(sedb.getId()));
this.execute(digester.getQuery("update"), variables);
return eb;
}
Aggregations