use of org.akaza.openclinica.bean.submit.ItemBean in project OpenClinica by OpenClinica.
the class ItemDAO method getEntityFromHashMap.
public Object getEntityFromHashMap(HashMap hm) {
ItemBean eb = new ItemBean();
// below inserted to find out a class cast exception, tbh
Date dateCreated = (Date) hm.get("date_created");
Date dateUpdated = (Date) hm.get("date_updated");
Integer statusId = (Integer) hm.get("status_id");
Integer ownerId = (Integer) hm.get("owner_id");
Integer updateId = (Integer) hm.get("update_id");
eb.setCreatedDate(dateCreated);
eb.setUpdatedDate(dateUpdated);
eb.setStatus(Status.get(statusId.intValue()));
eb.setOwnerId(ownerId.intValue());
eb.setUpdaterId(updateId.intValue());
// something to trip over
// something else to trip over
// eb = (ItemBean)this.getEntityAuditInformation(hm);
eb.setName((String) hm.get("name"));
eb.setId(((Integer) hm.get("item_id")).intValue());
eb.setDescription((String) hm.get("description"));
eb.setUnits((String) hm.get("units"));
eb.setPhiStatus(((Boolean) hm.get("phi_status")).booleanValue());
eb.setItemDataTypeId(((Integer) hm.get("item_data_type_id")).intValue());
eb.setItemReferenceTypeId(((Integer) hm.get("item_reference_type_id")).intValue());
// logger.info("item name|date type id" + eb.getName() + "|" +
// eb.getItemDataTypeId());
eb.setDataType(ItemDataType.get(eb.getItemDataTypeId()));
eb.setOid((String) hm.get("oc_oid"));
// the rest should be all set
return eb;
}
use of org.akaza.openclinica.bean.submit.ItemBean in project OpenClinica by OpenClinica.
the class FormLayoutDAO method findItemUsedByOtherVersion.
public Collection findItemUsedByOtherVersion(int versionId) {
this.unsetTypeExpected();
this.setTypeExpected(1, TypeNames.INT);
this.setTypeExpected(2, TypeNames.STRING);
this.setTypeExpected(3, TypeNames.INT);
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(versionId));
String sql = digester.getQuery("findItemUsedByOtherVersion");
ArrayList alist = this.select(sql, variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
ItemBean eb = new ItemBean();
HashMap hm = (HashMap) it.next();
eb.setId(((Integer) hm.get("item_id")).intValue());
eb.setName((String) hm.get("name"));
eb.setOwnerId(((Integer) hm.get("owner_id")).intValue());
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.submit.ItemBean in project OpenClinica by OpenClinica.
the class FormLayoutDAO method generateDeleteQueries.
/**
* Generates all the delete queries for deleting a version
*
* @param versionId
* @param items
*/
public ArrayList generateDeleteQueries(int versionId, ArrayList items) {
ArrayList sqls = new ArrayList();
String sql = digester.getQuery("deleteScdItemMetadataByVersion") + versionId + ")";
sqls.add(sql);
sql = digester.getQuery("deleteItemMetaDataByVersion") + versionId;
sqls.add(sql);
sql = digester.getQuery("deleteSectionsByVersion") + versionId;
sqls.add(sql);
sql = digester.getQuery("deleteItemMapByVersion") + versionId;
sqls.add(sql);
sql = digester.getQuery("deleteItemGroupMetaByVersion") + versionId;
sqls.add(sql);
for (int i = 0; i < items.size(); i++) {
ItemBean item = (ItemBean) items.get(i);
sql = digester.getQuery("deleteItemsByVersion") + item.getId();
sqls.add(sql);
}
sql = digester.getQuery("deleteResponseSetByVersion") + versionId;
sqls.add(sql);
sql = digester.getQuery("deleteFormLayoutMediaByVersion") + versionId;
sqls.add(sql);
sql = digester.getQuery("delete") + versionId;
sqls.add(sql);
return sqls;
}
use of org.akaza.openclinica.bean.submit.ItemBean in project OpenClinica by OpenClinica.
the class ItemDAO method findItemByGroupIdandItemOid.
public ItemBean findItemByGroupIdandItemOid(int id, String itemOid) {
ItemBean bean;
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(1, id);
variables.put(2, itemOid);
String sql = digester.getQuery("findItemByGroupIdandItemOid");
ArrayList rows = this.select(sql, variables);
Iterator it = rows.iterator();
if (it.hasNext()) {
bean = (ItemBean) this.getEntityFromHashMap((HashMap) it.next());
return bean;
} else {
return null;
}
}
use of org.akaza.openclinica.bean.submit.ItemBean in project OpenClinica by OpenClinica.
the class ItemDAO method findByName.
public EntityBean findByName(String name) {
ItemBean eb = new ItemBean();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), name);
String sql = digester.getQuery("findByName");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
eb = (ItemBean) this.getEntityFromHashMap((HashMap) it.next());
}
return eb;
}
Aggregations