Interface IAquimaSession

All Superinterfaces:
IAquimaSessionLifecycle, com.aquima.interactions.foundation.concurrent.Interruptible, Serializable

public interface IAquimaSession extends Serializable, IAquimaSessionLifecycle, com.aquima.interactions.foundation.concurrent.Interruptible
Interface for portal sessions used in web based applications.

IAquimaSessions 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:
8.0
Author:
Danny Roest
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Closes this portal session.
    com.aquima.interactions.portal.IActionResult
    executeAction(String handlerName, Map<String,?> parameters)
    This method will invoke an action handler using the current portal session context.
    com.aquima.interactions.portal.IActionResult
    executeInlineAction(com.aquima.interactions.portal.IActionHandler actionHandler, Map<String,?> parameters)
    This method will invoke an action handler using the current portal session context.
    This method returns the date when this session was last accessed.
    Returns the current web render engine.
    This method returns the current CSRF token of this session.
    com.aquima.interactions.metamodel.Channel
    This method returns the current channel.
    com.aquima.interactions.foundation.text.ILanguage
    Returns the current selected language.
    com.aquima.interactions.composer.IPage
    Returns the current page.
    com.aquima.interactions.project.IUserData
    This method will return the current user.
    com.aquima.interactions.portal.ISessionMonitor
    This method will return a session monitor object containing information about this portal session.
    Returns the name of the session.
    com.aquima.interactions.portal.IPortalSession
    This methods returns the portal session of this aquima session.
    This method returns the details about the application started running this session.
    Returns the current request ward for this session.
    This method return the sessionId of this session.
    This method will return the value that has been added to the session scope for the specified attribute key.
    This method returns the time when this session was started/created.
    This method returns the testPath for the current session.
    Returns the current theme.
    com.aquima.interactions.project.IValueFormatDefinition
    getValueFormatDefinition(com.aquima.interactions.foundation.DataType type)
    This method returns the configured ValueFormatDefinition for the specified datatype.
    void
    handleEvent(com.aquima.interactions.portal.PortalEvent portalEvent)
    This method will process the event passed, and continue the flow if needed.
    void
    This method updates the last access date.
    void
    This method recomposes the current page.
    This method generates a new CSRF token for this session and returns the new token.
    Generates and returns a new request ward for this session.
    void
    Sets the current web renderer.
    void
    setLanguage(String languageCode)
    Sets the current language.
    This method will set the value in the session scope under the specified key, and will return the value that might have been replaced by this action.
    void
    Sets the current theme.
    void
    This method will start the exposed flow with the specified name.
    void
    startFlow(String name, boolean allowUnexposedFlows, Map<String,Serializable> parameters)
    This method starts a flow.
    void
    stopFlow(boolean commitPendingChanges)
    This method will stop the current flow and commit or rollback any pending changes.

    Methods inherited from interface com.blueriq.component.api.session.IAquimaSessionLifecycle

    activate, passivate

    Methods inherited from interface com.aquima.interactions.foundation.concurrent.Interruptible

    interrupt, isInterrupted
  • Method Details

    • getName

      String getName()
      Returns the name of the session.
      Returns:
      The name of the session, may be null.
    • handleEvent

      void handleEvent(com.aquima.interactions.portal.PortalEvent portalEvent) throws com.aquima.interactions.foundation.exception.AppException
      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.
      Throws:
      com.aquima.interactions.foundation.exception.AppException - This type of exception is thrown when the event could not be processed.
    • startFlow

      void startFlow(String name) throws com.aquima.interactions.foundation.exception.AppException
      This method will start the exposed flow with the specified name.

      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.

      Parameters:
      name - the name of the flow
      Throws:
      com.aquima.interactions.foundation.exception.AppException - when the flow could not be started.
    • startFlow

      void startFlow(String name, boolean allowUnexposedFlows, Map<String,Serializable> parameters) throws com.aquima.interactions.foundation.exception.AppException
      This method starts a flow. See startFlow(String)
      Parameters:
      name - the name of the flow
      allowUnexposedFlows - indicator to specify if unexposed flows may be started
      parameters - Optional object containing parameters from the 'request' that should be available in the request scope.
      Throws:
      com.aquima.interactions.foundation.exception.AppException - when the flow could not be started.
    • stopFlow

      void stopFlow(boolean commitPendingChanges) throws com.aquima.interactions.foundation.exception.AppException
      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:
      com.aquima.interactions.foundation.exception.AppException - This exception is thrown when there is no active flow.
    • executeInlineAction

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

      void recompose() throws com.aquima.interactions.foundation.exception.AppException
      This method recomposes the current page. This method should be called when another process changed the portal state, i.e. after a non readonly action handler has been executed.
      Throws:
      com.aquima.interactions.foundation.exception.AppException - When the current portal state failed recomposing.
    • executeAction

      com.aquima.interactions.portal.IActionResult executeAction(String handlerName, Map<String,?> parameters) throws com.aquima.interactions.portal.exception.PortalException
      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:
      com.aquima.interactions.portal.exception.PortalException - This exception is thrown if the action handler fails with an exception.
      See Also:
      • IRequestScope
    • setTheme

      void setTheme(String theme)
      Sets the current theme.
      Parameters:
      theme - the name of the theme.
    • getTheme

      String getTheme()
      Returns the current theme.
      Returns:
      the current theme
    • getAquimaUi

      IAquimaUi getAquimaUi()
      Returns the current web render engine.
      Returns:
      the current theme
    • setAquimaUi

      void setAquimaUi(String name)
      Sets the current web renderer.
      Parameters:
      name - the name of the web renderer.
    • setLanguage

      void setLanguage(String languageCode) throws com.aquima.interactions.metamodel.exception.UnknownLanguageException
      Sets the current language.
      Parameters:
      languageCode - the code of the language to set
      Throws:
      com.aquima.interactions.metamodel.exception.UnknownLanguageException - when the language is unkown.
    • close

      boolean close()
      Closes this portal session. The session may also need to be removed from the IAquimaSessionsMap.
      Returns:
      whether the session could be closed.
    • getCurrentPage

      com.aquima.interactions.composer.IPage getCurrentPage()
      Returns the current page.
      Returns:
      the current page.
    • getCurrentLanguage

      com.aquima.interactions.foundation.text.ILanguage getCurrentLanguage()
      Returns the current selected language.
      Returns:
      the current selected language
    • getSessionId

      String getSessionId()
      This method return the sessionId of this session.
      Returns:
      the sessionId of this session, never null or empty.
    • getCsrfToken

      String getCsrfToken()
      This method returns the current CSRF token of this session.
      Returns:
      the CSRF token (never null)
    • renewCsrfToken

      String renewCsrfToken()
      This method generates a new CSRF token for this session and returns the new token.
      Returns:
      the new CSRF token
    • getRequestWard

      String getRequestWard()
      Returns the current request ward for this session. The request ward is a randomly generated token which should change every request. The request ward is used to detect de-synchronization between the frontend and the backend.
      Returns:
      the current request ward
    • renewRequestWard

      String renewRequestWard()
      Generates and returns a new request ward for this session.
      Returns:
      the new request ward
    • getPortalSession

      com.aquima.interactions.portal.IPortalSession getPortalSession()
      This methods returns the portal session of this aquima session.

      It is recommend to only use the other methods in this class. However, for special purposes this method can be used, but using this method has a higher chance of breaking your code in the future.

      Returns:
      the portal session of this aquima session.
    • getValueFormatDefinition

      com.aquima.interactions.project.IValueFormatDefinition getValueFormatDefinition(com.aquima.interactions.foundation.DataType type)
      This method returns the configured ValueFormatDefinition for the specified datatype.
      Parameters:
      type - the datatype
      Returns:
      the valueformatdefinition for the specified datatype
    • getProjectDetails

      IProjectDetails getProjectDetails()
      This method returns the details about the application started running this session. This method should be used instead of using an IApplication (not recommended).
      Returns:
      details about the project running this session.
    • getStartTime

      Date getStartTime()
      This method returns the time when this session was started/created.
      Returns:
      the time this session was started/created.
    • getMonitor

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

      com.aquima.interactions.project.IUserData getCurrentUser()
      This method will return the current user.
      Returns:
      The current user, never null.
    • getCurrentChannel

      com.aquima.interactions.metamodel.Channel getCurrentChannel()
      This method returns the current channel.
      Returns:
      The current channel, or null.
    • getTestPath

      String getTestPath()
      This method returns the testPath for the current session.
      Returns:
      The testPath for the current session, or null.
    • getSessionScopeAttribute

      Serializable getSessionScopeAttribute(String key)
      This method will return the value that has been added to the session scope for the specified attribute key. When there is no value present for the specified key, a null value will be returned.
      Parameters:
      key - Name of the attribute for which the value is requested (mandatory).
      Returns:
      The value for the specified key, or null when there is no value present.
      Since:
      9.0
    • setSessionScopeAttribute

      @CheckReturnValue(when=NEVER) Serializable setSessionScopeAttribute(String key, Serializable attrValue)
      This method will set the value in the session scope under the specified key, and will return the value that might have been replaced by this action. When there was no value present for the specified key, a null value will be returned.
      Parameters:
      key - Name of the attribute for which the value should be set (mandatory).
      attrValue - The value that should be set for the specified key (mandatory).
      Returns:
      The value that was replaced (previously present) by the set action.
      Since:
      9.0
    • getAccessTime

      Date getAccessTime()
      This method returns the date when this session was last accessed.
      Returns:
      The date of the last access, never null.
    • notifyAccess

      void notifyAccess()
      This method updates the last access date.