protected synchronized void auditTrail(String opMode, AbstractBaseObject obj) throws ApplicationException { Vector oldValues = new Vector(); Vector newValues = new Vector(); MtmWfStepNotificationRule tmpMtmWfStepNotificationRule = (MtmWfStepNotificationRule) this.oldValue; if (tmpMtmWfStepNotificationRule != null) { oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getID())); oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getWorkflowStepID())); oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getNotifyTrigger())); oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getNotifyAtField())); oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getNotifyAtAmt())); oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getNotifyAckMethod())); oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getRecordStatus())); oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getUpdateCount())); oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getCreatorID())); oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getCreateDate())); oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getUpdaterID())); oldValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getUpdateDate())); } tmpMtmWfStepNotificationRule = (MtmWfStepNotificationRule) obj; if (tmpMtmWfStepNotificationRule != null) { newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getID())); newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getWorkflowStepID())); newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getNotifyTrigger())); newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getNotifyAtField())); newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getNotifyAtAmt())); newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getNotifyAckMethod())); newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getRecordStatus())); newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getUpdateCount())); newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getCreatorID())); newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getCreateDate())); newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getUpdaterID())); newValues.add(toAuditTrailValue(tmpMtmWfStepNotificationRule.getUpdateDate())); } auditTrailBase(opMode, oldValues, newValues); }
protected synchronized AbstractBaseObject delete(AbstractBaseObject obj) throws ApplicationException { PreparedStatement preStat = null; StringBuffer sqlStat = new StringBuffer(); MtmWfStepNotificationRule tmpMtmWfStepNotificationRule = (MtmWfStepNotificationRule) ((MtmWfStepNotificationRule) obj).clone(); synchronized (dbConn) { try { int updateCnt = 0; sqlStat.append("DELETE "); sqlStat.append("FROM MTM_WF_STEP_NOTIFY_RULE "); sqlStat.append("WHERE ID=? AND UPDATE_COUNT=? "); preStat = dbConn.prepareStatement( sqlStat.toString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); setPrepareStatement(preStat, 1, tmpMtmWfStepNotificationRule.getID()); setPrepareStatement(preStat, 2, tmpMtmWfStepNotificationRule.getUpdateCount()); updateCnt = preStat.executeUpdate(); if (updateCnt == 0) { throw new ApplicationException(ErrorConstant.DB_CONCURRENT_ERROR); } else { return (tmpMtmWfStepNotificationRule); } } catch (ApplicationException appEx) { throw appEx; } catch (SQLException sqle) { log.error(sqle, sqle); throw new ApplicationException(ErrorConstant.DB_GENERAL_ERROR, sqle, sqle.toString()); } catch (Exception e) { log.error(e, e); throw new ApplicationException(ErrorConstant.DB_DELETE_ERROR, e); } finally { try { preStat.close(); } catch (Exception ignore) { } finally { preStat = null; } } } }
protected synchronized AbstractBaseObject update(AbstractBaseObject obj) throws ApplicationException { PreparedStatement preStat = null; StringBuffer sqlStat = new StringBuffer(); MtmWfStepNotificationRule tmpMtmWfStepNotificationRule = (MtmWfStepNotificationRule) ((MtmWfStepNotificationRule) obj).clone(); synchronized (dbConn) { try { int updateCnt = 0; Timestamp currTime = Utility.getCurrentTimestamp(); sqlStat.append("UPDATE MTM_WF_STEP_NOTIFY_RULE "); sqlStat.append( "SET WORKFLOW_STEP_ID=?, NOTIFY_TRIGGER=?, NOTIFY_AT_FIELD=?, NOTIFY_AT_AMT=?, NOTIFY_ACK_METHOD=?, UPDATE_COUNT=?, UPDATER_ID=?, UPDATE_DATE=? "); sqlStat.append("WHERE ID=? AND UPDATE_COUNT=? "); preStat = dbConn.prepareStatement( sqlStat.toString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); setPrepareStatement(preStat, 1, tmpMtmWfStepNotificationRule.getWorkflowStepID()); setPrepareStatement(preStat, 2, tmpMtmWfStepNotificationRule.getNotifyTrigger()); setPrepareStatement(preStat, 3, tmpMtmWfStepNotificationRule.getNotifyAtField()); setPrepareStatement(preStat, 4, tmpMtmWfStepNotificationRule.getNotifyAtAmt()); setPrepareStatement(preStat, 5, tmpMtmWfStepNotificationRule.getNotifyAckMethod()); setPrepareStatement( preStat, 6, new Integer(tmpMtmWfStepNotificationRule.getUpdateCount().intValue() + 1)); setPrepareStatement(preStat, 7, sessionContainer.getUserRecordID()); setPrepareStatement(preStat, 8, currTime); setPrepareStatement(preStat, 9, tmpMtmWfStepNotificationRule.getID()); setPrepareStatement(preStat, 10, tmpMtmWfStepNotificationRule.getUpdateCount()); updateCnt = preStat.executeUpdate(); if (updateCnt == 0) { throw new ApplicationException(ErrorConstant.DB_CONCURRENT_ERROR); } else { tmpMtmWfStepNotificationRule.setUpdaterID(sessionContainer.getUserRecordID()); tmpMtmWfStepNotificationRule.setUpdateDate(currTime); tmpMtmWfStepNotificationRule.setUpdateCount( new Integer(tmpMtmWfStepNotificationRule.getUpdateCount().intValue() + 1)); tmpMtmWfStepNotificationRule.setCreatorName( UserInfoFactory.getUserFullName(tmpMtmWfStepNotificationRule.getCreatorID())); tmpMtmWfStepNotificationRule.setUpdaterName( UserInfoFactory.getUserFullName(tmpMtmWfStepNotificationRule.getUpdaterID())); return (tmpMtmWfStepNotificationRule); } } catch (ApplicationException appEx) { throw appEx; } catch (SQLException sqle) { log.error(sqle, sqle); throw new ApplicationException(ErrorConstant.DB_GENERAL_ERROR, sqle, sqle.toString()); } catch (Exception e) { log.error(e, e); throw new ApplicationException(ErrorConstant.DB_UPDATE_ERROR, e); } finally { try { preStat.close(); } catch (Exception ignore) { } finally { preStat = null; } } } }