Package com.aquima.interactions.portal
Interface IEventContext
- All Superinterfaces:
IPortalContext
,Serializable
- All Known Subinterfaces:
IContainerContext
,IContainerEventContext
,IServiceContext
- All Known Implementing Classes:
CallbackContext
,ContainerContext
,ServiceContext
,ServiceContextDelegate
Base interface for contexts that are passed to methods of services or containers during the processing of an event.
- Since:
- 5.0
- Author:
- o.kerpershoek
-
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.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.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
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 interface com.aquima.interactions.portal.IPortalContext
forModule, forModule, getActiveInstance, getApplicationMode, getAuditEngine, getCaseEngineClient, getCommentsManager, getCommunicationEngine, getConnectionManager, getContentManagerFactory, getContentManagerFactory, getCurrentFlow, getCurrentLanguage, getDebugger, getDocumentEngine, getElementComposer, getExpressionParser, getFlowEngine, getFlowScope, getFunctionCallDefinitionManager, getMappingComposer, getMappingManager, getMaskManager, getMatchEngine, getMetaModel, getPageScope, getProcessScope, getProfile, getProject, getRequestScope, getResourceManager, getRuleEngine, getServiceManager, getSessionId, getSessionScope, getState, getTraceEngine, getTreeEngine, getUserProfile, getUserScope, getWebServices, pushActiveInstance, restore
-
Method Details
-
getEvent
IFiredEvent getEvent()Returns the event for which this context is working.- Returns:
- The fired even object which is never null.
-
hasErrors
boolean hasErrors()Indicator if the request scope contains generic errors or errors on attribute values.- Returns:
- boolean indicating if errors are present in the request scope.
-
clearErrors
boolean clearErrors()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.- Returns:
- a boolean indicating if any errors were actually discarded.
-
getStopOnErrors
boolean getStopOnErrors()This method returns the boolean indicating if errors should abort the current flow.- Returns:
- boolean indicating if errors should abort the current flow.
-
setStopOnErrors
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. 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.- Parameters:
stopOnErrors
- Boolean indicating if the flow should be aborted when an error is encountered.
-
isFlowBlocked
boolean isFlowBlocked()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.
- Returns:
- boolean indicating if the flow should be aborted.
-
setFlowBlocked
void setFlowBlocked(boolean rollback) 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.- Parameters:
rollback
- boolean to indicate if changes so far should be discarded.
-
addErrorText
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.- 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
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.- 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
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.- 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
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.- 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
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.- 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
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.- 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
This method sets the focus for a specific ValueReference (never null).- Parameters:
reference
- Reference to the attribute for which the focus has to be set.
-