Interface ISession
public interface ISession
Provides the Session interface.
-
Method Summary
Modifier and TypeMethodDescriptionCreate a new context.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.Returns the CSRF token for this session.Returns the role names the user for this session can be granted.getId()
Returns session id.Returns the last active date and time for this session.Returns the IMendixObject for this session.Returns the time zone of this session's user.Returns the user for this session (if any).Returns the user agent for this session.Returns the used identifier for this session.Returns the user name for this session.Returns the user's role names for this session.boolean
Returns whether this session can be used interactively ('real' user), defaults to true.boolean
Returns whether this session is a system session.void
Refreshes the last active time.void
setTimeZone
(Integer timezoneOffset) Overrides the timezone by a simple timezone based on an offset.void
setTimeZone
(String timezoneId) Overrides the timezone by a simple timezone based on a timezone IANA id.void
setUserAgent
(String userAgent) Sets the user agent for this session to userAgent.
-
Method Details
-
getId
UUID getId()Returns session id.- Returns:
- the session id
-
createContext
IContext createContext()Create a new context.- Returns:
- the created context
-
createContext
Create a new context for executionType.- Parameters:
executionType
- the execution type for the context- Returns:
- the created context
-
getUser
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
Refreshes the last active time.- Throws:
CoreException
- if refreshing failed
-
getUserRolesNames
Returns the user's role names for this session.- Returns:
- the role names
-
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
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
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
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:
- Delete auto-committed objects
- Delete the state store for this session
- 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
-