BEA Systems, Inc.

com.beasys.commerce.foundation.property
Class DirectPropertyManagerBean

java.lang.Object
  |
  +--com.beasys.commerce.foundation.property.DirectPropertyManagerBean

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

A session bean that provides ConfigurableEntity functionality with minimal access through entity beans. This is accomplished by accessing the EntityPropertyManager directly, and reduces ejb locks so that there is less of a risk of deadlock.

See Also:
Serialized Form

Constructor Summary
DirectPropertyManagerBean()
           
 
Method Summary
 void ejbActivate()
          This method is required by the EJB Specification, but is not used by this class.
 void ejbCreate()
          Creates the session bean.
 void ejbPassivate()
          This method is required by the EJB Specification, but is not used by this class.
 void ejbRemove()
          This method is required by the EJB Specification, but is not used by this class.
 java.lang.Object getDefaultValue(java.lang.String propertySet, java.lang.String propertyName)
          Retrieves the default value of a property
 ConfigurableEntity getEntity(java.lang.String profileKey, java.lang.String profileType)
          Instantiates a ConfigurableEntity based on the pk and profileType, and returns it cast as a ConfigurableEntity.
 long getEntityId(java.lang.String pk, java.lang.String profileType)
          Retrieves the unique numeric id of a configurable entity
 java.lang.Object getExplicitProperty(java.lang.String profileKey, java.lang.String profileType, java.lang.String propertyName)
          Retrieve an explicit property from a configurable entity, if it exists.
 java.util.Map getProperties(java.lang.String pk, java.lang.String profileType, java.lang.String successorPk, java.lang.String successorProfileType)
          Retrieve all set properties for a particular ConfigurableEntity, following the successor chains as necessary.
 java.lang.Object getProperty(java.lang.String pk, java.lang.String profileType, java.lang.String successorPk, java.lang.String successorProfileType, java.lang.String propertySet, java.lang.String propertyName, java.lang.Object defaultValue)
          Retrieve a property from a configurable entity.
 java.lang.Object removeProperty(java.lang.String pk, java.lang.String profileType, java.lang.String propertySet, java.lang.String propertyName)
          Removes the property from the given configurable entity.
 void setProperty(java.lang.String pk, java.lang.String profileType, java.lang.String propertySet, java.lang.String propertyName, java.lang.Object value)
          Sets a property for a configurable entity.
 void setSessionContext(javax.ejb.SessionContext ctx)
          Sets the session context.
static java.lang.String upcaseFirst(java.lang.String s)
          Make the first letter of a string uppercase
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectPropertyManagerBean

public DirectPropertyManagerBean()
Method Detail

getDefaultValue

public java.lang.Object getDefaultValue(java.lang.String propertySet,
                                        java.lang.String propertyName)
                                 throws java.rmi.RemoteException
Retrieves the default value of a property
Parameters:
propertySet - the property set to look in
propertyName - the name of the property
Returns:
the property's default value

getProperties

public java.util.Map getProperties(java.lang.String pk,
                                   java.lang.String profileType,
                                   java.lang.String successorPk,
                                   java.lang.String successorProfileType)
                            throws java.rmi.RemoteException
Retrieve all set properties for a particular ConfigurableEntity, following the successor chains as necessary. The successor passed into this method will be treated as the explicit successor, and properties for each property set will be retrieved from the successor for that property set if necessary. The results from this call will be the same as if getProperty was called separately for each available property with this explicit successor.
The only properties that will not come back from this call are explicit properties, which should be retrieved through getExplicitProperty(), and properties that were not set for this entity or any of its successors, for which the default value should be retrieved through getDefaultValue().
Parameters:
pk - the profile key of the entity
profileType - the profile type of the entity
successorPk - the profile key of an explicit successor to use (can be null)
successorProfileType - the profile type for an explicity successor (can be null)
Returns:
a map of PropertyMapKey->Object pairs

getProperty

