Interface ISession


public interface ISession
Provides the Session interface.
  • Method Details

    • getId

      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

      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
    • keepAlive

      void keepAlive() throws CoreException
      Refreshes the last active time.
      Throws:
      CoreException - if refreshing failed
    • getUserRolesNames

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

      Set<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

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

      void setTimeZone(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
    • setTimeZone

      void setTimeZone(String timezoneId)
      Overrides the timezone by a simple timezone based on a timezone IANA id. For example "Europe/Amsterdam". Used for setting timezone obtained from browser with Javascript.
      Parameters:
      timezoneId - the timezone IANA id. See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
    • getUserAgent

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

      void setUserAgent(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

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

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