Class ContainerContext
java.lang.Object
com.aquima.interactions.portal.model.session.PortalContextDelegate
com.aquima.interactions.portal.model.session.ContainerContext
- All Implemented Interfaces:
IContainerContext
,IEventContext
,IPortalContext
,IInternalPortalContext
,Serializable
IContainerContext implementation using the current page context.
- Since:
- 5.0
- Author:
- O. Kerpershoek
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ContainerContext
(ComposerHandler handler, IComposerContext composerContext, ContainerDefinition container, ITypedParameters typedParameters) -
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.getActiveInstance
(String entityName) Returns the active instance connected to the specified entity name.This method will return the id of container that can be used to uniquely identify the container.This method will return the name of the container that the dynamic container component was applied to.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.This method returns an element factory that may be used to expand pre-defined elements from the composer using the mapping context.getParameter
(String name) This method will return the value for the parameter with the specified name.This method will return all the parameters defined for the container at once in a single object.This method will return the current profile interface.boolean
This method returns the boolean indicating if errors should abort the current flow.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
registerCallback
(IElement element, ICallbackFunction function, InvocationType when) This method may be used to add a callback function to an element of the container.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.Methods inherited from class com.aquima.interactions.portal.model.session.PortalContextDelegate
forModule, forModule, getApplication, getApplicationMode, getApplicationModel, getAuditEngine, getCaseEngineClient, getCommentsManager, getCommunicationEngine, getComposer, getConfiguration, getConnectionManager, getContentManagerFactory, getContentManagerFactory, getContext, getCurrentFlow, getCurrentLanguage, getDebugger, getDocumentEngine, getExpressionParser, getFactoryManager, getFlowEngine, getFlowScope, getFunctionCallDefinitionManager, getId, getMappingManager, getMaskManager, getMatchEngine, getMetaModel, getPageScope, getProcessScope, getProject, getRequestScope, getResourceManager, getRuleEngine, getServiceManager, getSessionId, getSessionScope, getState, getTraceEngine, getTreeEngine, getUserProfile, getUserScope, getWebServices, pushActiveInstance, restore
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.aquima.interactions.portal.IPortalContext
forModule, forModule, getApplicationMode, getAuditEngine, getCaseEngineClient, getCommentsManager, getCommunicationEngine, getConnectionManager, getContentManagerFactory, getContentManagerFactory, getCurrentFlow, getCurrentLanguage, getDebugger, getDocumentEngine, getExpressionParser, getFlowEngine, getFlowScope, getFunctionCallDefinitionManager, getMappingManager, getMaskManager, getMatchEngine, getMetaModel, getPageScope, getProcessScope, getProject, getRequestScope, getResourceManager, getRuleEngine, getServiceManager, getSessionId, getSessionScope, getState, getTraceEngine, getTreeEngine, getUserProfile, getUserScope, getWebServices, pushActiveInstance, restore
-
Constructor Details
-
ContainerContext
protected ContainerContext(ComposerHandler handler, IComposerContext composerContext, ContainerDefinition container, ITypedParameters typedParameters)
-
-
Method Details
-
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
- Overrides:
getProfile
in classPortalContextDelegate
- Returns:
- Profile interface.
-
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
- Overrides:
getActiveInstance
in classPortalContextDelegate
- Parameters:
entityName
- The entity name for which the active instance is requested.- Returns:
- The instance that is active for the specified entity type.
-
getContainerId
Description copied from interface:IContainerContext
This method will return the id of container that can be used to uniquely identify the container. The container id is stable over refreshes and reloads.- Specified by:
getContainerId
in interfaceIContainerContext
- Returns:
- The id of the container.
-
getContainerName
Description copied from interface:IContainerContext
This method will return the name of the container that the dynamic container component was applied to. This name is thus equal to the name of the container as defined in the Everest Studio.- Specified by:
getContainerName
in interfaceIContainerContext
- Returns:
- The name of the container.
-
getParameter
Description copied from interface:IContainerContext
This method will return the value for the parameter with the specified name. When no value was found for the given name, the null value will be returned.- Specified by:
getParameter
in interfaceIContainerContext
- Parameters:
name
- String containing the name of the parameter for which the value is requested.- Returns:
- The value of the parameter for the specified name.
-
getParameters
Description copied from interface:IContainerContext
This method will return all the parameters defined for the container at once in a single object.- Specified by:
getParameters
in interfaceIContainerContext
- Returns:
- Object containing all the parameters for the container.
-
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
- Overrides:
getElementComposer
in classPortalContextDelegate
- 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
- Overrides:
getMappingComposer
in classPortalContextDelegate
- Returns:
- An element factory that can be used to expand elements from the composer.
-
registerCallback
Description copied from interface:IContainerContext
This method may be used to add a callback function to an element of the container. The callback function will be invoked depending on the invocation type.The following invocation types are supported:
- ALWAYS The callback function should always be invoked for both page submits and refreshes, regardless of the element that triggered the event.
- ON_SUBMIT The callback function should always be invoked when the page is submitted, but not invoked upon a page refresh.
- ON_EVENT The callback function should only be invoked when the element, that the callback was registered for, caused the event. This type is usually applicable when registering a callback for a button or (refresh) field. The callback function will be invoked for both refresh and submit events.
The callback registered by a container will be executed in the order they are found on the page. This means that the callback of a container will be invoked before any callback that is registered for it's child elements. The callback functions will be handled just like services, and as such the same rules apply. When a callback function sets an error in the context, the flow will be blocked, the current transaction aborted, and the previous page will be shown.
- Specified by:
registerCallback
in interfaceIContainerContext
- Parameters:
element
- The element for which the callback function is added.function
- The callback function that should be invoked during the page submit/refresh.when
- The invocation type parameter specifies when the callback should be invoked.
-
getErrors
Description copied from interface:IContainerContext
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 interfaceIContainerContext
- 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:IContainerContext
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 interfaceIContainerContext
- 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).
-
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).
-
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.
-