Modifier and Type | Method and Description |
---|---|
static UserContext |
activate(String userName)
Activates context of given user so
current() will return context created
for given user. |
static UserContext |
activate(UserInfo user)
Activates context of given user so
current() will return context created
for given user. |
static void |
activate(UserInfo user,
InContext<UserContext> action)
Activates context of given user and invokes provided action in created context.
|
static UserContext |
current()
Returns current user context.
|
static UserContext |
deactivate()
Deactivates current user context
|
UserInfo |
getUser()
Returns user associated with this context.
|
String |
getUserJson()
Returns serialized user in JSON notation.
|
static boolean |
isActive()
Returns true if this context is active.
|
String |
name()
Returns this context name (for identification purposes)
|
public static final String NAME
public String name()
Context
public UserInfo getUser()
public String getUserJson()
public static boolean isActive()
public static UserContext current() throws ContextNotActiveException
ContextNotActiveException
public static UserContext activate(String userName)
current()
will return context created
for given user.userName
- user namepublic static UserContext activate(UserInfo user)
current()
will return context created
for given user.user
- userpublic static void activate(UserInfo user, InContext<UserContext> action)
user
- useraction
- action executed in user contextpublic static UserContext deactivate()
Copyright © 2019 Suncode. All rights reserved.