@Transactional public void reverseTransaction(String txId) { BankingTx tx = aclBankingTxDao.findByTransactionID(txId); tx.setAmount(-tx.getAmount()); tx.setDescription("Reversed: " + " amount = " + tx.getAmount() + " for " + tx.getDescription()); tx.setTransactionId(Long.parseLong((new RandomID(9)).getId())); tx.setTransDate(new Timestamp(System.currentTimeMillis())); aclBankingTxDao.insert(tx); addPermission(tx, new PrincipalSid(getCustomerUsername(tx)), BasePermission.READ); addPermission(tx, new GrantedAuthoritySid("ROLE_REP"), BasePermission.ADMINISTRATION); addPermission(tx, new GrantedAuthoritySid("ROLE_REP"), BasePermission.DELETE); }
@Transactional // @Secured("ROLE_USER") public void createTransaction(BankingTx tx) { // add due to no insert trigger in sql server if (SobaConfig.getDatabaseVendor().equalsIgnoreCase("SQLServer")) { // System.out.println ("database vendor is SQL Server"); double balance = accountManager.updateAccountBalance(tx.getAmount(), tx.getAccountId()); tx.setBalance(balance); } aclBankingTxDao.insert(tx); addPermission(tx, new PrincipalSid(getCustomerUsername(tx)), BasePermission.READ); addPermission(tx, new GrantedAuthoritySid("ROLE_REP"), BasePermission.ADMINISTRATION); addPermission(tx, new GrantedAuthoritySid("ROLE_REP"), BasePermission.DELETE); }