Class SessionScopeDelegate
java.lang.Object
com.aquima.interactions.portal.model.session.scope.SessionScopeDelegate
- All Implemented Interfaces:
IDisposableScope
,IPortalMessageScope
,IPortalScope
,ISessionLifecycle
,ISessionScope
,Serializable
- Direct Known Subclasses:
ReadonlySessionScope
,SessionScopeWrapper
Utility class to allow for easy wrapping of a session scope implementation.
- Since:
- 5.0
- Author:
- Jon van Leuven
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SessionScopeDelegate
(ISessionScope parent) Constructs the session scope with the object that needs to be wrapped. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(ISessionActivationContext sessionActivationContext) This method may be used for activating the objects after deserialization.clearAttribute
(String key) This method will remove the value from the scope for the specified key, and returns the value that has been removed.void
Clears all currently pending portal messages.void
clearPortalMessageAction
(String portalMessage) Clears the current action to the specified portal message.void
destroyDisposableObjects
(IDisposeContext context) This method is called when the scope is discarded.This functions returns the current active channel if there is a channel active, otherwise when no channel is active null is returned.This function returns the current active user for the current session.getAttribute
(String key) This method will return the value that has been added to this scope for the specified attribute key.String[]
This method returns an array containing all the names of the attribute that have a value in this scope.Returns the current flow state N.B.String[]
Returns the portalMessages for which a mapping is defined.Retrieves the currently pending portal messages to process.getPortalMessageAction
(String portalMessage) Returns the current action for the specified portal message.This function returns the testPath for the current session.getType()
This method will return the scope type of the portal scope implementation.boolean
hasAttribute
(String key) This method will check if an attribute with the specified key has been added to this scope.void
notifyPortalMessage
(IPortalMessage message) Notifies a portal message after the current event has been processed.void
This method may be used for preparing the objects for serialization.Retrieves and clears the currently pending portal messages to process.setAttribute
(String key, Serializable attrValue) This method will set the value in the scope under the specified key, and will return the value that might have been replaced by this action.void
setPortalMessageAction
(String portalMessage, PortalMessageAction action) Sets the action to the specified portal message.void
setTestPath
(String testPath) This method will set the testPath for the current session.void
This method will set the user for the current session.
-
Constructor Details
-
SessionScopeDelegate
Constructs the session scope with the object that needs to be wrapped.- Parameters:
parent
- The session scope that needs to be wrapped by this delegate.
-
-
Method Details
-
getActiveChannel
Description copied from interface:ISessionScope
This functions returns the current active channel if there is a channel active, otherwise when no channel is active null is returned.- Specified by:
getActiveChannel
in interfaceISessionScope
- Returns:
- The current active channel.
-
getCurrentFlowState
Description copied from interface:ISessionScope
Returns the current flow state N.B. We recommend one does not use this method in services and containers.- Specified by:
getCurrentFlowState
in interfaceISessionScope
- Returns:
- A flowstate
-
getAttributeNames
Description copied from interface:IPortalScope
This method returns an array containing all the names of the attribute that have a value in this scope.- Specified by:
getAttributeNames
in interfaceIPortalScope
- Returns:
- array containing all the names of the attribute that have a value in this scope.
-
clearAttribute
Description copied from interface:IPortalScope
This method will remove the value from the scope for the specified key, and returns the value that has been removed. When there is no value present for the specified key, the method invocation has no effect, and a null value will be returned.- Specified by:
clearAttribute
in interfaceIPortalScope
- Parameters:
key
- Name of the attribute of which the value should be removed (mandatory).- Returns:
- The value that was removed from the scope, or null when there was no value defined for the specified key.
-
getAttribute
Description copied from interface:IPortalScope
This method will return the value that has been added to this scope for the specified attribute key. When there is no value present for the specified key, a null value will be returned.- Specified by:
getAttribute
in interfaceIPortalScope
- Parameters:
key
- Name of the attribute for which the value is requested (mandatory).- Returns:
- The value for the specified key, or null when there is no value present.
-
hasAttribute
Description copied from interface:IPortalScope
This method will check if an attribute with the specified key has been added to this scope. The key name of the attribute is not case sensitive.- Specified by:
hasAttribute
in interfaceIPortalScope
- Parameters:
key
- Name of the attribute that should be checked (mandatory).- Returns:
- boolean indicating if a value is present for the specified attribute key.
-
setAttribute
Description copied from interface:IPortalScope
This method will set the value in the scope under the specified key, and will return the value that might have been replaced by this action. When there was no value present for the specified key, a null value will be returned.- Specified by:
setAttribute
in interfaceIPortalScope
- Parameters:
key
- Name of the attribute for which the value should be set (mandatory).attrValue
- The value that should be set for the specified key (mandatory).- Returns:
- The value that was replaced (previously present) by the set action.
-
getActiveUser
Description copied from interface:ISessionScope
This function returns the current active user for the current session.- Specified by:
getActiveUser
in interfaceISessionScope
- Returns:
- The current active user, never null.
-
setUser
Description copied from interface:ISessionScope
This method will set the user for the current session. The existing user information will be discarded.- Specified by:
setUser
in interfaceISessionScope
- Parameters:
user
- The user, may not be null.
-
getTestPath
Description copied from interface:ISessionScope
This function returns the testPath for the current session.- Specified by:
getTestPath
in interfaceISessionScope
- Returns:
- The testPath for the current session
-
setTestPath
Description copied from interface:ISessionScope
This method will set the testPath for the current session. The existing testPath will be discarded.- Specified by:
setTestPath
in interfaceISessionScope
- Parameters:
testPath
- The testpath, may be null.
-
destroyDisposableObjects
Description copied from interface:IDisposableScope
This method is called when the scope is discarded.- Specified by:
destroyDisposableObjects
in interfaceIDisposableScope
-
getMappedPortalMessages
Description copied from interface:IPortalMessageScope
Returns the portalMessages for which a mapping is defined.- Specified by:
getMappedPortalMessages
in interfaceIPortalMessageScope
- Returns:
- The names of the mapped portal messages, not null.
-
setPortalMessageAction
Description copied from interface:IPortalMessageScope
Sets the action to the specified portal message.- Specified by:
setPortalMessageAction
in interfaceIPortalMessageScope
- Parameters:
portalMessage
- The portal message to map, not null or empty.action
- The action to perform on the message, not null.
-
removePendingPortalMessages
Description copied from interface:ISessionScope
Retrieves and clears the currently pending portal messages to process.- Specified by:
removePendingPortalMessages
in interfaceISessionScope
- Returns:
- The portal messages, not null.
-
clearPortalMessageAction
Description copied from interface:IPortalMessageScope
Clears the current action to the specified portal message.- Specified by:
clearPortalMessageAction
in interfaceIPortalMessageScope
- Parameters:
portalMessage
- The portal message to clear, not null or empty.
-
getPortalMessageAction
Description copied from interface:IPortalMessageScope
Returns the current action for the specified portal message.- Specified by:
getPortalMessageAction
in interfaceIPortalMessageScope
- Parameters:
portalMessage
- The portal message to retrieve the action for, not null or empty.- Returns:
- The current action.
-
notifyPortalMessage
Description copied from interface:ISessionScope
Notifies a portal message after the current event has been processed.- Specified by:
notifyPortalMessage
in interfaceISessionScope
- Parameters:
message
- The portalmessage, not null.
-
getPendingPortalMessages
Description copied from interface:ISessionScope
Retrieves the currently pending portal messages to process.- Specified by:
getPendingPortalMessages
in interfaceISessionScope
- Returns:
- The portalmessages, not null.
-
clearPendingPortalMessages
public void clearPendingPortalMessages()Description copied from interface:ISessionScope
Clears all currently pending portal messages.- Specified by:
clearPendingPortalMessages
in interfaceISessionScope
-
getType
Description copied from interface:IPortalScope
This method will return the scope type of the portal scope implementation.- Specified by:
getType
in interfaceIPortalScope
- Returns:
- The current scope type.
-
activate
Description copied from interface:ISessionLifecycle
This method may be used for activating the objects after deserialization.- Specified by:
activate
in interfaceISessionLifecycle
- Parameters:
sessionActivationContext
- the current session activation context.
-
passivate
public void passivate()Description copied from interface:ISessionLifecycle
This method may be used for preparing the objects for serialization.- Specified by:
passivate
in interfaceISessionLifecycle
-
getSessionScope
-