OpMath

com.opmath.test.j2ee.contact
Class ContactBean

java.lang.Object
  |
  +--com.opmath.test.j2ee.contact.ContactBean
All Implemented Interfaces:
EnterpriseBean, EntityBean, Serializable

public abstract class ContactBean
extends Object
implements EntityBean

The business logic for the contact component. In fact, this class does not perform any sort of transformation on its data - it is simply concerned with storing and retrieving the contact record data according to transactional rules. This EJB also has a unique key, which is used by the container as a primary key.

Copyright: (c) 2002 The Open Math Company Limited

The Terms of Distribution of this software are stipulated in the javadoc Overview for this project.

Since:
J2SDK 1.3.1, J2SDKEE 1.3.1, EJB 2.0
Version:
OpMath J2EE Example v1.0
Author:
Bruno Beloff bruno.beloff@opmath.com
See Also:
Serialized Form

Constructor Summary
ContactBean()
           
 
Method Summary
 void ejbActivate()
          Invoked when the instance is taken out of the pool of available instances to become associated with a specific EJB object.
 ContactPK ejbCreate(ContactPK key, ContactVO data)
          Creates a new Contact EJB instance.
 void ejbLoad()
          The container invokes this method to instruct the instance to synchronize its state by loading its state from the underlying database.
 void ejbPassivate()
          A container invokes this method on an instance before the instance becomes disassociated with a specific EJB object.
 void ejbPostCreate(ContactPK key, ContactVO data)
          Executed after the create operation has completed.
 void ejbRemove()
          The container invokes this method before it removes the EJB object that is currently associated with the instance.
 void ejbStore()
          The container invokes this method to instruct the instance to synchronize its state by storing it to the underlying database.
 ContactVO getData()
          Returns the value object for this Contact EJB.
abstract  String getEmail()
          Returns the 'email' field for this Contact EJB.
abstract  String getFamilyName()
          Returns the 'family name' field for this Contact EJB.
abstract  String getGivenName()
          Returns the 'given name' field for this Contact EJB.
abstract  ContactPK getKey()
          Returns the primary key for this Contact EJB.
abstract  String getPhone()
          Returns the 'phone' field for this Contact EJB.
 void setData(ContactVO data)
          Sets the state for this Contact EJB, according to the given ContactVO object.
abstract  void setEmail(String email)
          Sets the 'email' field for this Contact EJB, to the given String.
 void setEntityContext(EntityContext ctx)
          Sets the private entity context of this instance.
abstract  void setFamilyName(String familyName)
          Sets the 'family name' field for this Contact EJB, to the given String.
abstract  void setGivenName(String givenName)
          Sets the 'given name' field for this Contact EJB, to the given String.
abstract  void setKey(ContactPK key)
          Sets the primary key for this Contact EJB to the given ContactPK object.
abstract  void setPhone(String phone)
          Sets the 'phone' field for this Contact EJB, to the given String.
 void unsetEntityContext()
          Sets the private entity context of this instance to null.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContactBean

public ContactBean()
Method Detail

getKey

public abstract ContactPK getKey()

Returns the primary key for this Contact EJB.

This method is implemented by the EJB 2.0 compliant container.

Returns:
the ContactPK uniquely identifying this Contact EJB instance.

setKey

public abstract void setKey(ContactPK key)

Sets the primary key for this Contact EJB to the given ContactPK object. Note that this method should not be made available via the EJB's remote interface.

This method is implemented by the EJB 2.0 compliant container.

Parameters:
key - a UniqueIdGeneratorPK specifying the key.

getGivenName

public abstract String getGivenName()

Returns the 'given name' field for this Contact EJB. Note that this method should not be made available via the EJB's remote interface - instead, a value object should be used to expose the complete EJB state.

This method is implemented by the EJB 2.0 compliant container.

Returns:
a String carrying the 'given name' field.

setGivenName

public abstract void setGivenName(String givenName)

Sets the 'given name' field for this Contact EJB, to the given String. Note that this method should not be made available via the EJB's remote interface - instead, a value object should be used to expose the complete EJB state.

This method is implemented by the EJB 2.0 compliant container.

Parameters:
givenName - a String specifying the 'given name' field.

getFamilyName

public abstract String getFamilyName()

Returns the 'family name' field for this Contact EJB. Note that this method should not be made available via the EJB's remote interface - instead, a value object should be used to expose the complete EJB state.

This method is implemented by the EJB 2.0 compliant container.

