Search in sources :

Example 11 with StudyBean

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

the class StudyDAO method update.

/**
     * <b>update </b>, the method that returns an updated study bean after it
     * updates the database. Note that we can use the three stages from our
     * creation use case.
     * 
     * @return sb an updated study bean.
     */
public EntityBean update(EntityBean eb) {
    StudyBean sb = (StudyBean) eb;
    sb = this.updateStepOne(sb);
    sb = this.createStepTwo(sb);
    sb = this.createStepThree(sb);
    sb = this.createStepFour(sb);
    return sb;
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean)

Example 12 with StudyBean

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

the class StudyDAO method getEntityFromHashMap.

/*
     * public HashMap fillVariables(StudyBean sb) { HashMap variables = new
     * HashMap(); variables.put(new Integer(1),new
     * Integer(sb.getParentStudyId())); variables.put(new
     * Integer(2),sb.getLabel()); return variables; }
     */
/**
     * <p>
     * getEntityFromHashMap, the method that gets the object from the database
     * query.
     */
public Object getEntityFromHashMap(HashMap hm) {
    StudyBean eb = new StudyBean();
    // first set all the strings
    eb.setIdentifier((String) hm.get("unique_identifier"));
    eb.setName((String) hm.get("name"));
    eb.setSummary((String) hm.get("summary"));
    eb.setSecondaryIdentifier((String) hm.get("secondary_identifier"));
    eb.setPrincipalInvestigator((String) hm.get("principal_investigator"));
    eb.setFacilityName((String) hm.get("facility_name"));
    eb.setFacilityCity((String) hm.get("facility_city"));
    eb.setFacilityState((String) hm.get("facility_state"));
    eb.setFacilityZip((String) hm.get("facility_zip"));
    eb.setFacilityCountry((String) hm.get("facility_country"));
    eb.setFacilityRecruitmentStatus((String) hm.get("facility_recruitment_status"));
    eb.setFacilityContactName((String) hm.get("facility_contact_name"));
    eb.setFacilityContactDegree((String) hm.get("facility_contact_degree"));
    eb.setFacilityContactPhone((String) hm.get("facility_contact_phone"));
    eb.setFacilityContactEmail((String) hm.get("facility_contact_email"));
    eb.setProtocolType((String) hm.get("protocol_type"));
    eb.setProtocolDescription((String) hm.get("protocol_description"));
    eb.setPhase((String) hm.get("phase"));
    eb.setSponsor((String) hm.get("sponsor"));
    eb.setCollaborators((String) hm.get("collaborators"));
    eb.setMedlineIdentifier((String) hm.get("medline_identifier"));
    eb.setUrl((String) hm.get("url"));
    eb.setUrlDescription((String) hm.get("url_description"));
    eb.setConditions((String) hm.get("conditions"));
    eb.setKeywords((String) hm.get("keywords"));
    eb.setEligibility((String) hm.get("eligibility"));
    String gender = (String) hm.get("gender");
    // char[] genderarr = gender.toCharArray();
    // Character gender = (Character)hm.get("gender");
    // eb.setGender(gender.charValue());//CHAR?
    eb.setGender(gender);
    // throws null pointer exception?
    eb.setAgeMax((String) hm.get("age_max"));
    eb.setAgeMin((String) hm.get("age_min"));
    eb.setPurpose((String) hm.get("purpose"));
    eb.setAllocation((String) hm.get("allocation"));
    eb.setMasking((String) hm.get("masking"));
    eb.setControl((String) hm.get("control"));
    eb.setAssignment((String) hm.get("assignment"));
    eb.setEndpoint((String) hm.get("endpoint"));
    eb.setInterventions((String) hm.get("interventions"));
    eb.setDuration((String) hm.get("duration"));
    eb.setSelection((String) hm.get("selection"));
    eb.setTiming((String) hm.get("timing"));
    eb.setOfficialTitle((String) hm.get("official_title"));
    eb.setHealthyVolunteerAccepted(((Boolean) hm.get("healthy_volunteer_accepted")).booleanValue());
    eb.setResultsReference(((Boolean) hm.get("results_reference")).booleanValue());
    // eb.setUsingDOB(((Boolean)hm.get("collect_dob")).booleanValue());
    //eb.setDiscrepancyManagement(((Boolean)hm.get("discrepancy_management")
    // ).booleanValue());
    // next set all the ints/dates
    Integer studyId = (Integer) hm.get("study_id");
    eb.setId(studyId.intValue());
    Integer parentStudyId = (Integer) hm.get("parent_study_id");
    if (parentStudyId == null) {
        eb.setParentStudyId(0);
    } else {
        eb.setParentStudyId(parentStudyId.intValue());
    }
    Integer ownerId = (Integer) hm.get("owner_id");
    eb.setOwnerId(ownerId.intValue());
    Integer updateId = (Integer) hm.get("update_id");
    eb.setUpdaterId(updateId.intValue());
    Integer typeId = (Integer) hm.get("type_id");
    eb.setType(StudyType.get(typeId.intValue()));
    Integer statusId = (Integer) hm.get("status_id");
    eb.setStatus(Status.get(statusId.intValue()));
    Integer expecTotalEnrollment = (Integer) hm.get("expected_total_enrollment");
    eb.setExpectedTotalEnrollment(expecTotalEnrollment.intValue());
    Date dateCreated = (Date) hm.get("date_created");
    Date dateUpdated = (Date) hm.get("date_updated");
    Date datePlannedStart = (Date) hm.get("date_planned_start");
    Date datePlannedEnd = (Date) hm.get("date_planned_end");
    Date dateProtocolVerification = (Date) hm.get("protocol_date_verification");
    eb.setCreatedDate(dateCreated);
    eb.setUpdatedDate(dateUpdated);
    eb.setDatePlannedStart(datePlannedStart);
    eb.setDatePlannedEnd(datePlannedEnd);
    // added by
    eb.setProtocolDateVerification(dateProtocolVerification);
    // jxu
    eb.setStatus(Status.get(statusId.intValue()));
    eb.setOid((String) hm.get("oc_oid"));
    Integer oldStatusId = (Integer) hm.get("old_status_id");
    eb.setOldStatus(Status.get(oldStatusId));
    return eb;
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) Date(java.util.Date)

