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

public class ContainerContext extends PortalContextDelegate implements IContainerContext
IContainerContext implementation using the current page context.
Since:
5.0
Author:
O. Kerpershoek
See Also:
  • Constructor Details

  • Method Details

    • getProfile

      public InferenceContext 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 interface IPortalContext
      Overrides:
      getProfile in class PortalContextDelegate
      Returns:
      Profile interface.
    • getActiveInstance

      public IEntityInstance getActiveInstance(String entityName)
      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 interface IPortalContext
      Overrides:
      getActiveInstance in class PortalContextDelegate
      Parameters:
      entityName - The entity name for which the active instance is requested.
      Returns:
      The instance that is active for the specified entity type.
    • getContainerId

      public String 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 interface IContainerContext
      Returns:
      The id of the container.
    • getContainerName

      public String 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 interface IContainerContext
      Returns:
      The name of the container.
    • getParameter

      public String getParameter(String name)
      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 interface IContainerContext
      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

      public ITypedParameters 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 interface IContainerContext
      Returns:
      Object containing all the parameters for the container.
    • getElementComposer

      public IElementComposer 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 interface IPortalContext
      Overrides:
      getElementComposer in class PortalContextDelegate
      Returns:
      An element factory that can be used to expand elements from the composer.
    • getMappingComposer

      public IMappingComposer 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 interface IPortalContext
      Overrides:
      getMappingComposer in class PortalContextDelegate
      Returns:
      An element factory that can be used to expand elements from the composer.
    • registerCallback

      public void registerCallback(IElement element, ICallbackFunction function, InvocationType when)
      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 interface IContainerContext
      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

      public IErrorMessage[] getErrors(boolean onlyGenericErrors)
      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 interface IContainerContext
      Specified by:
      getErrors in interface IEventContext
      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

      public IErrorMessage[] getErrors(ValueReference attributeReference)
      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 interface IContainerContext
      Specified by:
      getErrors in interface IEventContext
      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

      public IFiredEvent getEvent()
      Description copied from interface: IEventContext
      Returns the event for which this context is working.
      Specified by:
      getEvent in interface IEventContext
      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 interface IEventContext
      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 interface IEventContext
      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 interface IEventContext
      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 interface IEventContext
      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 interface IEventContext
      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 interface IEventContext
      Parameters:
      rollback - boolean to indicate if changes so far should be discarded.
    • addErrorText

      public boolean addErrorText(ValueReference attributeReference, IMultilingualText text)
      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 interface IEventContext
      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

      public boolean addErrorMessage(ValueReference attributeReference, String key, String[] parameters)
      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 interface IEventContext
      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

      public boolean addWarningText(ValueReference attributeReference, IMultilingualText text)
      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 interface IEventContext
      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 interface IEventContext
      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

      public void setFocus(ValueReference reference)
      Description copied from interface: IEventContext
      This method sets the focus for a specific ValueReference (never null).
      Specified by:
      setFocus in interface IEventContext
      Parameters:
      reference - Reference to the attribute for which the focus has to be set.