BEA Systems, Inc.

com.beasys.commerce.user.jsp.beans
Class CachedProfileBean

java.lang.Object
  |
  +--com.beasys.commerce.axiom.p13n.http.HttpConfigurableEntity
        |
        +--com.beasys.commerce.user.jsp.beans.LocalProfileBean
              |
              +--com.beasys.commerce.user.jsp.beans.CachedProfileBean

public class CachedProfileBean
extends LocalProfileBean
implements ProfileWrapper

JSP Bean to support the <um:getProfile>, <um:getProperty>, and <um:setProperty> tags. This bean holds the state of the current profile and successor after calling <um:getProfile>. It also handles communications with the DirectPropertyManager session bean to set and retrieve properties.

NOTE: in previous releases, caching of properties was done in this bean at the JSP layer, hence the name. This is no longer the case, as properties are now cached in session beans.

See Also:
Serialized Form

Constructor Summary
CachedProfileBean()
          Default Constructor
CachedProfileBean(javax.servlet.http.HttpServletRequest request, java.lang.String profileKey)
           
 
Method Summary
 void clearValues()
          Clears the values in the cached profile.
 ConfigurableEntity getProfile()
          Returns a handle to itself, so that the profile can be treated as a ConfigurableEntity without locking any entity beans.
 long getProfileId()
          Get the unique numeric id for the current profile.
 java.lang.String getProfileKey()
           
 java.lang.Object getProperty(java.lang.String scope, java.lang.String propertyName)
          Retrieves the property value for the given scope.
 java.lang.Object getProperty(java.lang.String scope, java.lang.String propertyName, boolean getCached)
          Retrieves the property value for the given scope.
 java.lang.String getPropertyAsString(java.lang.String scope, java.lang.String propertyName, boolean getCached)
          Retrieves the property value for the given scope, cast as a String by calling toString() on the returned object.
 ConfigurableEntity getSuccessor()
          Returns the wrapped successor.
 long getSuccessorId()
          Get the unique numeric id for the current successor.
 java.lang.String getSuccessorKey()
           
 java.lang.Object removeProperty(java.lang.String scope, java.lang.String propertyName)
          Remove a property from the current profile
 void setProfileKey(java.lang.String profileKey)
          Set the current profile key.
 void setProfileType(java.lang.String profileType)
          Set the current profile type.
 void setProperty(java.lang.String scope, java.lang.String propertyName, java.lang.Object value)
          Retrieves the property value for the given scope, cast as a String by calling toString() on the returned object.
 void setProperty(java.lang.String scope, java.lang.String propertyName, java.lang.Object value, boolean setInCache)
          Set a property in the given scope.
 void setSuccessorKey(java.lang.String successorKey)
          Set the profile key of the current successor
 void setSuccessorType(java.lang.String successorType)
          Set the current successor type.
 void setupSharedProfile(javax.servlet.http.HttpServletRequest request)
          Allow an implementation of com.beasys.commerce.foundation.property.external.ProfileHandler to setup any necessary state with the current user.
 
Methods inherited from class com.beasys.commerce.user.jsp.beans.LocalProfileBean
getProperty, getPropertyAsString, setProperties, transferProperties
 
Methods inherited from class com.beasys.commerce.axiom.p13n.http.HttpConfigurableEntity
addBusinessPolicy, addPropertyValue, addPropertyValueMapped, get__classIdentifier, get__containingBelonging, get__containingEntity, get__mapKey, get__sequenceNumber, getBusinessPolicy, getDefaultValueFromSchema, getEJBHome, getHandle, getPersistableHandle, getPrimaryKey, getProperty, getPropertyAsString, getPropertyDefault, getPropertyNoDefault, getSuccessor, getUniqueId, isIdentical, remove, removeBusinessPolicy, removeProperty, removePropertyValue, removePropertyValueMapped, removeSuccessor, set__containingBelonging, set__containingEntity, set__mapKey, setProperty, setSuccessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedProfileBean

public CachedProfileBean()
Default Constructor

CachedProfileBean

public CachedProfileBean(javax.servlet.http.HttpServletRequest request,
                         java.lang.String profileKey)
Method Detail

setupSharedProfile

public void setupSharedProfile(javax.servlet.http.HttpServletRequest request)
Allow an implementation of com.beasys.commerce.foundation.property.external.ProfileHandler to setup any necessary state with the current user. Reads implementation class from sharedProfile.profileHandler entry in commerce.properties.

