Search in sources :

Example 91 with StudySubjectBean

use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.

the class DiscrepancyNoteUtil method injectDiscNotesIntoStudyEvents.

/**
     * This method links discrepancy notes to the study event and study subject
     * associated with those notes
     *
     * @param studyBeans
     *            A List of StudyEventBeans.
     * @param allDiscNotes
     *            A List of DiscrepancyNoteBeans associated with a single study.
     * @param dataSource
     *            A DataSource used to get from the database a study subject
     *            associated with a study event.
     */
public void injectDiscNotesIntoStudyEvents(List<StudyEventBean> studyBeans, List<DiscrepancyNoteBean> allDiscNotes, DataSource dataSource) {
    if (studyBeans == null || allDiscNotes == null) {
        return;
    }
    StudySubjectDAO studySubjDAO = new StudySubjectDAO(dataSource);
    StudySubjectBean studySubjBean = new StudySubjectBean();
    for (StudyEventBean sbean : studyBeans) {
        // Get the StudySubjectBean associated with the study event
        studySubjBean = (StudySubjectBean) studySubjDAO.findByPK(sbean.getStudySubjectId());
        // equals the StudySubjectBean's name
        for (DiscrepancyNoteBean discBean : allDiscNotes) {
            if (sbean.getStudyEventDefinition().getName().equalsIgnoreCase(discBean.getEventName()) && studySubjBean.getLabel().equalsIgnoreCase(discBean.getSubjectName())) {
                // add discrepancy note to the study event list of notes
                // Each study bean has a List property containing its
                // associated
                // DiscrepancyNoteBeans
                sbean.getDiscBeanList().add(discBean);
            }
        }
    }
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) DiscrepancyNoteBean(org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) DisplayStudyEventBean(org.akaza.openclinica.bean.managestudy.DisplayStudyEventBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO)

Example 92 with StudySubjectBean

use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.

the class ExtractBean method addStudySubjectData.

/**
     * @vbc 08/06/2008 NEW EXTRACT DATA IMPLEMENTATION replaced the old one with
     *      a new function
     */
public void addStudySubjectData(ArrayList objs) {
    for (int i = 0; i < objs.size(); i++) {
        StudySubjectBean sub = new StudySubjectBean();
        sub = (StudySubjectBean) objs.get(i);
        subjects.add(sub);
    }
// for
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean)

Example 93 with StudySubjectBean

use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.

the class StudySubjectDAO method create.

/**
     * @deprecated Creates a new studysubject
     */
@Override
@Deprecated
public EntityBean create(EntityBean eb) {
    StudySubjectBean sb = (StudySubjectBean) eb;
    HashMap variables = new HashMap();
    HashMap nullVars = new HashMap();
    // INSERT INTO study_subject
    // (LABEL, SUBJECT_ID, STUDY_ID, STATUS_ID,
    // DATE_CREATED, OWNER_ID, ENROLLMENT_DATE,SECONDARY_LABEL)
    // VALUES (?,?,?,?,NOW(),?,?,?)
    int ind = 1;
    variables.put(new Integer(ind), sb.getLabel());
    ind++;
    variables.put(new Integer(ind), new Integer(sb.getSubjectId()));
    ind++;
    variables.put(new Integer(ind), new Integer(sb.getStudyId()));
    ind++;
    variables.put(new Integer(ind), new Integer(sb.getStatus().getId()));
    ind++;
    // Date_created is now()
    variables.put(new Integer(ind), new Integer(sb.getOwnerId()));
    ind++;
    // ind++;
    if (sb.getEnrollmentDate() == null) {
        nullVars.put(new Integer(ind), new Integer(Types.DATE));
        variables.put(new Integer(ind), null);
        ind++;
    } else {
        variables.put(new Integer(ind), sb.getEnrollmentDate());
        ind++;
    }
    variables.put(new Integer(ind), sb.getSecondaryLabel());
    ind++;
    this.execute(digester.getQuery("create"), variables, nullVars);
    if (isQuerySuccessful()) {
        sb.setId(getCurrentPK());
    }
    return sb;
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap)

Example 94 with StudySubjectBean

use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.

the class StudySubjectDAO method findSameByLabelAndStudy.

/**
     * Finds a study subject which has the same label provided in the same study
     *
     * @param label
     * @param studyId
     * @param id
     * @return
     */
public StudySubjectBean findSameByLabelAndStudy(String label, int studyId, int id) {
    StudySubjectBean answer = 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(studyId));
    variables.put(new Integer(4), new Integer(id));
    String sql = digester.getQuery("findSameByLabelAndStudy");
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        answer = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
    }
    return answer;
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 95 with StudySubjectBean

use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.

the class StudySubjectDAO method findAllBySubjectId.

public ArrayList findAllBySubjectId(int subjectId) {
    ArrayList answer = new ArrayList();
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(subjectId));
    String sql = digester.getQuery("findAllBySubjectId");
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        StudySubjectBean ssb = (StudySubjectBean) this.getEntityFromHashMap((HashMap) it.next());
        answer.add(ssb);
    }
    return answer;
}
Also used : HashMap(java.util.HashMap) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Aggregations

StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)155 ArrayList (java.util.ArrayList)102 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)86 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)71 HashMap (java.util.HashMap)66 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)66 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)57 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)52 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)52 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)49 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)45 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)43 Date (java.util.Date)42 Iterator (java.util.Iterator)38 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)35 SubjectBean (org.akaza.openclinica.bean.submit.SubjectBean)29 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)26 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)26 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)26 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)23