BEA Systems, Inc.

examples.usermgmt
Class UnifiedUserBean

java.lang.Object
  |
  +--com.beasys.commerce.foundation.EntityImpl
        |
        +--com.beasys.commerce.foundation.ConfigurableEntityImpl
              |
              +--com.beasys.commerce.axiom.contact.UserImpl
                    |
                    +--examples.usermgmt.UnifiedUserBean
All Implemented Interfaces:
javax.ejb.EnterpriseBean, javax.ejb.EntityBean, PropertyCache, RelationalReference, java.io.Serializable

public class UnifiedUserBean
extends UserImpl

Implementation of the UnifiedUser example. This bean extends the provided WLPS User object and adds an explicit property, which can be accessed through getUserPoints and setUserPoints. This class shows how to correctly accomplish this so that the explicit methods can be accessed transparently through calls to setProperty and getProperty on the provided User object, or through the um:getProperyt and um:setProperty JSP tags.

One thing that is not shown in this file is the deployment descriptor; it is important to carry over datasource mappings and environment variables from this example's descriptor. The only one that should be changed is the "UnifiedProfileType" property, which should be set to the name of the registered profile type that this bean represents.

See Also:
Serialized Form

Field Summary
protected  boolean dirty
           
 
Fields inherited from class com.beasys.commerce.axiom.contact.UserImpl
identifier
 
Fields inherited from class com.beasys.commerce.foundation.ConfigurableEntityImpl
DEFAULT_ENTITY_PROPERTY_MANAGER_HOME, DEFAULT_SCHEMA_GROUP_NAME, ENTITY_PROPERTY_MANAGER_HOME, propertyMap, SCHEMA_GROUP_NAME
 
Fields inherited from class com.beasys.commerce.foundation.EntityImpl
__classIdentifier, __containingEntity, __mapKey, __sequenceNumber, _ctx, _environmentNamingContext, _environmentPropertyCache, _isDirty, _smartBMP
 
Constructor Summary
UnifiedUserBean()
          Default constructor.
 
Method Summary
 UnifiedUserPk ejbCreate(UnifiedUserPk pk)
          Create a new instance of this bean.
 void ejbFind(java.lang.String username)
          Returns the primary key for the current user
 UnifiedUserPk ejbFindByPrimaryKey(UnifiedUserPk pk)
          Attempts to find the bean in the database.
 void ejbLoad()
          Instructs the instance to synchronize its state by loading it from the underlying datastore.
 void ejbPostCreate(UnifiedUserPk pk)
           
 void ejbRemove()
          Remove the bean.
 void ejbStore()
          Instructs the instance to synchronize its state by storing it to the underlying database.
protected  java.sql.Connection getConnection()
          Get a connection to the database.
 java.lang.Long getUserPoints()
          Gets the amount of 'User Points' the user has earned.
 void setUserPoints(java.lang.Long points)
          Sets amount of 'User Points' the user has earned.
 
Methods inherited from class com.beasys.commerce.axiom.contact.UserImpl
authorizeUserModification, bscInitializeAttributes, ejbActivate, ejbCreate, ejbFindByPrimaryKey, ejbPassivate, ejbPostCreate, getIdentifier, getProperty, getProperty, getPropertyAsString, getPropertyAsString, getSharedProfileProvider, getSharedProperty, getUserByValue, isSharedProperty, removeProperty, removeProperty, removePropertyValue, removeSharedProperty, removeSharedPropertyValue, setEntityContext, setIdentifier, setProperty, setProperty, setSharedProperty, setUserByValue, unsetEntityContext
 
Methods inherited from class com.beasys.commerce.foundation.ConfigurableEntityImpl
addBusinessPolicy, addCachedPropertyMapped, addCachedPropertyValue, addPropertyValue, addPropertyValueMapped, buildPolicyKey, createMapKey, ejbCreate, ejbPostCreate, getBusinessPolicy, getCachedProperty, getImplicitProperty, getPersistableHandle, getProperty, getPropertyDefault, getPropertyMap, getPropertyNoDefault, getSuccessor, getUniqueId, removeBusinessPolicy, removeCachedProperties, removeCachedProperties, removeCachedProperty, removeCachedPropertyMapped, removeCachedPropertyValue,
 