getProperty

public java.lang.Object getProperty(java.lang.String scope,
                                    java.lang.String propertyName,
                                    boolean getCached)
Retrieves the property value for the given scope.
Parameters:
scope - the scope in which the property value is to be looked up
propertyName - the name of the property whose value is sought
getCached - ignored
Returns:
the value of the property, null if the value is not found

getProperty

public java.lang.Object getProperty(java.lang.String scope,
                                    java.lang.String propertyName)
Retrieves the property value for the given scope.
Overrides:
getProperty in class LocalProfileBean
Parameters:
scope - the scope in which the property value is to be looked up
propertyName - the name of the property whose value is sought
Returns:
the value of the property, null if the value is not found

getPropertyAsString

public java.lang.String getPropertyAsString(java.lang.String scope,
                                            java.lang.String propertyName,
                                            boolean getCached)
Retrieves the property value for the given scope, cast as a String by calling toString() on the returned object.
Parameters:
scope - the scope in which the property value is to be looked up
propertyName - the name of the property whose value is sought
getCached - ignored
Returns:
the value of the property, null if the value is not found

setProperty

public void setProperty(java.lang.String scope,
                        java.lang.String propertyName,
                        java.lang.Object value)
Retrieves the property value for the given scope, cast as a String by calling toString() on the returned object.
Overrides:
setProperty in class LocalProfileBean
Parameters:
scope - the scope in which the property value is to be looked up
propertyName - the name of the property whose value is sought
Returns:
the value of the property, null if the value is not found

setProperty

public void setProperty(java.lang.String scope,
                        java.lang.String propertyName,
                        java.lang.Object value,
                        boolean setInCache)
Set a property in the given scope.
Parameters:
scope - the scope in which the property will be set
propertyName - the name of the property to set
value - the value to assign to this property
setInCache - ignored

setProfileKey

public void setProfileKey(java.lang.String profileKey)
Set the current profile key. This also causes all other state to be cleared, because when the current profile changes, everything else is invalidated.
Parameters:
profileKey - the key of the new User or Group

setProfileType

public void setProfileType(java.lang.String profileType)
Set the current profile type. This must be a value defined as a Unified Profile Type. The profileType will be used to determine what class the current profile should be instantiated as, so that explicit properties can be retrieved correctly.
Parameters:
profileType - the new profile type to use

getProfileId

public long getProfileId()
Get the unique numeric id for the current profile.
Returns:
the current profile's id, or -1 if it is not a valid profile

getSuccessorId

public long getSuccessorId()
Get the unique numeric id for the current successor.
Returns:
the current successor's id, or -1 if it is not a valid profile

getProfileKey

public java.lang.String getProfileKey()
Returns:
the current profile key

getProfile

public ConfigurableEntity getProfile()
Returns a handle to itself, so that the profile can be treated as a ConfigurableEntity without locking any entity beans. Any calls to getProperty or setProperty will still be routed through session beans.
Specified by:
getProfile in interface ProfileWrapper
Returns:
this object, which can be used as a ConfigurableEntity

getSuccessor

public ConfigurableEntity getSuccessor()
Returns the wrapped successor.
Specified by:
getSuccessor in interface ProfileWrapper
Returns:
the wrapped successor

setSuccessorType

public void setSuccessorType(java.lang.String successorType)
Set the current successor type. This must be a value defined as a Unified Profile Type. The profileType will be used to determine what class the current successor should be instantiated as, so that explicit properties can be retrieved correctly.
Parameters:
profileType - the new profile type to use for the successor

setSuccessorKey

public void setSuccessorKey(java.lang.String successorKey)
Set the profile key of the current successor
Parameters:
the - successor's key

getSuccessorKey

public java.lang.String getSuccessorKey()
Returns:
the profile key of the current successor

clearValues

public void clearValues()
Clears the values in the cached profile.
Overrides:
clearValues in class LocalProfileBean

removeProperty

public java.lang.Object removeProperty(java.lang.String scope,
                                       java.lang.String propertyName)
Remove a property from the current profile
Overrides:
removeProperty in class LocalProfileBean
Parameters:
scope - the property set of the property to remove
propertyName - the name of the property to remove
Returns:
the old value of the property

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved