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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations