use of org.akaza.openclinica.bean.managestudy.StudyEventBean in project OpenClinica by OpenClinica.
the class StudyEventDAO method findAllWithSubjectLabelByDefinition.
public ArrayList findAllWithSubjectLabelByDefinition(int definitionId) {
this.setTypesExpected(true);
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), Integer.valueOf(definitionId));
String sql = digester.getQuery("findAllWithSubjectLabelByDefinition");
ArrayList alist = this.select(sql, variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
StudyEventBean eb = (StudyEventBean) this.getEntityFromHashMap((HashMap) it.next(), true);
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.managestudy.StudyEventBean in project OpenClinica by OpenClinica.
the class StudyEventDAO method findByPKCached.
public EntityBean findByPKCached(int ID) {
StudyEventBean eb = new StudyEventBean();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(ID));
String sql = digester.getQuery("findByPK");
ArrayList alist = this.selectByCache(sql, variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
eb = (StudyEventBean) this.getEntityFromHashMap((HashMap) it.next());
}
return eb;
}
use of org.akaza.openclinica.bean.managestudy.StudyEventBean in project OpenClinica by OpenClinica.
the class StudyEventDAO method findAllByDefinition.
public Collection findAllByDefinition(int definitionId) {
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), Integer.valueOf(definitionId));
String sql = digester.getQuery("findAllByDefinition");
ArrayList alist = this.select(sql, variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
StudyEventBean eb = (StudyEventBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.managestudy.StudyEventBean in project OpenClinica by OpenClinica.
the class StudyEventDAO method findAllByStudyAndStudySubjectId.
public ArrayList findAllByStudyAndStudySubjectId(StudyBean study, int studySubjectId) {
ArrayList answer = new ArrayList();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), Integer.valueOf(study.getId()));
variables.put(Integer.valueOf(2), Integer.valueOf(study.getId()));
variables.put(Integer.valueOf(3), Integer.valueOf(studySubjectId));
ArrayList alist = this.select(digester.getQuery("findAllByStudyAndStudySubjectId"), variables);
Iterator it = alist.iterator();
while (it.hasNext()) {
StudyEventBean seb = (StudyEventBean) this.getEntityFromHashMap((HashMap) it.next());
answer.add(seb);
}
return answer;
}
use of org.akaza.openclinica.bean.managestudy.StudyEventBean in project OpenClinica by OpenClinica.
the class StudyEventDAO method create.
/**
* Creates a new studysubject
*/
public EntityBean create(EntityBean eb, boolean isTransaction) {
StudyEventBean sb = (StudyEventBean) eb;
HashMap variables = new HashMap();
HashMap nullVars = new HashMap();
// INSERT INTO STUDY_EVENT
// (STUDY_EVENT_DEFINITION_ID,SUBJECT_ID,LOCATION,SAMPLE_ORDINAL,
// DATE_START,DATE_END,OWNER_ID,STATUS_ID,DATE_CREATED,subject_event_status_id
// start_time_flag, end_time_flag)
// VALUES (?,?,?,?,?,?,?,?,NOW())
variables.put(Integer.valueOf(1), Integer.valueOf(sb.getStudyEventDefinitionId()));
variables.put(Integer.valueOf(2), Integer.valueOf(sb.getStudySubjectId()));
variables.put(Integer.valueOf(3), sb.getLocation());
variables.put(Integer.valueOf(4), Integer.valueOf(sb.getSampleOrdinal()));
nullVars.put(3, TypeNames.STRING);
if (sb.getDateStarted() == null) {
// YW 08-16-2007 << data type changed from DATE to TIMESTAMP
nullVars.put(Integer.valueOf(5), Integer.valueOf(TypeNames.TIMESTAMP));
variables.put(Integer.valueOf(5), null);
} else {
// YW 08-16-2007 << data type changed from DATE to TIMESTAMP
variables.put(Integer.valueOf(5), new Timestamp(sb.getDateStarted().getTime()));
}
if (sb.getDateEnded() == null) {
// YW 08-16-2007 << data type changed from DATE to TIMESTAMP
nullVars.put(Integer.valueOf(6), Integer.valueOf(TypeNames.TIMESTAMP));
variables.put(Integer.valueOf(6), null);
} else {
// YW 08-16-2007 << data type changed from DATE to TIMESTAMP
variables.put(Integer.valueOf(6), new Timestamp(sb.getDateEnded().getTime()));
}
variables.put(Integer.valueOf(7), Integer.valueOf(sb.getOwner().getId()));
variables.put(Integer.valueOf(8), Integer.valueOf(sb.getStatus().getId()));
variables.put(Integer.valueOf(9), Integer.valueOf(sb.getSubjectEventStatus().getId()));
variables.put(Integer.valueOf(10), sb.getStartTimeFlag());
variables.put(Integer.valueOf(11), sb.getEndTimeFlag());
this.executeWithPK(digester.getQuery("create"), variables, nullVars);
if (isQuerySuccessful()) {
sb.setId(getLatestPK());
}
StudyEventChangeDetails changeDetails = new StudyEventChangeDetails(true, true);
changeDetails.setRunningInTransaction(isTransaction);
StudyEventBeanContainer container = new StudyEventBeanContainer(sb, changeDetails);
notifyObservers(container);
return sb;
}
Aggregations