Class ServiceContextDelegate
java.lang.Object
com.aquima.interactions.portal.model.session.ServiceContextDelegate
- All Implemented Interfaces:
IEventContext
,IPortalContext
,IServiceContext
,Serializable
Utility class to allow for easy wrapping of a service context implementation.
- Since:
- 11.0
- Author:
- Emoke Olti
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addErrorMessage
(ValueReference attributeReference, String key, String[] parameters) This method may be used to add an error to the current context.boolean
addErrorText
(ValueReference attributeReference, IMultilingualText text) This method may be used to add an error to the current context.boolean
addWarningMessage
(ValueReference attributeReference, String key, String[] parameters) This method may be used to add a warning to the current context.boolean
addWarningText
(ValueReference attributeReference, IMultilingualText text) This method may be used to add a warning to the current context.boolean
This method will remove all the errors that might have been added.This method returns a portal context for the specified module.This method returns a portal context for the specified module.getActiveInstance
(String entityName) Returns the active instance connected to the specified entity name.This method returns the current application mode.This method returns the audit engine.Returns the case engine client, may be nullReturns the comments managerThis method returns the current communication engine for the current context.This method may be used to request the connection manager of the application.This method returns the content manager factory for the current contextgetContentManagerFactory
(PersistenceLevel persistence) Returns a content manager factory for the current context and the given persistence level.Returns the current top-level flow.Gets the current language for this context, which could be null depending on the implementation.Returns a debugger instance if one is currently attached, or null if no debugger is attached.This method returns a document engine for the current context.This method returns an element factory that may be used to expand pre-defined elements from the composer using the current container context.getErrors
(boolean onlyGenericErrors) Returns the error messages (never null) that have been set in the request scope.getErrors
(ValueReference attributeReference) Retrieves the errors for a specific ValueReference (never null) When no error messages have been set for the specified attribute, an empty array will be returned.getEvent()
Returns the event for which this context is working.Holds the expression parser which is bound to the rule engine.The flow engine for the current session.Retrieves the flow scope form the context.This method returns a function call definition manager for the current context.This method returns an element factory that may be used to expand pre-defined elements from the composer using the mapping context.This method returns a mapping manager for the current context.This method returns a mask manager for the current context.This method returns the match engine as configured for the application.Returns the metamodel for which the current portal-session is constructed.Retrieves the page scope form the context.getParameter
(String name) This method returns the value for the specified parameter key.This method returns an object containing all the parameters that are defined for this service.This method returns a process scope for the current context.This method will return the current profile interface.Returns the project for which the current portal-session is constructed.Retrieves the request scope form the context.Retrieves the resource manager.Returns the rule-engine for which the current portal-session is constructed.This method returns the service call name as defined in studio.This method will return the service factory of the current application.This method returns a service manager for the current context.This method returns the type name of the service.Returns the ID of the session.This object contains parameters and information the entire session.getState()
Returns the state of the portalcontext (for serialization).boolean
This method returns the boolean indicating if errors should abort the current flow.This method returns the trace engine.The tree engine for the current session.This method returns the profile of all the user set data.Retrieves the user scope for the current user from the context.This method returns the webservices for the current context.boolean
Indicator if the request scope contains generic errors or errors on attribute values.boolean
This method returns a boolean indicating if the flow should be aborted.void
pushActiveInstance
(IEntityInstance instance) This method will activate the instance in the current context.void
restore
(IPortalContextState state) Clears the current state and overrides it with the provided state.void
setFlowBlocked
(boolean rollback) This method may be used to block the current flow regardless if any errors are present.void
setFocus
(ValueReference reference) This method sets the focus for a specific ValueReference (never null).void
setStopOnErrors
(boolean stopOnErrors) This method may be used to change the behavior when an error is encountered after the component using the context has completed.
-
Constructor Details
-
ServiceContextDelegate
-
-
Method Details
-
getEvent
Description copied from interface:IEventContext
Returns the event for which this context is working.- Specified by:
getEvent
in interfaceIEventContext
- Returns:
- The fired even object which is never null.
-
hasErrors
public boolean hasErrors()Description copied from interface:IEventContext
Indicator if the request scope contains generic errors or errors on attribute values.- Specified by:
hasErrors
in interfaceIEventContext
- Returns:
- boolean indicating if errors are present in the request scope.
-
clearErrors
public boolean clearErrors()Description copied from interface:IEventContext
This method will remove all the errors that might have been added. The method returns a boolean indicating if any errors were actually discarded.
Warning: Use this method with care, as clearing errors might result in a state that is not consistent with the rules defined in the model.- Specified by:
clearErrors
in interfaceIEventContext
- Returns:
- a boolean indicating if any errors were actually discarded.
-
getStopOnErrors
public boolean getStopOnErrors()Description copied from interface:IEventContext
This method returns the boolean indicating if errors should abort the current flow.- Specified by:
getStopOnErrors
in interfaceIEventContext
- Returns:
- boolean indicating if errors should abort the current flow.
-
setStopOnErrors
public void setStopOnErrors(boolean stopOnErrors) Description copied from interface:IEventContext
This method may be used to change the behavior when an error is encountered after the component using the context has completed. The default behavior is to stop any flow processing when the component using the context added an error. When this method is invoked with the value false, any errors from the component will be ignored, and the flow will continue normally. This setting has only effect on the current component using the flow. If another component is invoked after, that does have the stopOnErrors set to true, the flow will still be aborted.
Warning: Use this method with care, as it can result in errors being ignored or not shown if the result page does not contain the fields the errors are defined for.- Specified by:
setStopOnErrors
in interfaceIEventContext
- Parameters:
stopOnErrors
- Boolean indicating if the flow should be aborted when an error is encountered.
-
isFlowBlocked
public boolean isFlowBlocked()Description copied from interface:IEventContext
This method returns a boolean indicating if the flow should be aborted. The flow is aborted under the following conditions:- StopOnErrors = true AND hasErrors = true
- SetFlowBlocked was invoked.
- Specified by:
isFlowBlocked
in interfaceIEventContext
- Returns:
- boolean indicating if the flow should be aborted.
-
setFlowBlocked
public void setFlowBlocked(boolean rollback) Description copied from interface:IEventContext
This method may be used to block the current flow regardless if any errors are present. The rollback parameter may be used to indicate if changes so far should be discarded.- Specified by:
setFlowBlocked
in interfaceIEventContext
- Parameters:
rollback
- boolean to indicate if changes so far should be discarded.
-
addErrorText
Description copied from interface:IEventContext
This method may be used to add an error to the current context. The error may be linked to a value by specifying a value reference, or the value reference may be left empty (null) to indicate that the error is generic.- Specified by:
addErrorText
in interfaceIEventContext
- Parameters:
attributeReference
- Optional parameter that specifies the value the error belongs to.text
- The error message that should be added to the context.- Returns:
- boolean indicating if the error was actually added (duplicate messages are ignored).
-
addErrorMessage
Description copied from interface:IEventContext
This method may be used to add an error to the current context. The error may be linked to a value by specifying a value reference, or the value reference may be left empty (null) to indicate that the error is generic. The message of the error is retrieved from the meta model for the specified the key.- Specified by:
addErrorMessage
in interfaceIEventContext
- Parameters:
attributeReference
- Optional parameter that specifies the value the error belongs to.key
- The id of the message from the meta model.parameters
- Optional parameters for the message.- Returns:
- boolean indicating if the error was actually added (duplicate messages are ignored).
-
addWarningText
Description copied from interface:IEventContext
This method may be used to add a warning to the current context. The warning may be linked to a value by specifying a value reference, or the value reference may be left empty (null) to indicate that the warning is generic.- Specified by:
addWarningText
in interfaceIEventContext
- Parameters:
attributeReference
- Optional parameter that specifies the value the warning belongs to.text
- The warning message that should be added to the context.- Returns:
- boolean indicating if the error was actually added (duplicate messages are ignored).
-
addWarningMessage
public boolean addWarningMessage(ValueReference attributeReference, String key, String[] parameters) Description copied from interface:IEventContext
This method may be used to add a warning to the current context. The warning may be linked to a value by specifying a value reference, or the value reference may be left empty (null) to indicate that the warning is generic. The message of the warning is retrieved from the meta model for the specified the key.- Specified by:
addWarningMessage
in interfaceIEventContext
- Parameters:
attributeReference
- Optional parameter that specifies the value the warning belongs to.key
- The id of the message from the meta model.parameters
- Optional parameters for the message.- Returns:
- boolean indicating if the error was actually added (duplicate messages are ignored).
-
getErrors
Description copied from interface:IEventContext
Returns the error messages (never null) that have been set in the request scope. When no errors have been an empty array will be returned.- Specified by:
getErrors
in interfaceIEventContext
- Parameters:
onlyGenericErrors
- Boolean indicating if only generic error messages should be returned.- Returns:
- Array containing the errors that have been set on the request scope.
-
getErrors
Description copied from interface:IEventContext
Retrieves the errors for a specific ValueReference (never null) When no error messages have been set for the specified attribute, an empty array will be returned.- Specified by:
getErrors
in interfaceIEventContext
- Parameters:
attributeReference
- Reference to the attribute for which the error messages are requested.- Returns:
- Array containing the error messages for the specified attribute (may be empty).
-
setFocus
Description copied from interface:IEventContext
This method sets the focus for a specific ValueReference (never null).- Specified by:
setFocus
in interfaceIEventContext
- Parameters:
reference
- Reference to the attribute for which the focus has to be set.
-
getServiceCallName
Description copied from interface:IServiceContext
This method returns the service call name as defined in studio. A single service might be specified multiple times with different parameters under different call names. Use the service type name to uniquely identify the service.- Specified by:
getServiceCallName
in interfaceIServiceContext
- Returns:
- The call name of the service as defined in studio.
-
getServiceTypeName
Description copied from interface:IServiceContext
This method returns the type name of the service. The type name is used to uniquely identify the service. Multiple definitions of the same service may exist, sharing the same type, but with different call names.- Specified by:
getServiceTypeName
in interfaceIServiceContext
- Returns:
- The type name of the service.
-
getParameter
Description copied from interface:IServiceContext
This method returns the value for the specified parameter key. When no value is defined for the given key, a null value will be returned. The parameter name is not case sensitive.- Specified by:
getParameter
in interfaceIServiceContext
- Parameters:
name
- The name of the parameter for which the value is requested.- Returns:
- The value of the specified parameter.
-
getParameters
Description copied from interface:IServiceContext
This method returns an object containing all the parameters that are defined for this service.- Specified by:
getParameters
in interfaceIServiceContext
- Returns:
- Object containing the service parameters.
-
getServiceFactory
Description copied from interface:IServiceContext
This method will return the service factory of the current application. The service factory may be used to request implementations of other services to allow the current service to combine the logic of several services.- Specified by:
getServiceFactory
in interfaceIServiceContext
- Returns:
- The service factory of the current application.
-
getMetaModel
Description copied from interface:IPortalContext
Returns the metamodel for which the current portal-session is constructed. This metamodel does not necessarily reflect the most recent version but it is the exact version this session was started with.- Specified by:
getMetaModel
in interfaceIPortalContext
- Returns:
- The metamodel which is never null.
-
getProject
Description copied from interface:IPortalContext
Returns the project for which the current portal-session is constructed. This project does not necessarily reflect the most recent version but it is the exact version this session was started with.- Specified by:
getProject
in interfaceIPortalContext
- Returns:
- The project which is never null.
-
getProfile
Description copied from interface:IPortalContext
This method will return the current profile interface. In addition to the standard profile behavior, the implementation returned here will also automatically inference unknown values, and is aware of the instances that might have been activated during the page flow.See also getUserProfile()
- Specified by:
getProfile
in interfaceIPortalContext
- Returns:
- Profile interface.
-
getRuleEngine
Description copied from interface:IPortalContext
Returns the rule-engine for which the current portal-session is constructed. This rule-engine does not necessarily reflect the most recent version with the most recent rules however it is the exact version this session was started with.- Specified by:
getRuleEngine
in interfaceIPortalContext
- Returns:
- The rule-engine which is never null.
-
getElementComposer
Description copied from interface:IPortalContext
This method returns an element factory that may be used to expand pre-defined elements from the composer using the current container context.- Specified by:
getElementComposer
in interfaceIPortalContext
- Returns:
- An element factory that can be used to expand elements from the composer.
-
getMappingComposer
Description copied from interface:IPortalContext
This method returns an element factory that may be used to expand pre-defined elements from the composer using the mapping context.- Specified by:
getMappingComposer
in interfaceIPortalContext
- Returns:
- An element factory that can be used to expand elements from the composer.
-
getExpressionParser
Description copied from interface:IPortalContext
Holds the expression parser which is bound to the rule engine. One can use this to prepare expressions for evaluation.- Specified by:
getExpressionParser
in interfaceIPortalContext
- Returns:
- The expression parser which is never null
-
getFlowEngine
Description copied from interface:IPortalContext
The flow engine for the current session.- Specified by:
getFlowEngine
in interfaceIPortalContext
- Returns:
- The flow-engine which is never null.
-
getTreeEngine
Description copied from interface:IPortalContext
The tree engine for the current session.- Specified by:
getTreeEngine
in interfaceIPortalContext
- Returns:
- The tree-engine which is never null.
-
getMatchEngine
Description copied from interface:IPortalContext
This method returns the match engine as configured for the application.- Specified by:
getMatchEngine
in interfaceIPortalContext
- Returns:
- the match engine as configured for the application.
-
getTraceEngine
Description copied from interface:IPortalContext
This method returns the trace engine.- Specified by:
getTraceEngine
in interfaceIPortalContext
- Returns:
- the Trace Engine.
-
getAuditEngine
Description copied from interface:IPortalContext
This method returns the audit engine. The audit engine can be used to log messages that can later be used to audit users behaviour inside the application. It is up to the developer to call the audit engine's audit functionality on the appropriate times when user activity should be logged.- Specified by:
getAuditEngine
in interfaceIPortalContext
- Returns:
- the Audit Engine.
-
getActiveInstance
Description copied from interface:IPortalContext
Returns the active instance connected to the specified entity name. An instance might have been activated in the following ways:- The instance is a singleton, and therefore always active.
- The instance is activated through a container (only during page evaluation).
- The instance is activated by using the pushActiveInstance within the same flow.
- Specified by:
getActiveInstance
in interfaceIPortalContext
- Parameters:
entityName
- The entity name for which the active instance is requested.- Returns:
- The instance that is active for the specified entity type.
-
pushActiveInstance
Description copied from interface:IPortalContext
This method will activate the instance in the current context. Once an instance has been activated in a portal context, the instance will stay active until the page flow the activation occurred in has been completed.- Specified by:
pushActiveInstance
in interfaceIPortalContext
- Parameters:
instance
- The instance that should be activated.
-
getUserScope
Description copied from interface:IPortalContext
Retrieves the user scope for the current user from the context. This object's life time is shared over sessions and applications.- Specified by:
getUserScope
in interfaceIPortalContext
- Returns:
- A request scope corresponding to this request. Never null
- See Also:
-
getRequestScope
Description copied from interface:IPortalContext
Retrieves the request scope form the context. This object contains parameters and information about the request.- Specified by:
getRequestScope
in interfaceIPortalContext
- Returns:
- A request scope corresponding to this request. Never null
- See Also:
-
getPageScope
Description copied from interface:IPortalContext
Retrieves the page scope form the context. This object contains parameters and information as long as the portal-engine is on the same page. After the page is left the scope is changed and is cleared to hold new properties bound to that page.- Specified by:
getPageScope
in interfaceIPortalContext
- Returns:
- The page-bound scope which is never null.
- See Also:
-
getSessionScope
Description copied from interface:IPortalContext
This object contains parameters and information the entire session. This means from the portalsession is created until it has been destroyed. One could say the session scope lives at least as long as one is working with a specific application and profile.- Specified by:
getSessionScope
in interfaceIPortalContext
- Returns:
- The session-bound scope which is never null.
- See Also:
-
getResourceManager
Description copied from interface:IPortalContext
Retrieves the resource manager.- Specified by:
getResourceManager
in interfaceIPortalContext
- Returns:
- Resource manager for the current session.
-
getConnectionManager
Description copied from interface:IPortalContext
This method may be used to request the connection manager of the application. The connection manager services the connections that are predefined for the application.- Specified by:
getConnectionManager
in interfaceIPortalContext
- Returns:
- the connection manager of the application.
-
getApplicationMode
Description copied from interface:IPortalContext
This method returns the current application mode. Never returns null- Specified by:
getApplicationMode
in interfaceIPortalContext
- Returns:
- The current application mode.
-
getDocumentEngine
Description copied from interface:IPortalContext
This method returns a document engine for the current context.- Specified by:
getDocumentEngine
in interfaceIPortalContext
- Returns:
- Document engine for the current session.
-
getServiceManager
Description copied from interface:IPortalContext
This method returns a service manager for the current context. Never returns null- Specified by:
getServiceManager
in interfaceIPortalContext
- Returns:
- A service manager for the current session.
-
getFunctionCallDefinitionManager
Description copied from interface:IPortalContext
This method returns a function call definition manager for the current context. Never returns null- Specified by:
getFunctionCallDefinitionManager
in interfaceIPortalContext
- Returns:
- A function call definition manager for the current session.
-
getMaskManager
Description copied from interface:IPortalContext
This method returns a mask manager for the current context. Never returns null- Specified by:
getMaskManager
in interfaceIPortalContext
- Returns:
- A mask manager for the current session.
-
getContentManagerFactory
Description copied from interface:IPortalContext
This method returns the content manager factory for the current context- Specified by:
getContentManagerFactory
in interfaceIPortalContext
- Returns:
- A content manager factory
-
getContentManagerFactory
Description copied from interface:IPortalContext
Returns a content manager factory for the current context and the given persistence level.When the persistence level is temporary, the content created with the returned content manager factory and content manager will be deleted when a certain event occurs (eg. portal scope ends, a certain amount of time passes, etc.) The strategy used to delete the temporary content is determined by the underlying
ITemporaryPersistenceStrategy
in use.When the persistence level is permanent, the content must explicitly be deleted from the connection when it is no longer needed.
- Specified by:
getContentManagerFactory
in interfaceIPortalContext
- Parameters:
persistence
- the desired persistence level- Returns:
- the content manager factory, never null
-
getProcessScope
Description copied from interface:IPortalContext
This method returns a process scope for the current context. Never returns null- Specified by:
getProcessScope
in interfaceIPortalContext
- Returns:
- A process scope.
-
getMappingManager
Description copied from interface:IPortalContext
This method returns a mapping manager for the current context. Never returns null- Specified by:
getMappingManager
in interfaceIPortalContext
- Returns:
- A mapping manager for the current session.
-
getUserProfile
Description copied from interface:IPortalContext
This method returns the profile of all the user set data. This profile may be used to retrieve the user data without any sourcing of values.- Specified by:
getUserProfile
in interfaceIPortalContext
- Returns:
- The readonly user profile, never null
-
getFlowScope
Description copied from interface:IPortalContext
Retrieves the flow scope form the context. This object contains parameters and information for the current flow. After the flow is left the scope is changed and is cleared to hold new properties bound to that flow.- Specified by:
getFlowScope
in interfaceIPortalContext
- Returns:
- The flow-bound scope which is never null.
- See Also:
-
forModule
Description copied from interface:IPortalContext
This method returns a portal context for the specified module. If the module id refers to module of this context: 'this' is returned. Otherwise a new portal context (with empty state) is returned.- Specified by:
forModule
in interfaceIPortalContext
- Parameters:
moduleId
- The module id, may not be null.- Returns:
- The portal context for the specified module.
-
forModule
Description copied from interface:IPortalContext
This method returns a portal context for the specified module. If `createNew` is true, a new portal context (with empty state) is returned even if the module id refers to the module of this context. Otherwise, this method behaves identically toIPortalContext.forModule(ModuleID)
.- Specified by:
forModule
in interfaceIPortalContext
- Parameters:
moduleId
- The module id, may not be null.createNew
- Whether to create a new, empty, portal context even if this context refers to the requested module id.- Returns:
- The portal context for the specified module.
-
getCommunicationEngine
Description copied from interface:IPortalContext
This method returns the current communication engine for the current context.- Specified by:
getCommunicationEngine
in interfaceIPortalContext
- Returns:
- The communication engine, never null.
-
getWebServices
Description copied from interface:IPortalContext
This method returns the webservices for the current context.- Specified by:
getWebServices
in interfaceIPortalContext
- Returns:
- The webservices, never null.
-
getState
Description copied from interface:IPortalContext
Returns the state of the portalcontext (for serialization).- Specified by:
getState
in interfaceIPortalContext
- Returns:
- returns the current state of the portalcontext.
-
restore
Description copied from interface:IPortalContext
Clears the current state and overrides it with the provided state.- Specified by:
restore
in interfaceIPortalContext
- Parameters:
state
- The new state for this context.
-
getCurrentLanguage
Description copied from interface:IPortalContext
Gets the current language for this context, which could be null depending on the implementation.- Specified by:
getCurrentLanguage
in interfaceIPortalContext
- Returns:
- The current language, could be null.
-
getCurrentFlow
Description copied from interface:IPortalContext
Returns the current top-level flow.- Specified by:
getCurrentFlow
in interfaceIPortalContext
- Returns:
- The current top-level flow.
-
getSessionId
Description copied from interface:IPortalContext
Returns the ID of the session.- Specified by:
getSessionId
in interfaceIPortalContext
- Returns:
- the id of the session (may be null).
-
getCaseEngineClient
Description copied from interface:IPortalContext
Returns the case engine client, may be null- Specified by:
getCaseEngineClient
in interfaceIPortalContext
- Returns:
- the case engine client, may be null
-
getCommentsManager
Description copied from interface:IPortalContext
Returns the comments manager- Specified by:
getCommentsManager
in interfaceIPortalContext
- Returns:
- the comments manager
-
getDebugger
Description copied from interface:IPortalContext
Returns a debugger instance if one is currently attached, or null if no debugger is attached.- Specified by:
getDebugger
in interfaceIPortalContext
- Returns:
- a debugger instance, or null if none is attached.
-