Interface ISession
-
public interface ISession
Provides the Session interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated 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()
Deprecated.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
setTimeZone(java.lang.String timezoneId)
Overrides the timezone by a simple timezone based on a timezone IANA id.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
-
keepAlive
void keepAlive() throws CoreException
Refreshes the last active time.- Throws:
CoreException
- if refreshing failed
-
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
-
setTimeZone
void setTimeZone(java.lang.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
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
@Deprecated void destroy()
Deprecated.Destroys this session, so that the garbage collector can reclaim memory held by this session. This will delete all auto-committed objects for this session (if any).This method has been deprecated and should not be called. Instead,
Core.logout(ISession)
should be called.
-
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
-
-