1 package transactions.addrbook; 2 3 import dinamica.GenericTableManager; 4 import dinamica.IServiceWrapper; 5 import dinamica.Recordset; 6 7 16 public class DeleteRecord extends GenericTableManager implements IServiceWrapper 17 { 18 19 22 public int service(Recordset inputParams) throws Throwable 23 { 24 return super.service(inputParams); 26 } 27 28 31 public void beforeService(Recordset inputParams) throws Throwable 32 { 33 } 34 35 38 public void afterService(Recordset inputParams) throws Throwable 39 { 40 41 String info = "Deleted record with primary key: " + inputParams.getString("id"); 43 44 Recordset rs = new Recordset(); 46 rs.append("operation", java.sql.Types.VARCHAR); 47 rs.append("target_table", java.sql.Types.VARCHAR); 48 rs.append("extra_info", java.sql.Types.VARCHAR); 49 50 rs.addNew(); 52 rs.setValue("operation", "DELETE"); 53 rs.setValue("target_table", "address_book"); 54 rs.setValue("extra_info", info); 55 56 String sql = getSQL(getLocalResource("delete-audit.sql"), rs); 58 59 getDb().exec(sql); 61 62 } 63 64 } 65 | Popular Tags |