@Service(value="cuba_UserSessionService") public class UserSessionServiceBean extends java.lang.Object implements UserSessionService
UserSession
s management.UserSessionService.Filter
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MESSAGE_ATTR_PREFIX |
NAME
Constructor and Description |
---|
UserSessionServiceBean() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkSession(UserSession userSession) |
java.lang.String |
getMessages()
Poll for messages left for the current user session.
|
java.lang.Integer |
getPermissionValue(User user,
PermissionType permissionType,
java.lang.String target)
Get effective user permission.
|
UserSession |
getUserSession(java.util.UUID sessionId)
Get a UserSession by its identifier.
|
java.util.Collection<UserSessionEntity> |
getUserSessionInfo() |
void |
killSession(java.util.UUID id)
Disconnect a session.
|
java.util.Collection<UserSessionEntity> |
loadUserSessionEntities(UserSessionService.Filter filter)
Load list of non-persistent entities representing active user sessions.
|
void |
postMessage(java.util.List<java.util.UUID> sessionIds,
java.lang.String message)
Post a message to the list of active user sessions.
|
void |
removeSessionAttribute(java.util.UUID sessionId,
java.lang.String name)
Remove a session attribute, propagating changes to the cluster.
|
void |
setSessionAddress(java.util.UUID sessionId,
java.lang.String address)
Set client's address into the session, propagating changes to the cluster.
|
void |
setSessionAttribute(java.util.UUID sessionId,
java.lang.String name,
java.io.Serializable value)
Set a session attribute value, propagating changes to the cluster.
|
void |
setSessionClientInfo(java.util.UUID sessionId,
java.lang.String clientInfo)
Set client's information into the session, propagating changes to the cluster.
|
void |
setSessionLocale(java.util.UUID sessionId,
java.util.Locale locale)
Set user locale into the session, propagating changes to the cluster.
|
void |
setSessionTimeZone(java.util.UUID sessionId,
java.util.TimeZone timeZone)
Set user time zone into the session, propagating changes to the cluster.
|
protected boolean |
testString(java.lang.String value,
java.lang.String test,
boolean strict) |
public static final java.lang.String MESSAGE_ATTR_PREFIX
protected void checkSession(UserSession userSession)
public UserSession getUserSession(java.util.UUID sessionId)
UserSessionService
When called from the client tier, returns a copy of the session object, so any modifications of its state affect nothing.
getUserSession
in interface UserSessionService
sessionId
- a session identifierpublic void setSessionAttribute(java.util.UUID sessionId, java.lang.String name, java.io.Serializable value)
UserSessionService
setSessionAttribute
in interface UserSessionService
sessionId
- an active session identifiername
- attribute namevalue
- attribute valuepublic void removeSessionAttribute(java.util.UUID sessionId, java.lang.String name)
UserSessionService
removeSessionAttribute
in interface UserSessionService
sessionId
- an active session identifiername
- attribute namepublic void setSessionLocale(java.util.UUID sessionId, java.util.Locale locale)
UserSessionService
setSessionLocale
in interface UserSessionService
sessionId
- an active session identifierlocale
- user localepublic void setSessionTimeZone(java.util.UUID sessionId, java.util.TimeZone timeZone)
UserSessionService
setSessionTimeZone
in interface UserSessionService
sessionId
- an active session identifiertimeZone
- user time zonepublic void setSessionAddress(java.util.UUID sessionId, java.lang.String address)
UserSessionService
setSessionAddress
in interface UserSessionService
sessionId
- an active session identifieraddress
- client's addresspublic void setSessionClientInfo(java.util.UUID sessionId, java.lang.String clientInfo)
UserSessionService
setSessionClientInfo
in interface UserSessionService
sessionId
- an active session identifierclientInfo
- client's infopublic java.util.Collection<UserSessionEntity> getUserSessionInfo()
getUserSessionInfo
in interface UserSessionService
public java.util.Collection<UserSessionEntity> loadUserSessionEntities(UserSessionService.Filter filter)
UserSessionService
loadUserSessionEntities
in interface UserSessionService
filter
- can be used to limit the loaded list. Pass UserSessionService.Filter.ALL
to load all.protected boolean testString(java.lang.String value, java.lang.String test, boolean strict)
public void killSession(java.util.UUID id)
UserSessionService
killSession
in interface UserSessionService
id
- an active session identifierpublic void postMessage(java.util.List<java.util.UUID> sessionIds, java.lang.String message)
UserSessionService
postMessage
in interface UserSessionService
sessionIds
- list of session identifiersmessage
- the message text@Nullable public java.lang.String getMessages()
UserSessionService
getMessages
in interface UserSessionService
public java.lang.Integer getPermissionValue(User user, PermissionType permissionType, java.lang.String target)
UserSessionService
getPermissionValue
in interface UserSessionService
user
- userpermissionType
- type of permissiontarget
- permission target