Package com.sun.ebank.ejb.account

Examples of com.sun.ebank.ejb.account.Account


        AccountNotFoundException, IllegalAccountTypeException,
        InsufficientFundsException, RemoteException {

        Debug.print("TxControllerBean withdraw");

        Account account = checkAccountArgs(amount, description, accountId);

        String type = account.getType();
        if (DomainUtil.isCreditAccount(type))
            throw new IllegalAccountTypeException(type);

        double newBalance = account.getBalance() - amount;

        if (newBalance < 0.0)
            throw new InsufficientFundsException();

        executeTx(-1 * amount, description, accountId, newBalance, account);
View Full Code Here


        AccountNotFoundException, IllegalAccountTypeException,
        RemoteException {
        Debug.print("TxControllerBean deposit");

        Account account = checkAccountArgs(amount, description, accountId);

        String type = account.getType();
        if (DomainUtil.isCreditAccount(type))
            throw new IllegalAccountTypeException(type);

        double newBalance = account.getBalance() + amount;
        executeTx(amount, description, accountId, newBalance, account);     

    } // deposit
View Full Code Here

        AccountNotFoundException, IllegalAccountTypeException,
        InsufficientCreditException, RemoteException {

        Debug.print("TxControllerBean charge");

        Account account = checkAccountArgs(amount, description, accountId);

        String type = account.getType();
        if (DomainUtil.isCreditAccount(type) == false)
            throw new IllegalAccountTypeException(type);

        double newBalance = account.getBalance() + amount;

        if (newBalance > account.getCreditLine())
            throw new InsufficientCreditException();

        executeTx(amount, description, accountId, newBalance, account);

    } // charge
View Full Code Here

        AccountNotFoundException, IllegalAccountTypeException,
        RemoteException {
        Debug.print("TxControllerBean makePayment");

        Account account = checkAccountArgs(amount, description, accountId);

        String type = account.getType();
        if (DomainUtil.isCreditAccount(type) == false)
            throw new IllegalAccountTypeException(type);

        double newBalance = account.getBalance() - amount;
        executeTx(-1 * amount, description, accountId, newBalance, account);     
    } // makePayment
View Full Code Here

        RemoteException, IllegalArgumentException,
        AccountNotFoundException, InsufficientFundsException,
        InsufficientCreditException {

       
        Account fromAccount = checkAccountArgs(amount, description,
            fromAccountId);
        Account toAccount = checkAccountArgs(amount, description,
            toAccountId);

        String fromType = fromAccount.getType();
        double fromBalance = fromAccount.getBalance();

        if (DomainUtil.isCreditAccount(fromType)) {
            double fromNewBalance =  fromBalance + amount;
            if (fromNewBalance > fromAccount.getCreditLine())
               throw new InsufficientCreditException();
            executeTx(amount, description, fromAccountId,
                fromNewBalance, fromAccount);
        } else {
            double fromNewBalance =  fromBalance - amount;
            if (fromNewBalance < 0.0)
                throw new InsufficientFundsException();
            executeTx(-1 * amount, description, fromAccountId,
                fromNewBalance, fromAccount);
        }
          
        String toType = toAccount.getType();
        double toBalance = toAccount.getBalance();
  
        if (DomainUtil.isCreditAccount(toType)) {
            double toNewBalance = toBalance - amount;
            executeTx(-1 * amount, description, toAccountId,
                toNewBalance, toAccount);
View Full Code Here

    private Account checkAccountArgs(double amount, String description,
        String accountId) throws IllegalArgumentException,
        AccountNotFoundException {

        Account account = null;

        if (description == null)
            throw new IllegalArgumentException("null description");

        if (accountId == null)
View Full Code Here

        AccountNotFoundException, IllegalAccountTypeException,
        InsufficientFundsException {

        Debug.print("TxControllerBean withdraw");

        Account account = checkAccountArgs(amount, description, accountId);

        String type = account.getType();
        if (DomainUtil.isCreditAccount(type))
            throw new IllegalAccountTypeException(type);

        BigDecimal newBalance = account.getBalance().subtract(amount);

        if (newBalance.compareTo(bigZero) == -1)
            throw new InsufficientFundsException();

        executeTx(amount.negate(), description, accountId, newBalance,
View Full Code Here

        String accountId) throws InvalidParameterException,
        AccountNotFoundException, IllegalAccountTypeException {
        Debug.print("TxControllerBean deposit");

        Account account = checkAccountArgs(amount, description, accountId);

        String type = account.getType();
        if (DomainUtil.isCreditAccount(type))
            throw new IllegalAccountTypeException(type);

        BigDecimal newBalance = account.getBalance().add(amount);
        executeTx(amount, description, accountId, newBalance, account);     

    } // deposit
View Full Code Here

        AccountNotFoundException, IllegalAccountTypeException,
        InsufficientCreditException {

        Debug.print("TxControllerBean charge");

        Account account = checkAccountArgs(amount, description, accountId);

        String type = account.getType();
        if (DomainUtil.isCreditAccount(type) == false)
            throw new IllegalAccountTypeException(type);

        BigDecimal newBalance = account.getBalance().add(amount);

        if (newBalance.compareTo(account.getCreditLine())  == 1)
            throw new InsufficientCreditException();

        executeTx(amount, description, accountId, newBalance, account);

View Full Code Here

        String accountId) throws InvalidParameterException,
        AccountNotFoundException, IllegalAccountTypeException {
        Debug.print("TxControllerBean makePayment");

        Account account = checkAccountArgs(amount, description, accountId);

        String type = account.getType();
        if (DomainUtil.isCreditAccount(type) == false)
            throw new IllegalAccountTypeException(type);

        BigDecimal newBalance = account.getBalance().subtract(amount);
        executeTx(amount.negate(), description, accountId, newBalance,
            account);     

    } // makePayment
View Full Code Here

TOP

Related Classes of com.sun.ebank.ejb.account.Account

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.