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; }
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; }
protected boolean writeToDB( ItemBean ib, ItemFormMetadataBean ifm, ItemDataBean idb, String exp, String value, StringBuffer err) { ItemDataDAO iddao = new ItemDataDAO(sm.getDataSource()); NumberFormat nf = NumberFormat.getInstance(); if (idb == null) { idb = new ItemDataBean(); } ItemDataType idt = ib.getDataType(); if (value == null || value.length() == 0) { if (idb.isActive() && !"".equals(idb.getValue())) { idb.setValue("<erased>"); } else { idb.setValue(""); } err.append("Result is empty in" + " " + exp + "; "); } else { idb.setValue(this.getMathContextValue(value, ifm, idt, err)); } idb.setStatus(Status.UNAVAILABLE); // idb.setNeedsRecalc(false); if (!idb.isActive()) { // will this need to change for double data entry? idb.setCreatedDate(new Date()); idb.setOwner(ub); idb.setItemId(ib.getId()); idb.setEventCRFId(ecb.getId()); idb = (ItemDataBean) iddao.create(idb); } else { idb = (ItemDataBean) iddao.update(idb); } return idb.isActive(); }