Search in sources :

Example 6 with ItemBean

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;
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) Date(java.util.Date)

Example 7 with ItemBean

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;
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 8 with ItemBean

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;
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) ArrayList(java.util.ArrayList)

Example 9 with ItemBean

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;
    }
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 10 with ItemBean

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;
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Aggregations

ItemBean (org.akaza.openclinica.bean.submit.ItemBean)132 ArrayList (java.util.ArrayList)77 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)56 HashMap (java.util.HashMap)50 ItemDAO (org.akaza.openclinica.dao.submit.ItemDAO)43 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)42 ItemFormMetadataBean (org.akaza.openclinica.bean.submit.ItemFormMetadataBean)36 ItemGroupBean (org.akaza.openclinica.bean.submit.ItemGroupBean)26 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)25 Iterator (java.util.Iterator)23 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)22 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)22 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)21 ItemFormMetadataDAO (org.akaza.openclinica.dao.submit.ItemFormMetadataDAO)20 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)15 SectionBean (org.akaza.openclinica.bean.submit.SectionBean)15 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)15 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)13 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)13 DisplayItemGroupBean (org.akaza.openclinica.bean.submit.DisplayItemGroupBean)13