コード例 #1
0
 public Object getEntityFromHashMap(HashMap hm) {
   ItemDataBean eb = new ItemDataBean();
   this.setEntityAuditInformation(eb, hm);
   eb.setId(((Integer) hm.get("item_data_id")).intValue());
   eb.setEventCRFId(((Integer) hm.get("event_crf_id")).intValue());
   eb.setItemId(((Integer) hm.get("item_id")).intValue());
   eb.setValue((String) hm.get("value"));
   eb.setStatus(Status.get(((Integer) hm.get("status_id")).intValue()));
   return eb;
 }
コード例 #2
0
  public EntityBean create(EntityBean eb) {
    ItemDataBean idb = (ItemDataBean) eb;
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(idb.getEventCRFId()));
    variables.put(new Integer(2), new Integer(idb.getItemId()));
    variables.put(new Integer(3), new Integer(idb.getStatus().getId()));
    variables.put(new Integer(4), idb.getValue());
    variables.put(new Integer(5), new Integer(idb.getOwnerId()));
    this.execute(digester.getQuery("create"), variables);

    if (isQuerySuccessful()) {
      idb.setId(getCurrentPK());
    }

    return idb;
  }
コード例 #3
0
ファイル: ItemDAO.java プロジェクト: gabrielgt/OpenClinica
  public ArrayList<ItemBean> findAllWithItemDataByCRFVersionId(int crfVersionId, int eventCRFId) {
    this.unsetTypeExpected();

    this.setTypeExpected(1, TypeNames.STRING); // (item)name
    this.setTypeExpected(2, TypeNames.INT); // ordinal
    this.setTypeExpected(3, TypeNames.STRING); // oc_oid
    this.setTypeExpected(4, TypeNames.INT); // item_data_id
    this.setTypeExpected(5, TypeNames.INT); // item_id
    this.setTypeExpected(6, TypeNames.STRING); // (item)value

    ArrayList<ItemBean> answer = new ArrayList<ItemBean>();

    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(crfVersionId));
    variables.put(new Integer(2), new Integer(eventCRFId));

    String sql = digester.getQuery("findAllWithItemDataByCRFVersionId");

    ArrayList rows = super.select(sql, variables);
    Iterator it = rows.iterator();
    int cur_item_id = 0;
    ItemBean item_bean = null;
    ItemDataBean item_data_bean = null;
    while (it.hasNext()) {
      HashMap row = (HashMap) it.next();
      Integer id = (Integer) row.get("item_id");
      if (cur_item_id != id.intValue()) {
        item_bean = new ItemBean();
        answer.add(item_bean);
        cur_item_id = id.intValue();
        item_bean.setId(cur_item_id);
        item_bean.setName((String) row.get("name"));
        item_bean.setOid((String) row.get("oc_oid"));
      }
      item_data_bean = new ItemDataBean();
      item_data_bean.setValue((String) row.get("value"));
      item_data_bean.setOrdinal(((Integer) row.get("ordinal")).intValue());
      item_data_bean.setId(((Integer) row.get("item_data_id")).intValue());
      item_data_bean.setItemId(cur_item_id);
      item_bean.addItemDataElement(item_data_bean);
    }

    return answer;
  }