/** Updates a Study event */ public EntityBean update(EntityBean eb) { // update discrepancy_note set // description =?, // discrepancy_note_type_id =? , // resolution_status_id =? , // detailed_notes =? // where discrepancy_note_id=? DiscrepancyNoteBean dnb = (DiscrepancyNoteBean) eb; dnb.setActive(false); HashMap variables = new HashMap(); variables.put(new Integer(1), dnb.getDescription()); variables.put(new Integer(2), new Integer(dnb.getDiscrepancyNoteTypeId())); variables.put(new Integer(3), new Integer(dnb.getResolutionStatusId())); variables.put(new Integer(4), dnb.getDetailedNotes()); variables.put(new Integer(5), new Integer(dnb.getId())); this.execute(digester.getQuery("update"), variables); if (isQuerySuccessful()) { dnb.setActive(true); } return dnb; }
/** Creates a new discrepancy note */ public EntityBean create(EntityBean eb) { DiscrepancyNoteBean sb = (DiscrepancyNoteBean) eb; HashMap variables = new HashMap(); HashMap nullVars = new HashMap(); // INSERT INTO discrepancy_note // (description, discrepancy_note_type_id , // resolution_status_id , detailed_notes , date_created, // owner_id, parent_dn_id) // VALUES (?,?,?,?,now(),?,?) variables.put(new Integer(1), sb.getDescription()); variables.put(new Integer(2), new Integer(sb.getDiscrepancyNoteTypeId())); variables.put(new Integer(3), new Integer(sb.getResolutionStatusId())); variables.put(new Integer(4), sb.getDetailedNotes()); variables.put(new Integer(5), new Integer(sb.getOwner().getId())); if (sb.getParentDnId() == 0) { nullVars.put(new Integer(6), new Integer(Types.INTEGER)); variables.put(new Integer(6), null); } else { variables.put(new Integer(6), new Integer(sb.getParentDnId())); } variables.put(new Integer(7), sb.getEntityType()); variables.put(new Integer(8), new Integer(sb.getStudyId())); this.executeWithPK(digester.getQuery("create"), variables, nullVars); if (isQuerySuccessful()) { sb.setId(getLatestPK()); } return sb; }