Search in sources :

Example 6 with CRFVersionBean

use of org.akaza.openclinica.bean.submit.CRFVersionBean in project OpenClinica by OpenClinica.

the class CRFVersionDAO method findAllActiveByCRF.

public Collection findAllActiveByCRF(int crfId) {
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(crfId));
    String sql = digester.getQuery("findAllActiveByCRF");
    ArrayList alist = this.select(sql, variables);
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        CRFVersionBean eb = (CRFVersionBean) this.getEntityFromHashMap((HashMap) it.next());
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean)

Example 7 with CRFVersionBean

use of org.akaza.openclinica.bean.submit.CRFVersionBean in project OpenClinica by OpenClinica.

the class CRFVersionDAO method update.

public EntityBean update(EntityBean eb) {
    // UPDATE CRF_VERSION SET CRF_ID=?,STATUS_ID=?,NAME=?,
    // DESCRIPTION=?,DATE_UPDATED=NOW(),UPDATE_ID=?,REVISION_NOTES =? WHERE
    // CRF_VERSION_ID=?
    CRFVersionBean ib = (CRFVersionBean) eb;
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(ib.getCrfId()));
    variables.put(new Integer(2), new Integer(ib.getStatus().getId()));
    variables.put(new Integer(3), ib.getName());
    variables.put(new Integer(4), ib.getDescription());
    variables.put(new Integer(5), new Integer(ib.getUpdater().getId()));
    variables.put(new Integer(6), ib.getRevisionNotes());
    variables.put(new Integer(7), new Integer(ib.getId()));
    this.execute(digester.getQuery("update"), variables);
    return eb;
}
Also used : HashMap(java.util.HashMap) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean)

Example 8 with CRFVersionBean

use of org.akaza.openclinica.bean.submit.CRFVersionBean in project OpenClinica by OpenClinica.

the class CRFVersionDAO method findAll.

public Collection findAll() {
    this.setTypesExpected();
    ArrayList al = new ArrayList();
    ArrayList alist = this.select(digester.getQuery("findAll"));
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        CRFVersionBean eb = (CRFVersionBean) this.getEntityFromHashMap((HashMap) it.next());
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean)

Example 9 with CRFVersionBean

use of org.akaza.openclinica.bean.submit.CRFVersionBean in project OpenClinica by OpenClinica.

the class CRFVersionDAO method getEntityFromHashMap.

public Object getEntityFromHashMap(HashMap hm) {
    // CRF_VERSION_ID NAME DESCRIPTION
    // CRF_ID STATUS_ID DATE_CREATED DATE_UPDATED
    // OWNER_ID REVISION_NUMBER UPDATE_ID
    CRFVersionBean eb = new CRFVersionBean();
    super.setEntityAuditInformation(eb, hm);
    eb.setId(((Integer) hm.get("crf_version_id")).intValue());
    eb.setName((String) hm.get("name"));
    eb.setDescription((String) hm.get("description"));
    eb.setCrfId(((Integer) hm.get("crf_id")).intValue());
    eb.setRevisionNotes((String) hm.get("revision_notes"));
    eb.setOid((String) hm.get("oc_oid"));
    eb.setXform((String) hm.get("xform"));
    eb.setXformName((String) hm.get("xform_name"));
    return eb;
}
Also used : CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean)

Example 10 with CRFVersionBean

use of org.akaza.openclinica.bean.submit.CRFVersionBean in project OpenClinica by OpenClinica.

the class CRFVersionDAO method create.

public EntityBean create(EntityBean eb) {
    // "INSERT INTO CRF_VERSION (NAME, DESCRIPTION, CRF_ID, STATUS_ID,DATE_CREATED," +
    // "OWNER_ID,REVISION_NOTES,OC_OID) "
    // + "VALUES ('" + stripQuotes(version) + "','" + stripQuotes(versionDesc) + "'," +
    // "(SELECT CRF_ID FROM CRF WHERE NAME='"
    // + crfName + "'),1,NOW()," + ub.getId() + ",'" + stripQuotes(revisionNotes) + "','" + oid + "')";
    // <sql>INSERT INTO CRF_VERSION (CRF_ID, STATUS_ID, NAME,
    // DESCRIPTION, OWNER_ID,
    // DATE_CREATED, REVISION_NOTES)
    // VALUES (?,?,?,?,?,NOW(),?)</sql>
    CRFVersionBean cvb = (CRFVersionBean) eb;
    HashMap variables = new HashMap();
    // variables.put(Integer.valueOf(2), cb.getLabel());
    variables.put(Integer.valueOf(1), Integer.valueOf(cvb.getCrfId()));
    variables.put(Integer.valueOf(2), Integer.valueOf(cvb.getStatus().getId()));
    variables.put(Integer.valueOf(3), cvb.getName());
    variables.put(Integer.valueOf(4), cvb.getDescription());
    variables.put(Integer.valueOf(5), Integer.valueOf(cvb.getOwner().getId()));
    variables.put(Integer.valueOf(6), cvb.getRevisionNotes());
    variables.put(Integer.valueOf(7), getValidOid(cvb, cvb.getName(), cvb.getOid()));
    variables.put(Integer.valueOf(8), cvb.getXform());
    variables.put(Integer.valueOf(9), cvb.getXformName());
    // am i the only one who runs their daos' unit tests after I change
    // things, tbh?
    this.execute(digester.getQuery("create"), variables);
    if (isQuerySuccessful()) {
        cvb.setActive(true);
    }
    return cvb;
}
Also used : HashMap(java.util.HashMap) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean)

Aggregations

CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)100 ArrayList (java.util.ArrayList)70 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)61 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)54 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)53 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)46 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)44 HashMap (java.util.HashMap)38 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)37 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)36 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)36 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)33 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)32 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)30 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)30 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)29 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)25 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)22 Iterator (java.util.Iterator)20 SectionBean (org.akaza.openclinica.bean.submit.SectionBean)20