Search in sources :

Example 46 with StudyEventBean

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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean)

Example 47 with StudyEventBean

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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean)

Example 48 with StudyEventBean

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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean)

Example 49 with StudyEventBean

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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean)

Example 50 with StudyEventBean

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;
}
Also used : HashMap(java.util.HashMap) StudyEventChangeDetails(org.akaza.openclinica.patterns.ocobserver.StudyEventChangeDetails) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) Timestamp(java.sql.Timestamp) StudyEventBeanContainer(org.akaza.openclinica.patterns.ocobserver.StudyEventBeanContainer)

Aggregations

StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)162 ArrayList (java.util.ArrayList)103 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)91 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)90 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)74 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)71 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)62 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)62 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)60 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)58 Date (java.util.Date)52 HashMap (java.util.HashMap)50 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)47 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)43 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)37 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)37 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)36 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)34 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)34 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)31