Interface IPortalSession

All Superinterfaces:
Interruptible, ISessionLifecycle
All Known Implementing Classes:
Dcm1ProcessEnabledSession, Dcm2ProcessEnabledSession, NonInteractiveProcessEnabledSession, PortalMessageSession, PortalSession, ProcessEnabledSession

public interface IPortalSession extends ISessionLifecycle, Interruptible
The portal session object holds the information about a single session, and provides a few methods to interact with that session.

IPortalSessions are interruptible. Interrupting a session has the following effects:

  • if a flow is currently executing in this session, it will be interrupted as soon as it exits from the currently executing service call or function call
  • if a flow has not yet started in this session, attempting to start a session will result in an InterruptedException
Since:
5.0
Author:
O. Kerpershoek
  • Method Details

    • getSessionId

      String getSessionId()
      Returns the optional ID of this session.
      Returns:
      the id if available, otherwise null.
    • setSessionId

      void setSessionId(String id)
      Sets the optional ID of this session.
      Parameters:
      id - the id of the session, may be null.
    • getApplicationId

      ApplicationID getApplicationId()
      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.
      Returns:
      The ID of the application/project for which the session was created.
    • getMonitor

      ISessionMonitor getMonitor()
      This method will return a session monitor object containing information about this portal session.
      Returns:
      The session monitor of this session.
    • getModule

      IModule getModule()
      This method returns an object containing the static definitions of the various components as defined by the current module.
      Returns:
      Object containing the static definitions of the various components as defined by the current module.
    • getConfiguration

      IProject getConfiguration()
      This method returns an object containing the project wide configuration and definitions.
      Returns:
      an object containing the project wide configuration and definitions.
    • startFlow

      PortalResponse startFlow(String flowName, Map<String,Serializable> parameters, boolean allowUnExposedFlows)
      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.
      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.
      Throws:
      AppException - This type of exception is thrown when the flow could not be started.
    • stopFlow

      void stopFlow(boolean commitPendingChanges)
      This method will stop the current flow and commit or rollback any pending changes.
      Parameters:
      commitPendingChanges - Boolean indicating if pending changes should be committed.
      Throws:
      AppException - This exception is thrown when there is no active flow.
    • handleEvent

      PortalResponse handleEvent(PortalEvent portalEvent)
      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.
      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.
      Throws:
      AppException - This type of exception is thrown when the event could not be processed.
    • executeAction

      IActionResult executeAction(String handlerName, Map<String,?> parameters)
      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.
      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.
      Throws:
      PortalException - This exception is thrown if the action handler fails with an exception.
      See Also:
    • executeInlineAction

      IActionResult executeInlineAction(IActionHandler handler, Map<String,?> parameters)
      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.
      Parameters:
      handler - The action handler which should be executed.
      parameters - The parameters for the action handler.
      Returns:
      The result object from the action handler.
      Throws:
      PortalException - This exception is thrown if the action handler fails with an exception.
      See Also:
    • executeCallback

      void executeCallback(IPortalSessionCallback callback)
      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.
      Parameters:
      callback - the callback which should be executed (may not be null)
      Throws:
      PortalException - Thrown if the callback fails with an exception.
    • getCurrentPage

      IPage getCurrentPage()
      Returns the last generated page for rendering to the client. If there is no page generated yet this function returns null
      Returns:
      IPage the current page model.
    • close

      boolean close()
      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.
      Returns:
      Boolean indicating if the session was successfully closed.
    • getCurrentFlowState

      IFlowState getCurrentFlowState()
      Returns the current flowState.
      Returns:
      Object containing information about the current flow path.
    • getCurrentChannel

      Channel getCurrentChannel()
      Returns the current channel.
      Returns:
      The channel.
    • getCurrentLanguage

      ILanguage getCurrentLanguage()
      Returns the current language active within the portal-engine.
      Returns:
      The current language object.
    • setCurrentLanguage

      void setCurrentLanguage(String languageCode)
      Changes the current language for this portal session.
      Parameters:
      languageCode - The code of the language
      Throws:
      UnknownLanguageException - If an invalid code is provided.
    • getState

      Returns the state of the session (for serialization)
      Returns:
      returns the current state of the session.
    • restore

      void restore(IPortalSessionState state)
      Clears the current state and overrides it with the provided state.
      Parameters:
      state - The new state for this session.
    • getMessageBus

      IPortalMessageBus getMessageBus()
      Returns the messagebus.
      Returns:
      The messagebus, not null.
    • getEventBus

      IPortalEventBus getEventBus()
      Returns the event bus used by this session.
      Returns:
      the event bus, not null.
    • reset

      void reset()
      Resets the portal session. Current page, profile and scopes will all be cleared. The message bus will not be cleared explicitly.
    • getCurrentFlow

      String getCurrentFlow()
      Returns the current flow
      Returns:
      The current flow
      Since:
      9.2
    • getCaseEngineClient

      CaseEngineClient getCaseEngineClient()
      Returns the optional CaseEngineClient
      Returns:
      The CaseEngineClient
      Since:
      12.11
    • getAuditEngine

      IAuditEngine getAuditEngine()
      Returns the AuditEngine
      Returns:
      The AuditEngine
      Since:
      15.2