private ItemDataBean copyItemDataBean(ItemDataBean src) { ItemDataBean result = new ItemDataBean(); result.setEventCRFId(src.getEventCRFId()); result.setItemId(src.getItemId()); result.setValue(src.getValue()); result.setOrdinal(src.getOrdinal()); result.setSelected(src.isSelected()); result.setAuditLog(src.isAuditLog()); result.setCreatedDate(src.getCreatedDate()); result.setUpdatedDate(src.getUpdatedDate()); result.setOwner(src.getOwner()); result.setOwnerId(src.getOwnerId()); result.setUpdater(src.getUpdater()); result.setUpdaterId(src.getUpdaterId()); result.setStatus(src.getStatus()); return result; }
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; }