Class PortalMessageSession

java.lang.Object
com.aquima.interactions.portal.portalmessage.PortalMessageSession
All Implemented Interfaces:
Interruptible, IPortalMessageHandler, IPortalSession, ISessionLifecycle, Serializable

public class PortalMessageSession extends Object implements IPortalSession, IPortalMessageHandler
Wraps the portalsession as fix for AQ-1137
Since:
9.2
Author:
a.pragt
See Also:
  • Constructor Details

    • PortalMessageSession

      public PortalMessageSession(IPortalSession session)
      Parameters:
      session - session to wrap, not null.
  • Method Details

    • getSessionId

      public String getSessionId()
      Description copied from interface: IPortalSession
      Returns the optional ID of this session.
      Specified by:
      getSessionId in interface IPortalSession
      Returns:
      the id if available, otherwise null.
    • setSessionId

      public void setSessionId(String id)
      Description copied from interface: IPortalSession
      Sets the optional ID of this session.
      Specified by:
      setSessionId in interface IPortalSession
      Parameters:
      id - the id of the session, may be null.
    • handle

      public void handle(IPortalMessage message)
      Description copied from interface: IPortalMessageHandler
      Reacts to a message posted to the message bus
      Specified by:
      handle in interface IPortalMessageHandler
      Parameters:
      message - The massage to handle
    • getApplicationId

      public ApplicationID getApplicationId()
      Description copied from interface: IPortalSession
      This method returns the ID of the application/project for which the session was created. NOTE: The ID of the application may differ from the ID returned by the getModule().getId() method.
      Specified by:
      getApplicationId in interface IPortalSession
      Returns:
      The ID of the application/project for which the session was created.
    • getMonitor

      public ISessionMonitor getMonitor()
      Description copied from interface: IPortalSession
      This method will return a session monitor object containing information about this portal session.
      Specified by:
      getMonitor in interface IPortalSession
      Returns:
      The session monitor of this session.
    • getModule

      public IModule getModule()
      Description copied from interface: IPortalSession
      This method returns an object containing the static definitions of the various components as defined by the current module.
      Specified by:
      getModule in interface IPortalSession
      Returns:
      Object containing the static definitions of the various components as defined by the current module.
    • getConfiguration

      public IProject getConfiguration()
      Description copied from interface: IPortalSession
      This method returns an object containing the project wide configuration and definitions.
      Specified by:
      getConfiguration in interface IPortalSession
      Returns:
      an object containing the project wide configuration and definitions.
    • startFlow

      public PortalResponse startFlow(String flowName, Map<String,Serializable> parameters, boolean allowUnExposedFlows)
      Description copied from interface: IPortalSession
      This method will start the flow with the specified name. If another flow was active when this method is invoked, that flow will be aborted, and it's transaction will be rolled back.

      NOTE: As of version 7.0 an active flow must be stopped by using the stopFlow method before a new flow may be started.

      When the flow has been successfully started, the method will return a response containing the page definition of the first page encountered during the flow. The handleEvent method may be used to continue the flow. This method may fail for various reasons, for example when the flow name specified is unknown or not accessible. An object containing request parameters may be passed to this method. The parameters from this object will be available in the request scope, and allows services for instance to act on information passed through the URL starting the flow. The parameters object is optional, and if no additional parameters need to be passed to the flow, a null value may be supplied.
      Specified by:
      startFlow in interface IPortalSession
      Parameters:
      flowName - The name of the flow that should be started.
      parameters - Optional object containing parameters from the 'request' that should be available in the request scope.
      allowUnExposedFlows - indicator to specify if unexposed flows may be started
      Returns:
      The response of the flow action containing the page definition of the page where the flow stopped.
    • stopFlow

      public void stopFlow(boolean commitPendingChanges)
      Description copied from interface: IPortalSession
      This method will stop the current flow and commit or rollback any pending changes.
      Specified by:
      stopFlow in interface IPortalSession
      Parameters:
      commitPendingChanges - Boolean indicating if pending changes should be committed.
    • handleEvent

      public PortalResponse handleEvent(PortalEvent portalEvent)
      Description copied from interface: IPortalSession
      This method will process the event passed, and continue the flow if needed. Depending on the type of event this method will either stay on the same page (refresh) or try to continue the flow to the next page (submit). The response that is returned by this method contains the page definition of the next page that should be displayed.
      Note: The next page to display may be the same as the page that was already shown.
      Specified by:
      handleEvent in interface IPortalSession
      Parameters:
      portalEvent - Event object containing input values from the client and the requested action.
      Returns:
      The response of the flow action containing the page definition of the page where the flow stopped.
    • executeAction

      public IActionResult executeAction(String handlerName, Map<String,? extends Object> parameters)
      Description copied from interface: IPortalSession
      This method will invoke an action handler using the current portal session context. The action handler will be executed in the same transaction context of the current page. The parameters passed to this method will be exposed via the IRequestScope in the action handler.
      Specified by:
      executeAction in interface IPortalSession
      Parameters:
      handlerName - The name of the action handler that should be invoked.
      parameters - The parameters for the action handler.
      Returns:
      The result object from the action handler.
      See Also:
    • executeInlineAction

      public IActionResult executeInlineAction(IActionHandler handler, Map<String,? extends Object> parameters)
      Description copied from interface: IPortalSession
      This method will invoke an action handler using the current portal session context. The action handler will be executed in the same transaction context of the current page. The parameters passed to this method will be exposed via the IRequestScope in the action handler.
      Specified by:
      executeInlineAction in interface IPortalSession
      Parameters:
      handler - The action handler which should be executed.
      parameters - The parameters for the action handler.
      Returns:
      The result object from the action handler.
      See Also:
    • executeCallback

      public void executeCallback(IPortalSessionCallback callback)
      Description copied from interface: IPortalSession
      Executes a callback. It is up to the IPortalSession implementation to decide which IPortalSession is passed as parameter to the callback. In the general case, the IPortalSession parameter is the same instance as the IPortalSession which is executing the callback, but this is not a requirement and some IPortalSession implementations may deviate from the general case.
      Specified by:
      executeCallback in interface IPortalSession
      Parameters:
      callback - the callback which should be executed (may not be null)
    • getCurrentPage

      public IPage getCurrentPage()
      Description copied from interface: IPortalSession
      Returns the last generated page for rendering to the client. If there is no page generated yet this function returns null
      Specified by:
      getCurrentPage in interface IPortalSession
      Returns:
      IPage the current page model.
    • getCurrentFlowState

      public IFlowState getCurrentFlowState()
      Description copied from interface: IPortalSession
      Returns the current flowState.
      Specified by:
      getCurrentFlowState in interface IPortalSession
      Returns:
      Object containing information about the current flow path.
    • getCurrentChannel

      public Channel getCurrentChannel()
      Description copied from interface: IPortalSession
      Returns the current channel.
      Specified by:
      getCurrentChannel in interface IPortalSession
      Returns:
      The channel.
    • getCurrentLanguage

      public ILanguage getCurrentLanguage()
      Description copied from interface: IPortalSession
      Returns the current language active within the portal-engine.
      Specified by:
      getCurrentLanguage in interface IPortalSession
      Returns:
      The current language object.
    • setCurrentLanguage

      public void setCurrentLanguage(String languageCode)
      Description copied from interface: IPortalSession
      Changes the current language for this portal session.
      Specified by:
      setCurrentLanguage in interface IPortalSession
      Parameters:
      languageCode - The code of the language
    • getState

      public IPortalSessionState getState()
      Description copied from interface: IPortalSession
      Returns the state of the session (for serialization)
      Specified by:
      getState in interface IPortalSession
      Returns:
      returns the current state of the session.
    • restore

      public void restore(IPortalSessionState state)
      Description copied from interface: IPortalSession
      Clears the current state and overrides it with the provided state.
      Specified by:
      restore in interface IPortalSession
      Parameters:
      state - The new state for this session.
    • reset

      public void reset()
      Description copied from interface: IPortalSession
      Resets the portal session. Current page, profile and scopes will all be cleared. The message bus will not be cleared explicitly.
      Specified by:
      reset in interface IPortalSession
    • getMessageBus

      public IPortalMessageBus getMessageBus()
      Description copied from interface: IPortalSession
      Returns the messagebus.
      Specified by:
      getMessageBus in interface IPortalSession
      Returns:
      The messagebus, not null.
    • getEventBus

      public IPortalEventBus getEventBus()
      Description copied from interface: IPortalSession
      Returns the event bus used by this session.
      Specified by:
      getEventBus in interface IPortalSession
      Returns:
      the event bus, not null.
    • getCurrentFlow

      public String getCurrentFlow()
      Description copied from interface: IPortalSession
      Returns the current flow
      Specified by:
      getCurrentFlow in interface IPortalSession
      Returns:
      The current flow
    • getCaseEngineClient

      public CaseEngineClient getCaseEngineClient()
      Description copied from interface: IPortalSession
      Returns the optional CaseEngineClient
      Specified by:
      getCaseEngineClient in interface IPortalSession
      Returns:
      The CaseEngineClient
    • getAuditEngine

      public IAuditEngine getAuditEngine()
      Description copied from interface: IPortalSession
      Returns the AuditEngine
      Specified by:
      getAuditEngine in interface IPortalSession
      Returns:
      The AuditEngine
    • activate

      public void activate(ISessionActivationContext sessionActivationContext)
      Description copied from interface: ISessionLifecycle
      This method may be used for activating the objects after deserialization.
      Specified by:
      activate in interface ISessionLifecycle
      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 interface ISessionLifecycle
    • interrupt

      public void interrupt()
      Description copied from interface: Interruptible
      Sets the interrupted flag, indicating that this object should interrupt the computation it is currently performing (typically on another thread) as soon as possible, and exit by throwing an InterruptedException.
      Specified by:
      interrupt in interface Interruptible
    • isInterrupted

      public boolean isInterrupted()
      Description copied from interface: Interruptible
      Indicates whether the interrupted flag has been set.
      Specified by:
      isInterrupted in interface Interruptible
      Returns:
      true if the interrupted flag is set, false otherwise.
    • close

      public boolean close()
      Description copied from interface: IPortalSession
      This method will close the session, releasing resources if needed. Once the close method has been invoked, the session has become invalid and cannot be used anymore to handle requests.
      Specified by:
      close in interface IPortalSession
      Returns:
      Boolean indicating if the session was successfully closed.
    • getSession

      protected IPortalSession getSession()