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

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

public abstract class AccountBean
extends java.lang.Object
implements javax.ejb.EntityBean

The Account CMP EJB 2.0 Bean implements the EntityBean interface. It contains the buisness methods necessary to work with an Account. In addition to buisness methonds, it contains the Home Interface Methods, and Callback Methods.

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

Constructor Summary
AccountBean()
           
 
Method Summary
 double add(double amount)
          This remote method is used to add a given amount of money to an Account entry.
 void ejbActivate()
          This required callback method is used for lifecycle notification.
 java.lang.String ejbCreate(java.lang.String accountId)
          This Home Interface Method implementation is responsible for the creation of an Account entry.
 java.lang.String ejbCreate(java.lang.String accountId, int type, double balance, double apr)
          This Home Interface Method implementation is responsible for the creation of an Account entry.
 void ejbLoad()
          This required callback method gets called after the EJB is loaded from the database.
 void ejbPassivate()
          This required callback method is used for lifecycle notification.
 void ejbPostCreate(java.lang.String accountId)
          This Home Interface Method is responsible for post creation steps, there are none for Account.
 void ejbPostCreate(java.lang.String accountId, int type, double balance, double apr)
          This Home Interface Method is responsible for post creation steps, there are none for Account.
 void ejbRemove()
          Required callback method for Contaimer Managed Persistence.
 void ejbStore()
          Required callback method for Contaimer Managed Persistence.
abstract  java.lang.String getAccountid()
          This abstract CMP field accessor method returns the accountid attribute for an Account.
abstract  double getApr()
          This abstract CMP field accessor method returns the apr attribute for an Account.
abstract  double getBalance()
          This abstract CMP field accessor method returns the balance attribute for an Account.
abstract  int getType()
          This abstract CMP field accessor method returns the type attribute for an Account.
abstract  void setAccountid(java.lang.String accountid)
          This abstract CMP field accessor method set the accountid attribute for an Account.
abstract  void setApr(double apr)
          This abstract CMP field accessor method set the apr attribute for an Account.
abstract  void setBalance(double balance)
          This abstract CMP field accessor method set the balance attribute for an Account.
 void setEntityContext(javax.ejb.EntityContext ctx)
          Required callback method for Container Managed Persistence.
abstract  void setType(int type)
          This abstract CMP field accessor method set the type attribute for an Account.
 double subtract(double amount)
          This remote method is used to substract a given amount of money from an Account entry.
 void unsetEntityContext()
          Required callback method for Container Managed Persistence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccountBean

public AccountBean()
Method Detail

getAccountid

public abstract java.lang.String getAccountid()
This abstract CMP field accessor method returns the accountid attribute for an Account.

Returns:
The accountid attribute of the Account

setAccountid

public abstract void setAccountid(java.lang.String accountid)
This abstract CMP field accessor method set the accountid attribute for an Account.

Parameters:
accountid - String object used as primary key

getType

public abstract int getType()
This abstract CMP field accessor method returns the type attribute for an Account.

Returns:
The type attribute of the Account

setType

public abstract void setType(int type)
This abstract CMP field accessor method set the type attribute for an Account.

Parameters:
type - set the type attribute of Account to this type parameter

getBalance

public abstract double getBalance()
This abstract CMP field accessor method returns the balance attribute for an Account.

Returns:
The balance attribute of the Account

setBalance

public abstract void setBalance(double balance)
This abstract CMP field accessor method set the balance attribute for an Account.

Parameters:
balance - The value of balance attribute of Account should be after this operation

getApr

public abstract double getApr()
This abstract CMP field accessor method returns the apr attribute for an Account.

Returns:
The apr attribute of the Account

setApr

public abstract void setApr(double apr)
This abstract CMP field accessor method set the apr attribute for an Account.

Parameters:
apr - The value of apr attribute of Account should be after this operation

ejbCreate

public java.lang.String ejbCreate(java.lang.String accountId)
                           throws javax.ejb.CreateException
This Home Interface Method implementation is responsible for the creation of an Account entry. Except for the accountid field, the other fields will be filled with default value. Default type is 1, default balance is 100.0, and default APR is 4.0.

Parameters:
accountId -
Returns:
null String object that is the primary key type; based on spec, this ejbCreate method should return null.
Throws:
javax.ejb.CreateException - This exception is thrown to indicate a failure to create the entity EJB.

ejbPostCreate

public void ejbPostCreate(java.lang.String accountId)
                   throws javax.ejb.CreateException
This Home Interface Method is responsible for post creation steps, there are none for Account.

Parameters:
accountId - String object used as the primary key of the Account object, and used to set accountid attribute
Throws:
javax.ejb.CreateException

ejbCreate

public java.lang.String ejbCreate(java.lang.String accountId,
                                  int type,
                                  double balance,
                                  double apr)
                           throws javax.ejb.CreateException
This Home Interface Method implementation is responsible for the creation of an Account entry.

Parameters:
accountId - String object as the primary key of Account bean
type - used to set type attribute
balance - used to set balance attribute
apr - used to set APR attribute
Returns:
Account object created by this method
Throws:
javax.ejb.CreateException

ejbPostCreate

public void ejbPostCreate(java.lang.String accountId,
                          int type,
                          double balance,
                          double apr)
                   throws javax.ejb.CreateException
This Home Interface Method is responsible for post creation steps, there are none for Account.

Parameters:
accountId - String object used as the primary key of the Account object, and used to set accountid attribute
type - int used to set type attribute
balance - double used to set balance attribute
apr - double used to set APR attribute
Throws:
javax.ejb.CreateException - This exception is thrown to indicate a failure to create the entity EJB.

add

public double add(double amount)
This remote method is used to add a given amount of money to an Account entry.

Parameters:
amount - The amount should be added to balance attribute of the Account
Returns:
The balance attribute of the Account after this operation

subtract

public double subtract(double amount)
This remote method is used to substract a given amount of money from an Account entry.

Parameters:
amount - The amount should be substracted from balance attribute of the Account
Returns:
The balance attribute of the Account after this operation

setEntityContext

public void setEntityContext(javax.ejb.EntityContext ctx)
Required callback method for Container Managed Persistence.

Specified by:
setEntityContext in interface javax.ejb.EntityBean

unsetEntityContext

public void unsetEntityContext()
Required callback method for Container Managed Persistence.

Specified by:
unsetEntityContext in interface javax.ejb.EntityBean

ejbLoad

public void ejbLoad()
This required callback method gets called after the EJB is loaded from the database. Trim to eliminate trailing spaces that can be added by the database.

Specified by:
ejbLoad in interface javax.ejb.EntityBean

ejbRemove

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

Specified by:
ejbRemove in interface javax.ejb.EntityBean

ejbStore

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

Specified by:
ejbStore in interface javax.ejb.EntityBean

ejbPassivate

public void ejbPassivate()
This required callback method is used for lifecycle notification. No actions need to be taken for Movie Review.

Specified by:
ejbPassivate in interface javax.ejb.EntityBean

ejbActivate

public void ejbActivate()
This required callback method is used for lifecycle notification. No actions need to be taken for Movie Review.

Specified by:
ejbActivate in interface javax.ejb.EntityBean