Example 13 with StudyBean

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

the class StudyDAO method findByUniqueIdentifier.

public StudyBean findByUniqueIdentifier(String oid) {
    StudyBean sb = null;
    this.unsetTypeExpected();
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), oid);
    ArrayList alist = this.select(digester.getQuery("findByUniqueIdentifier"), variables);
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        sb = (StudyBean) this.getEntityFromHashMap((HashMap) it.next());
        return sb;
    } else {
        logger.info("returning null from find by Unique Identifier...");
        return null;
    }
}
Also used : HashMap(java.util.HashMap) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 14 with StudyBean

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

the class StudyDAO method findAllByStatus.

public ArrayList findAllByStatus(Status status) {
    this.unsetTypeExpected();
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(status.getId()));
    String sql = digester.getQuery("findAllByStatus");
    ArrayList alist = this.select(sql, variables);
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        StudyBean eb = (StudyBean) this.getEntityFromHashMap((HashMap) it.next());
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 15 with StudyBean

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

the class StudyDAO method findAllByLimit.

public Collection findAllByLimit(boolean isLimited) {
    this.setTypesExpected();
    String sql = null;
    // Updated for ORACLE and PGSQL compatibility
    if (isLimited) {
        if (CoreResources.getDBName().equals("oracle")) {
            sql = digester.getQuery("findAll") + " where ROWNUM <=5";
        } else {
            sql = digester.getQuery("findAll") + " limit 5";
        }
    } else {
        sql = digester.getQuery("findAll");
    }
    ArrayList alist = this.select(sql);
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        StudyBean eb = (StudyBean) this.getEntityFromHashMap((HashMap) it.next());
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Aggregations

StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)350 ArrayList (java.util.ArrayList)183 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)175 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)92 HashMap (java.util.HashMap)84 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)66 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)65 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)62 Date (java.util.Date)59 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)58 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)57 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)56 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)54 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)52 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)52 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)45 Locale (java.util.Locale)39 UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)39 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)37 Iterator (java.util.Iterator)36