public java.lang.Object getProperty(java.lang.String pk,
                                    java.lang.String profileType,
                                    java.lang.String successorPk,
                                    java.lang.String successorProfileType,
                                    java.lang.String propertySet,
                                    java.lang.String propertyName,
                                    java.lang.Object defaultValue)
                             throws java.rmi.RemoteException
Retrieve a property from a configurable entity. This will follow the standard successor search that the ConfigurableEntity object itself will follow, except that it will not retrieve an actual ConfigurableEntity unless it is necessary. This will reduce the number of EJB locks and potential deadlock situations.
Parameters:
pk - the profile key of the entity
profileType - the profile type of the entity
successorPk - the profile key of the explicit successor
successorProfileType - the type of the explicit successor
propertySet - the property set to look in
propertyName - the name of the property to retrieve
defaultValue - a value to return if none is found
Returns:
the value of the property

getExplicitProperty

public java.lang.Object getExplicitProperty(java.lang.String profileKey,
                                            java.lang.String profileType,
                                            java.lang.String propertyName)
                                     throws java.rmi.RemoteException
Retrieve an explicit property from a configurable entity, if it exists. This method will actually create an instance of the entity based on the profileType, look for a getter method for the given property, and call it.
Parameters:
profileKey - the profile key of the entity
profileType - the profile type of the entity
propertyName - the name of the property to retrieve
Returns:
the value returned by the getter method, or null if none was found

setProperty

public void setProperty(java.lang.String pk,
                        java.lang.String profileType,
                        java.lang.String propertySet,
                        java.lang.String propertyName,
                        java.lang.Object value)
                 throws java.rmi.RemoteException
Sets a property for a configurable entity. This call actually retrieves a ConfigurableEntity object based on the given pk and profile type, and calls setProperty on it. This will ensure that the correct explicit properties will be set, and any cached values in the ConfigurableEntity will stay updated
Parameters:
pk - the key of the entity to update
profileType - the profile type of the entity
propertySet - the property set of the property to set
propertyName - the name of the property to set
value - the value to set

removeProperty

public java.lang.Object removeProperty(java.lang.String pk,
                                       java.lang.String profileType,
                                       java.lang.String propertySet,
                                       java.lang.String propertyName)
                                throws java.rmi.RemoteException
Removes the property from the given configurable entity.
Parameters:
pk - the key of the entity to update
profileType - the profile type of the entity
propertySet - the property set of the property to set
propertyName - the name of the property to set
Returns:
the removed value

getEntityId

public long getEntityId(java.lang.String pk,
                        java.lang.String profileType)
                 throws java.rmi.RemoteException
Retrieves the unique numeric id of a configurable entity
Parameters:
pk - the key of the entity
profileType - the type of entity
Returns:
the entity's unique numeric id

getEntity

public ConfigurableEntity getEntity(java.lang.String profileKey,
                                    java.lang.String profileType)
                             throws java.rmi.RemoteException
Instantiates a ConfigurableEntity based on the pk and profileType, and returns it cast as a ConfigurableEntity.
Parameters:
pk - the key of the entity to retrieve
profileType - the type to retrieve it as
Returns:
the retrieved configurable entity

upcaseFirst

public static java.lang.String upcaseFirst(java.lang.String s)
Make the first letter of a string uppercase

ejbCreate

public void ejbCreate()
Creates the session bean.

ejbActivate

public void ejbActivate()
This method is required by the EJB Specification, but is not used by this class.
Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbRemove

public void ejbRemove()
This method is required by the EJB Specification, but is not used by this class.
Specified by:
ejbRemove in interface javax.ejb.SessionBean

ejbPassivate

public void ejbPassivate()
This method is required by the EJB Specification, but is not used by this class.
Specified by:
ejbPassivate in interface javax.ejb.SessionBean

setSessionContext

public final void setSessionContext(javax.ejb.SessionContext ctx)
Sets the session context.
Specified by:
setSessionContext in interface javax.ejb.SessionBean
Parameters:
ctx - Context for session

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved