it.mokabyte.pattern.ejb.entity
Class AccountBean

it.mokabyte.pattern.ejb.entity.AccountBean

public class AccountBean

Title: AccountBean

Description: a Bank Account BMP

Copyright: Copyright (c) 2002

Company:

Author:
Rossini S. - Dozio L.

Field Summary
private  double balance
          The balance
private  it.mokabyte.pattern.ejb.entity.EntityContext ctx
          The entity context for the bean, saved from setEntityContext
private  MyDao dao
          The data access object
private static java.lang.String DS_JNDI_NAME
          Data sourcename
private  java.lang.String email
          The email
private  java.lang.String name
          The name
 
Constructor Summary
AccountBean()
           
 
Method Summary
private  void addItem(java.lang.String s)
          Log message to console inserting date at the begin
 void ejbActivate()
           
 AccountPK ejbCreate(java.lang.String id, java.lang.String name, java.lang.String address, double balance)
          Create a new Account with the given ID, name, address and balance.
 AccountPK ejbFindByPrimaryKey(AccountPK key)
          Find an Account
 void ejbLoad()
          Load this Account from the Database
 void ejbPassivate()
           
 void ejbPostCreate(java.lang.String id, java.lang.String name, java.lang.String address, double balance)
          Post create settings
 void ejbRemove()
          Remove this Account from the database
 void ejbStore()
          Store this Account to the database
 java.lang.String getAccountID()
          Returns current account ID
 double getBalance()
          Returns current balance
 java.lang.String getEmail()
          Returns current email.
 java.lang.String getName()
          Returns current name
 void setBalance(double param)
          Set this Account's balance
 void setEmail(java.lang.String param)
          Set this Account's email
 void setEntityContext(it.mokabyte.pattern.ejb.entity.EntityContext ctx)
          Set the context for this bean : save the context in ctx member
 void setName(java.lang.String param)
          Set this Account's name
 void unsetEntityContext()
          Unset the context for this bean.
 

Field Detail

balance

private double balance
The balance

name

private java.lang.String name
The name

email

private java.lang.String email
The email

ctx

private it.mokabyte.pattern.ejb.entity.EntityContext ctx
The entity context for the bean, saved from setEntityContext

dao

private MyDao dao
The data access object

DS_JNDI_NAME

private static final java.lang.String DS_JNDI_NAME
Data sourcename
Constructor Detail

AccountBean

public AccountBean()
Method Detail

getAccountID

public java.lang.String getAccountID()
Returns current account ID
Returns:
string account ID

getBalance

public double getBalance()
Returns current balance
Returns:
double balance

setBalance

public void setBalance(double param)
Set this Account's balance
Parameters:
new - balance value

getName

public java.lang.String getName()
Returns current name
Returns:
String name

setName

public void setName(java.lang.String param)
Set this Account's name
Parameters:
new - name value

getEmail

public java.lang.String getEmail()
Returns current email.
Returns:
String email

setEmail

public void setEmail(java.lang.String param)
Set this Account's email
Parameters:
new - name value

ejbCreate

public AccountPK ejbCreate(java.lang.String id,
                           java.lang.String name,
                           java.lang.String address,
                           double balance)
                    throws it.mokabyte.pattern.ejb.entity.CreateException
Create a new Account with the given ID, name, address and balance.
Parameters:
custID - the ID for this account
acctType - the account type for this account
balance - the balance for this Customer
Returns:
the primary key
Throws:
it.mokabyte.pattern.ejb.entity.CreateException - thrown if the custID or acctType is null, or the balance is negetive.

ejbPostCreate

public void ejbPostCreate(java.lang.String id,
                          java.lang.String name,
                          java.lang.String address,
                          double balance)
                   throws it.mokabyte.pattern.ejb.entity.CreateException
Post create settings
Parameters:
custID - the ID for this account
acctType - the account type for this account
balance - the balance for this Customer
Throws:
it.mokabyte.pattern.ejb.entity.CreateException - never thrown - declared for sub-class use

setEntityContext

public void setEntityContext(it.mokabyte.pattern.ejb.entity.EntityContext ctx)
Set the context for this bean : save the context in ctx member
Parameters:
ctx - the Entity Context for this bean

unsetEntityContext

public void unsetEntityContext()
Unset the context for this bean.

ejbActivate

public void ejbActivate()

ejbPassivate

public void ejbPassivate()

ejbLoad

public void ejbLoad()
Load this Account from the Database

ejbStore

public void ejbStore()
Store this Account to the database

ejbRemove

public void ejbRemove()
               throws it.mokabyte.pattern.ejb.entity.RemoveException
Remove this Account from the database

ejbFindByPrimaryKey

public AccountPK ejbFindByPrimaryKey(AccountPK key)
                              throws it.mokabyte.pattern.ejb.entity.FinderException
Find an Account
Parameters:
key - the Account to find
Returns:
the Primary Key for this Account (key)
Throws:
it.mokabyte.pattern.ejb.entity.FinderException - thrown if this account already exists

addItem

private void addItem(java.lang.String s)
Log message to console inserting date at the begin