Returns:
a String carrying the 'family name' field.

setFamilyName

public abstract void setFamilyName(String familyName)

Sets the 'family name' field for this Contact EJB, to the given String. Note that this method should not be made available via the EJB's remote interface - instead, a value object should be used to expose the complete EJB state.

This method is implemented by the EJB 2.0 compliant container.

Parameters:
familyName - a String specifying the 'family name' field.

getEmail

public abstract String getEmail()

Returns the 'email' field for this Contact EJB. Note that this method should not be made available via the EJB's remote interface - instead, a value object should be used to expose the complete EJB state.

This method is implemented by the EJB 2.0 compliant container.

Returns:
a String carrying the 'email' field.

setEmail

public abstract void setEmail(String email)

Sets the 'email' field for this Contact EJB, to the given String. Note that this method should not be made available via the EJB's remote interface - instead, a value object should be used to expose the complete EJB state.

This method is implemented by the EJB 2.0 compliant container.

Parameters:
email - a String specifying the 'email' field.

getPhone

public abstract String getPhone()

Returns the 'phone' field for this Contact EJB. Note that this method should not be made available via the EJB's remote interface - instead, a value object should be used to expose the complete EJB state.

This method is implemented by the EJB 2.0 compliant container.

Returns:
a String carrying the 'phone' field.

setPhone

public abstract void setPhone(String phone)

Sets the 'phone' field for this Contact EJB, to the given String. Note that this method should not be made available via the EJB's remote interface - instead, a value object should be used to expose the complete EJB state.

This method is implemented by the EJB 2.0 compliant container.

Parameters:
phone - a String specifying the 'phone' field.

getData

public ContactVO getData()

Returns the value object for this Contact EJB.

Returns:
a ContactVO carrying the state of this Contact EJB.

setData

public void setData(ContactVO data)

Sets the state for this Contact EJB, according to the given ContactVO object.

Parameters:
data - a ContactVO specifying the state of this Contact EJB.

ejbCreate

public ContactPK ejbCreate(ContactPK key,
                           ContactVO data)
                    throws CreateException

Creates a new Contact EJB instance. The new instance will have the given key and state.

Parameters:
key - a ContactPK specifying the key.
data - a ContactVO specifying the state.
Returns:
the ContactPK uniquely identifying this Contact EJB instance.
Throws:
CreateException - if the new instance could not be created, for whatever reason.

ejbPostCreate

public void ejbPostCreate(ContactPK key,
                          ContactVO data)
                   throws CreateException

Executed after the create operation has completed. Does nothing.

Parameters:
key - a ContactPK specifying the key.
data - a ContactVO specifying the state.
Throws:
CreateException - if the method not be executed, for whatever reason (for example, because a UniqueIdGenerator with the same key already exists).

setEntityContext

public void setEntityContext(EntityContext ctx)

Sets the private entity context of this instance. The container invokes this method on an instance before ejbCreate(ContactPK, ContactVO).

Specified by:
setEntityContext in interface EntityBean
Parameters:
ctx - an EntityContext.

unsetEntityContext

public void unsetEntityContext()

Sets the private entity context of this instance to null. The container calls this method before removing the instance.

Specified by:
unsetEntityContext in interface EntityBean

ejbLoad

public void ejbLoad()

The container invokes this method to instruct the instance to synchronize its state by loading its state from the underlying database. Does nothing.

Specified by:
ejbLoad in interface EntityBean

ejbStore

public void ejbStore()

The container invokes this method to instruct the instance to synchronize its state by storing it to the underlying database. Does nothing.

Specified by:
ejbStore in interface EntityBean

ejbActivate

public void ejbActivate()

Invoked when the instance is taken out of the pool of available instances to become associated with a specific EJB object.

This transitions the instance to the ready state.

Specified by:
ejbActivate in interface EntityBean

ejbPassivate

public void ejbPassivate()

A container invokes this method on an instance before the instance becomes disassociated with a specific EJB object.

After this method completes, the container will place the instance into the pool of available instances.

Specified by:
ejbPassivate in interface EntityBean

ejbRemove

public void ejbRemove()

The container invokes this method before it removes the EJB object that is currently associated with the instance.

This transitions the instance from the ready state to the pool of available instances.

Specified by:
ejbRemove in interface EntityBean

OpMath

Submit a bug or feature to Open Math
Copyright © 2002 Open Math Company Limited, Brighton, UK