1 64 package com.jcorporate.expresso.core.dbobj; 65 66 import com.jcorporate.expresso.core.db.DBConnection; 67 import com.jcorporate.expresso.core.db.DBException; 68 import com.jcorporate.expresso.ext.dbobj.AuditLog; 69 70 71 82 public class AuditedSecuredDBObject extends SecuredDBObject { 83 84 89 public AuditedSecuredDBObject() throws DBException { 90 super(); 91 } 92 93 100 public AuditedSecuredDBObject(DBConnection theConnection) 101 throws DBException { 102 super(theConnection); 103 } 104 105 106 114 public synchronized void add() throws DBException { 115 AuditLog auditLog = new AuditLog(); 116 auditLog.setField("AUDITLOG_CODE", "ADD"); 117 auditLog.setField("EXPUID", "" + this.getRequestingUid()); 118 com.jcorporate.expresso.core.dataobjects.jdbc.JDBCObjectMetaData metadata = this.getJDBCMetaData(); 119 auditLog.setField("AUDITLOG_DES", 120 metadata.getDescription() + " (Table: " + metadata.getTargetSQLTable(this.getDataContext()) + ")"); 121 auditLog.add(); 122 this.setField("AUDITLOG_ID", auditLog.getField("AUDITLOG_ID")); 123 super.add(); 124 } 125 126 135 public synchronized void delete() throws DBException { 136 AuditLog auditLog = new AuditLog(); 137 auditLog.setField("AUDITLOG_CODE", "DEL"); 138 auditLog.setField("EXPUID", "" + this.getRequestingUid()); 139 com.jcorporate.expresso.core.dataobjects.jdbc.JDBCObjectMetaData metadata = this.getJDBCMetaData(); 140 auditLog.setField("AUDITLOG_DES", 141 metadata.getDescription() + " (Table: " + metadata.getTargetSQLTable(this.getDataContext()) + ")"); 142 auditLog.add(); 143 this.setField("AUDITLOG_ID", auditLog.getField("AUDITLOG_ID")); 144 super.delete(); 145 } 146 147 156 public synchronized void update() throws DBException { 157 AuditLog auditLog = new AuditLog(); 158 auditLog.setField("AUDITLOG_CODE", "UPT"); 159 auditLog.setField("EXPUID", "" + this.getRequestingUid()); 160 com.jcorporate.expresso.core.dataobjects.jdbc.JDBCObjectMetaData metadata = this.getJDBCMetaData(); 161 auditLog.setField("AUDITLOG_DES", 162 metadata.getDescription() + " (Table: " + metadata.getTargetSQLTable(this.getDataContext()) + ")"); 163 auditLog.add(); 164 this.setField("AUDITLOG_ID", auditLog.getField("AUDITLOG_ID")); 165 super.update(); 166 } 167 } 168 | Popular Tags |