@PreAuthorize("isAuthenticated() and (hasRole('ROLE_USER'))")
 @HandleBeforeDelete
 public void beforeTransactionDelete(Transaction transaction) {
   logger.debug(
       String.format(
           "In before delete for a transaction with a category of '%s' and a payee of '%s'",
           transaction.getCategory(), transaction.getPayee()));
   // Don't need to add anything to this method, the @PreAuthorize does the job.
 }
 @PreAuthorize("isAuthenticated() and (hasRole('ROLE_USER'))")
 @HandleBeforeSave
 public void beforeTransactionUpdate(Transaction transaction) {
   logger.debug(
       String.format(
           "In before update for a transaction with a category of '%s' and a payee of '%s'",
           transaction.getCategory(), transaction.getPayee()));
   transaction.setUpdatedDate(Calendar.getInstance().getTime());
 }
 @HandleAfterDelete
 public void afterTransactionDelete(Transaction transaction) {
   logger.debug("In after delete transaction");
   updateAccountTotal(transaction.getAccount().getId(), transaction.getAmount() * -1);
   updateTransactionOpeningBalances(transaction, TransactionMessage.Type.DELETE);
 }
 @HandleAfterSave
 public void afterTransactionUpdate(Transaction transaction) {
   logger.debug("In after update transaction");
   updateTransactionOpeningBalances(transaction, TransactionMessage.Type.UPDATE);
   updateAccountTotal(transaction.getAccount().getId(), transaction.getAdjustment());
 }
 @HandleAfterCreate
 public void afterTransactionCreate(Transaction transaction) {
   logger.debug("In after create transaction");
   updateAccountTotal(transaction.getAccount().getId(), transaction.getAmount());
   updateTransactionOpeningBalances(transaction, TransactionMessage.Type.INSERT);
 }