FileDocCategorySizeDatePackage
AccountFacade.javaAPI DocExample4331Fri Aug 25 08:52:48 BST 2000com.imaginary.bank

AccountFacade

public class AccountFacade extends com.imaginary.lwp.BaseFacade

Fields Summary
Constructors Summary
public AccountFacade()

        super();
    
public AccountFacade(long oid)

        super(oid);
    
public AccountFacade(Account acct)

        super(acct);
    
Methods Summary
public voidcredit(double amt)

        credit(Identifier.currentIdentifier(), amt);
    
public voidcredit(com.imaginary.lwp.Identifier id, double amt)

        Account acct;
        
        try {
            acct = (Account)getEntity();
            acct.credit(id, amt);
        }
        catch( RemoteException e ) {
            reconnect();
            acct = (Account)getEntity();
            acct.credit(id, amt);
        }
    
public doublegetBalance()

        return getBalance(Identifier.currentIdentifier());
    
public doublegetBalance(com.imaginary.lwp.Identifier id)

        if( contains(Account.BALANCE) ) {
            Double d = (Double)get(Account.BALANCE);
            
            if( d == null ) {
                return 0.0;
            }
            else {
                return d.doubleValue();
            }
        }
        else {
            Account acct;
            double bal;
            
            try {
                acct = (Account)getEntity();
                bal = acct.getBalance(id);
            }
            catch( RemoteException e ) {
                reconnect();
                acct = (Account)getEntity();
                bal = acct.getBalance(id);
            }
            put(Account.BALANCE, new Double(bal));
            return bal;
        }
    
public CustomerFacadegetCustomer()

        return getCustomer(Identifier.currentIdentifier());
    
public CustomerFacadegetCustomer(com.imaginary.lwp.Identifier id)

        if( contains(Account.CUSTOMER) ) {
            return (CustomerFacade)get(Account.CUSTOMER);
        }
        else {
            CustomerFacade cust;
            Account acct;
            
            try {
                acct = (Account)getEntity();
                cust = acct.getCustomer(id);
            }
            catch( RemoteException e ) {
                reconnect();
                acct = (Account)getEntity();
                cust = acct.getCustomer(id);
            }
            put(Account.CUSTOMER, cust);
            return cust;
        }
    
public intgetNumber()

        return getNumber(Identifier.currentIdentifier());
    
public intgetNumber(com.imaginary.lwp.Identifier id)

        if( contains(Account.NUMBER) ) {
            Integer num = (Integer)get(Account.NUMBER);
            
            if( num == null ) {
                return 0;
            }
            else {
                return num.intValue();
            }
        }
        else {
            Account acct;
            int num;
            
            try {
                acct = (Account)getEntity();
                num = acct.getNumber(id);
            }
            catch( RemoteException e ) {
                reconnect();
                acct = (Account)getEntity();
                num = acct.getNumber(id);
            }
            put(Account.NUMBER, new Integer(num));
            return num;
        }
    
public AccountTypegetType()

        return getType(Identifier.currentIdentifier());
    
public AccountTypegetType(com.imaginary.lwp.Identifier id)

        if( contains(Account.TYPE) ) {
            return (AccountType)get(Account.TYPE);
        }
        else {
            Account acct;
            AccountType t;
            
            try {
                acct = (Account)getEntity();
                t = acct.getType(id);
            }
            catch( RemoteException e ) {
                reconnect();
                acct = (Account)getEntity();
                t = acct.getType(id);
            }
            put(Account.TYPE, t);
            return t;
        }