com.ibm.websphere.samples.appprofile.accountmanagementejb
Class AccountManagerBean

java.lang.Object
  extended by com.ibm.websphere.samples.appprofile.accountmanagementejb.AccountManagerBean
All Implemented Interfaces:
java.io.Serializable, javax.ejb.EnterpriseBean, javax.ejb.SessionBean

public class AccountManagerBean
extends java.lang.Object
implements javax.ejb.SessionBean

The AccountManagerBean implements the SessionBean interface. It contains the buisness methods necessary to manage Accounts In addition to buisness methonds, it contains the Home Interface Methods, and Callback Methods.

Since:
04/15/2002
See Also:
Serialized Form

Field Summary
protected  LocalAccountHome accountLocalHome
          The LocalAccountHome object.
protected  javax.naming.InitialContext initialContext
          The InitialContext Object used to do jndi lookup
protected  java.lang.String lookupString
          The String, java:comp/env/ejb/AppProfileSample-AccountHome, is used to lookup AccountHome.
 
Constructor Summary
AccountManagerBean()
           
 
Method Summary
 int createAccounts(int number)
          This remote method is used to create a number of Account entity beans.
 void ejbActivate()
          Required callback method for Contaimer Managed Persistence.
 void ejbCreate()
          This Home Interface Method implementation is responsible for the creation of an AccountManager.
 void ejbPassivate()
          Required callback method for Contaimer Managed Persistence.
 void ejbRemove()
          Required callback method for Contaimer Managed Persistence.
 java.lang.String getAccount(java.lang.String accountid)
          This remote method is used to get an Account record in String format, given the primary key account id.
 int getAccountsNumber()
          This remote method is used to get the number of total accounts.
 java.lang.String[] getLargeAccounts(double balance)
          This remote method is used to get a collection of Account records in String format that meet the minimum balance condition
 int increaseLargeAccountsAPR(double balance, double change)
          This remote method is used to increase the APR by the passed in apr parameter on all large accounts with balance greater than the passed in balance parameter.
 void setSessionContext(javax.ejb.SessionContext ctx)
          Required callback method for Contaimer Managed Persistence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialContext

protected javax.naming.InitialContext initialContext
The InitialContext Object used to do jndi lookup


lookupString

protected java.lang.String lookupString
The String, java:comp/env/ejb/AppProfileSample-AccountHome, is used to lookup AccountHome.


accountLocalHome

protected LocalAccountHome accountLocalHome
The LocalAccountHome object.

Constructor Detail

AccountManagerBean

public AccountManagerBean()
Method Detail

ejbActivate

public void ejbActivate()
Required callback method for Contaimer Managed Persistence.

Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
This Home Interface Method implementation is responsible for the creation of an AccountManager.

Throws:
javax.ejb.CreateException - This exception is thrown to indicate a failure to create the entity EJB.

ejbPassivate

public void ejbPassivate()
Required callback method for Contaimer Managed Persistence.

Specified by:
ejbPassivate in interface javax.ejb.SessionBean

ejbRemove

public void ejbRemove()
Required callback method for Contaimer Managed Persistence.

Specified by:
ejbRemove in interface javax.ejb.SessionBean

setSessionContext

public void setSessionContext(javax.ejb.SessionContext ctx)
Required callback method for Contaimer Managed Persistence.

Specified by:
setSessionContext in interface javax.ejb.SessionBean

createAccounts

public int createAccounts(int number)
This remote method is used to create a number of Account entity beans.

Parameters:
number - the number of Accounts needed to be created
Returns:
the actual number of Account been created

getLargeAccounts

public java.lang.String[] getLargeAccounts(double balance)
This remote method is used to get a collection of Account records in String format that meet the minimum balance condition

Parameters:
balance - the required minimum balance condition
Returns:
accounts String[] object represent the collection of account records meet the requirement

increaseLargeAccountsAPR

public int increaseLargeAccountsAPR(double balance,
                                    double change)
This remote method is used to increase the APR by the passed in apr parameter on all large accounts with balance greater than the passed in balance parameter.

Parameters:
balance - the required minimum balance condition
change - indicates how much the apr should increase
Returns:
the number of Accounts been affected.

getAccount

public java.lang.String getAccount(java.lang.String accountid)
This remote method is used to get an Account record in String format, given the primary key account id. This method will try to find an Account with the same account id first. If it can not find one, it will create a new one with the passed in accountid parameter as primary key.

Parameters:
accountid - String object represent the primary key of an Account
Returns:
account String format represent this Account

getAccountsNumber

public int getAccountsNumber()
This remote method is used to get the number of total accounts.

Returns:
number total accounts