Methods inherited from class com.beasys.commerce.foundation.EntityImpl
bscInitializeAttributes, clearRelationalBinding, clearRelationalBinding, clearRelationalBinding, clearRelationalBinding, doRelationalBinding, doRelationalBinding, doRelationalBindingOnElement, doRelationalBindingOnElement, doRelationalBindingOnElement, doRelationalBindingOnSingleton, doRelationalBindingOnSingleton, doRelationalBindingOnSingleton, doRelationalBindingWithMapKey, doRelationalBindingWithMapKey, doRelationalBindingWithMapKey, ejbFindAll, ejbFindByPrimaryKey, enumerateRelationalBinding, enumerateRelationalBinding, get__classIdentifier, get__containingBelonging, get__containingEntity, get__containingEntityReference, get__mapKey, get__sequenceNumber,
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dirty

protected boolean dirty
Constructor Detail

UnifiedUserBean

public UnifiedUserBean()
                throws javax.ejb.CreateException
Default constructor.
Method Detail

ejbCreate

public UnifiedUserPk ejbCreate(UnifiedUserPk pk)
                        throws javax.ejb.CreateException,
                               java.rmi.RemoteException
Create a new instance of this bean. This calls super.ejbCreate to create data associated with the base User class.

ejbPostCreate

public void ejbPostCreate(UnifiedUserPk pk)
                   throws javax.ejb.CreateException,
                          java.rmi.RemoteException

ejbRemove

public void ejbRemove()
               throws javax.ejb.RemoveException,
                      javax.ejb.EJBException
Remove the bean. This calls super.ejbRemove first to remove data associated with the base User class.
Overrides:
ejbRemove in class UserImpl

ejbFindByPrimaryKey

public UnifiedUserPk ejbFindByPrimaryKey(UnifiedUserPk pk)
                                  throws javax.ejb.FinderException
Attempts to find the bean in the database. If the bean is not found, check the super class, to see if a base User exists with this name. If that is found, we should create an entry in the UnifiedUser example table to keep them in sync.
Parameters:
pk - UserPK
Returns:
com.beasys.commerce.axiom.contact.ejb.UnifiedUserPK
Throws:
javax.ejb.FinderException -  

ejbFind

public void ejbFind(java.lang.String username)
             throws javax.ejb.FinderException
Returns the primary key for the current user
Parameters:
username -  
Throws:
javax.ejb.FinderException -  

ejbLoad

public void ejbLoad()
             throws javax.ejb.EJBException
Instructs the instance to synchronize its state by loading it from the underlying datastore.
Overrides:
ejbLoad in class UserImpl

ejbStore

public void ejbStore()
              throws javax.ejb.EJBException
Instructs the instance to synchronize its state by storing it to the underlying database. Note that the attributes are not stored at this point, as they are stored when they are set.
Overrides:
ejbStore in class UserImpl

getConnection

protected java.sql.Connection getConnection()
                                     throws java.sql.SQLException
Get a connection to the database.

getUserPoints

public java.lang.Long getUserPoints()
                             throws java.rmi.RemoteException,
                                    UserManagementException
Gets the amount of 'User Points' the user has earned. When the user earns 2 billion User Points, the user earns a free weekend getaway to Jackson, Mississippi.
Returns:
the number of User Points earned by the user
Throws:
java.rmi.RemoteException - bean contract exception
UserManagementException - error retrieving User Points

setUserPoints

public void setUserPoints(java.lang.Long points)
                   throws java.rmi.RemoteException,
                          UserManagementException
Sets amount of 'User Points' the user has earned. When the user earns 2 billion User Points, the user earns a free weekend getaway to Jackson, Mississippi.
Parameters:
points - the number of User Points earned by the user
Throws:
java.rmi.RemoteException - bean contract exception
UserManagementException - error updating User Points

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved