public class BusinessContextFacade
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
Modifier and Type | Method and Description |
---|---|
ActivityToken |
begin(com.ibm.commerce.component.contextservice.ActivityData initData)
This method creates an activity with the given initialization data.
|
ActivityToken |
begin(java.lang.String logonId,
java.lang.String pwd,
com.ibm.commerce.component.contextservice.ActivityData initData)
This method returns an activity for a given valid user logon ID and password.
|
void |
complete(ActivityToken token)
This method completes a given activity.
|
ActivityToken |
copyActivity(ActivityToken currentToken,
com.ibm.commerce.component.contextservice.ActivityData sessionData)
This method creates a new activity based on the contexts associated with a given token and session data.
|
ActivityToken |
createTransientClonedActivity(ActivityToken oldToken)
Reserved for IBM internal use.
|
void |
endRequest(ActivityToken token)
Reserved for IBM internal use.
|
void |
expire(ActivityToken token)
Reserved for IBM internal use.
|
ActivityToken |
findActivityTokenForUserAndStore(java.lang.Long callerId,
java.lang.Integer storeId)
Reserved for IBM internal use.
|
Context |
findContext(ActivityToken token,
java.lang.String strContextName)
This method finds the context with a given name that is associated with a given activity.
|
void |
flushCache()
Reserved for IBM internal use.
|
java.util.Map |
getContextMap(ActivityToken token)
Reserved for IBM internal use.
|
java.util.List |
getContextSPIs(ActivityToken token)
Reserved for IBM internal use.
|
static BusinessContextFacade |
getInstance()
This method returns the
BusinessContextFacade singleton. |
void |
initialize()
Reserved for IBM internal use.
|
boolean |
isContextDirty(ActivityToken token)
Reserved for IBM internal use.
|
boolean |
isValidToken(ActivityToken token)
This method checks the validity of a given token.
|
ActivityToken |
resolveActivity(ActivityToken token,
com.ibm.commerce.component.contextservice.ActivityData initData)
Reserved for IBM internal use.
|
void |
rollbackRequest(ActivityToken token)
Reserved for IBM internal use.
|
void |
setContextMap(ActivityToken token,
java.util.Map ctxMap)
Reserved for IBM internal use.
|
void |
startRequest(ActivityToken token,
com.ibm.commerce.component.contextservice.ActivityData sessionData)
Reserved for IBM internal use.
|
void |
stopActivities(java.lang.Long nUserId)
Reserved for IBM internal use.
|
public static final java.lang.String COPYRIGHT
public void initialize()
This method initializes this singleton.
public static BusinessContextFacade getInstance()
BusinessContextFacade
singleton.BusinessContextFacade
singletonpublic ActivityToken begin(com.ibm.commerce.component.contextservice.ActivityData initData) throws BusinessContextServiceException
initialize(ActivityToken, ActivityData)
method of
each business context, where all the required parameters are extracted and used to populate the context.initData
- the initialization dataBusinessContextServiceException
- on any error encounteredpublic ActivityToken begin(java.lang.String logonId, java.lang.String pwd, com.ibm.commerce.component.contextservice.ActivityData initData) throws BusinessContextServiceException, BusinessContextServiceAuthenticationException
logonId
- the logon ID of the user who is trying to initiate an activitypwd
- the user's passwordinitData
- the initialization dataBusinessContextServiceAuthenticationException
- if the user cannot be authenticatedBusinessContextServiceException
- on any other error encounteredpublic Context findContext(ActivityToken token, java.lang.String strContextName) throws BusinessContextServiceException, BusinessContextNotFoundException
token
- the activity tokenstrContextName
- the context namenull
if not foundBusinessContextServiceException
- if any generic error occursBusinessContextNotFoundException
- if the specified context can not be loaded from the databasepublic void expire(ActivityToken token) throws BusinessContextServiceException
This method marks a given activity as expired.
Changes the status of the activity to E
in the CTXMGMT table
to indicate that the activity has expired.
token
- the activity tokenBusinessContextServiceException
- on any error encounteredpublic void complete(ActivityToken token) throws BusinessContextServiceException
T
in the CTXMGMT table
to indicate that the activity is no longer active.token
- the activity tokenBusinessContextServiceException
- on any error encounteredpublic void startRequest(ActivityToken token, com.ibm.commerce.component.contextservice.ActivityData sessionData) throws BusinessContextServiceException
This method is called before request execution for any necessary setup.
It, in turn, passes the session data down to the preInvoke(ActivityData)
method of each business context associated with the given activity.
The preInvoke(ActivityData) method extracts all the required parameters and
updates the context.
token
- the activity tokensessionData
- the map of name-value pairs for the parameters that are passed in the requestBusinessContextServiceException
- on any error encounteredpublic void endRequest(ActivityToken token) throws BusinessContextServiceException
This method is called after request execution for any necessary cleanup.
It, in turn, calls the postInvoke(ActivityData)
method of each business context associated with
the given activity.
token
- the activity tokenBusinessContextServiceException
- on any error encounteredpublic void rollbackRequest(ActivityToken token) throws BusinessContextServiceException
This method is called when a request is rolled back.
It, in turn, calls the reset()
method of each business context associated with
the given activity.
token
- the activity tokenBusinessContextServiceException
- on any error encounteredpublic ActivityToken copyActivity(ActivityToken currentToken, com.ibm.commerce.component.contextservice.ActivityData sessionData) throws BusinessContextServiceException
initialize(ActivityToken, ActivityToken, ActivityData)
method of
each business context, where the context is first initialized based on the input activity's context and then
updated based on the session data.currentToken
- the activity token of the input activitysessionData
- the name-value pairs for the parameters that are passed in the requestBusinessContextServiceException
- on any error encounteredpublic ActivityToken resolveActivity(ActivityToken token, com.ibm.commerce.component.contextservice.ActivityData initData) throws BusinessContextServiceException
This method gets the valid activity token that is associated with a particular user and store. This method is mainly used when a user switches from one store to another.
token
- an activity token that identifies the userinitData
- initialization data that identifies the storenull
otherwiseBusinessContextServiceException
- on any error encounteredpublic ActivityToken findActivityTokenForUserAndStore(java.lang.Long callerId, java.lang.Integer storeId) throws BusinessContextServiceException
This method finds an activity token for a particular caller and store.
callerId
- the caller IDstoreId
- the store IDnull
otherwiseBusinessContextServiceException
- on any error encounteredpublic boolean isValidToken(ActivityToken token) throws InvalidActivityTokenException
token
- the tokentrue
if the token is validInvalidActivityTokenException
- if the token is not validpublic java.util.Map getContextMap(ActivityToken token) throws BusinessContextServiceException
This method gets a map of string representations of all the contexts associated with a given activity. This method is provided for generic user support.
token
- the token that identifies the activityBusinessContextServiceException
- on any error encounteredpublic void setContextMap(ActivityToken token, java.util.Map ctxMap) throws BusinessContextServiceException
This method initializes the contexts of a given activity based on a map of string representations of all of the activity's contexts. This method is provided for generic user support.
token
- the token that identifies the activityctxMap
- the map of string representations of all the contexts associated with the activityBusinessContextServiceException
- on any error encounteredpublic boolean isContextDirty(ActivityToken token)
This method checks whether any of the contexts associated with a given token are dirty.
token
- the token to checktrue
if any of the contexts are dirty; false
otherwisepublic ActivityToken createTransientClonedActivity(ActivityToken oldToken)
This method creates a transient cloned token from a given token. The resulting token is a transient object to be used within a request. Its contexts are copies of the input token's contexts.
oldToken
- the token to be clonedpublic void stopActivities(java.lang.Long nUserId)
This method stops all activities for a given user.
nUserId
- the ID of the user for whom all activities are to be stoppedpublic void flushCache()
This method flushes all activities from the activity cache for the current thread. This method is called at the exit point of a request, when contexts are no longer required.
public java.util.List getContextSPIs(ActivityToken token)
This method gets all the context service provider interface objects that are associated with a given activity.
token
- the token that identifies the activity