Interface ISession


  • public interface ISession
    Provides the Session interface.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      IContext createContext()
      Create a new context.
      IContext createContext​(IContext.ExecutionType executionType)
      Create a new context for executionType.
      void destroy()
      Destroys this session, so that the garbage collector can reclaim memory held by this session.
      java.lang.String getCsrfToken()
      Returns the CSRF token for this session.
      java.util.Set<java.lang.String> getGrantableRoleNames()
      Returns the role names the user for this session can be granted.
      java.util.UUID getId()
      Returns session id.
      java.util.Date getLastActive()
      Returns the last active date and time for this session.
      IMendixObject getMendixObject()
      Returns the IMendixObject for this session.
      java.util.TimeZone getTimeZone()
      Returns the time zone of this session's user.
      IUser getUser​(IContext context)
      Returns the user for this session (if any).
      java.lang.String getUserAgent()
      Returns the user agent for this session.
      IMendixIdentifier getUserId()
      Returns the used identifier for this session.
      java.lang.String getUserName()
      Returns the user name for this session.
      java.util.Set<java.lang.String> getUserRolesNames()
      Returns the user's role names for this session.
      boolean isInteractive()
      Returns whether this session can be used interactively ('real' user), defaults to true.
      boolean isSystemSession()
      Returns whether this session is a system session.
      void keepAlive()
      Refreshes the last active time.
      void setTimeZone​(java.lang.Integer timezoneOffset)
      Overrides the timezone by a simple timezone based on an offset.
      void setUserAgent​(java.lang.String userAgent)
      Sets the user agent for this session to userAgent.
    • Method Detail

      • getId

        java.util.UUID getId()
        Returns session id.
        Returns:
        the session id
      • createContext

        IContext createContext()
        Create a new context.
        Returns:
        the created context
      • createContext

        IContext createContext​(IContext.ExecutionType executionType)
        Create a new context for executionType.
        Parameters:
        executionType - the execution type for the context
        Returns:
        the created context
      • getUser

        IUser getUser​(IContext context)
        Returns the user for this session (if any).
        Parameters:
        context - the current context
        Returns:
        the user of this session if it exists, or null otherwise
      • getUserName

        java.lang.String getUserName()
        Returns the user name for this session.
        Returns:
        the user's name
      • getUserId

        IMendixIdentifier getUserId()
        Returns the used identifier for this session.
        Returns:
        the user's identifier
      • getUserRolesNames

        java.util.Set<java.lang.String> getUserRolesNames()
        Returns the user's role names for this session.
        Returns:
        the role names
      • getGrantableRoleNames

        java.util.Set<java.lang.String> getGrantableRoleNames()
        Returns the role names the user for this session can be granted.
        Returns:
        the role names
      • isSystemSession

        boolean isSystemSession()
        Returns whether this session is a system session.
        Returns:
        true if this session is a system session, false otherwise
      • getTimeZone

        java.util.TimeZone getTimeZone()
        Returns the time zone of this session's user.
        Returns:
        the time zone
      • setTimeZone

        void setTimeZone​(java.lang.Integer timezoneOffset)
        Overrides the timezone by a simple timezone based on an offset. Does not take into account daylight savings time. Used for setting timezone obtained from browser with Javascript.
        Parameters:
        timezoneOffset - the timezone offset in negative amount of minutes from UTC, like how Javascript supplies it. See http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp
      • getUserAgent

        java.lang.String getUserAgent()
        Returns the user agent for this session.
        Returns:
        the user agent
      • setUserAgent

        void setUserAgent​(java.lang.String userAgent)
        Sets the user agent for this session to userAgent.
        Parameters:
        userAgent - the user agent to set
      • isInteractive

        boolean isInteractive()
        Returns whether this session can be used interactively ('real' user), defaults to true.
        Returns:
        true if this session is interactive, false otherwise
      • destroy

        void destroy()
        Destroys this session, so that the garbage collector can reclaim memory held by this session.

        This will:

        1. Delete auto-committed objects
        2. Delete the state store for this session
        3. Delete the action dispatcher for this session.
      • getMendixObject

        IMendixObject getMendixObject()
        Returns the IMendixObject for this session.
        Returns:
        the Mendix object
      • getLastActive

        java.util.Date getLastActive()
        Returns the last active date and time for this session.
        Returns:
        the last active date and time
      • getCsrfToken

        java.lang.String getCsrfToken()
        Returns the CSRF token for this session.
        Returns:
        the CSRF token