Class SessionServiceImpl
- java.lang.Object
-
- org.bonitasoft.engine.session.impl.SessionServiceImpl
-
- All Implemented Interfaces:
SessionService
public class SessionServiceImpl extends java.lang.Object implements SessionService
- Author:
- Elias Ricken de Medeiros, Matthieu Chaffotte
-
-
Field Summary
-
Fields inherited from interface org.bonitasoft.engine.session.SessionService
SYSTEM, SYSTEM_ID
-
-
Constructor Summary
Constructors Constructor Description SessionServiceImpl(SessionProvider sessionProvider, java.lang.String applicationName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanInvalidSessions()Delete all invalid sessionsSSessioncreateSession(long tenantId, long userId, java.lang.String userName, boolean isTechnicalUser)SSessioncreateSession(long tenantId, long userId, java.lang.String userName, boolean isTechnicalUser, java.util.List<java.lang.String> profiles, java.util.Set<java.lang.String> permissions)SSessioncreateSession(long tenantId, java.lang.String userName)Create a new session for the given user;voiddeleteSession(long sessionId)Delete a session having the given idvoiddeleteSessions()Deletes all the sessions.voiddeleteSessionsOfTenant(long tenantId)Delete all sessions of a tenantvoiddeleteSessionsOfTenantExceptTechnicalUser(long tenantId)Delete all sessions of a tenant except the one of the technical userlonggetDefaultSessionDuration()Retrieve the default sessions's duration, in milliseconds.longgetLoggedUserFromSession(ReadSessionAccessor sessionAccessor)SSessiongetSession(long sessionId)Retrieve a session by its idlonggetSessionDuration()Retrieve the duration, in milliseconds, of new created session.booleanisValid(long sessionId)Verify if a session is validvoidrenewSession(long sessionId)Update the expiration and the last update dates of the session.voidsetSessionDuration(long duration)Define how long, in milliseconds, the created sessions will be valid.
-
-
-
Constructor Detail
-
SessionServiceImpl
public SessionServiceImpl(SessionProvider sessionProvider, java.lang.String applicationName)
-
-
Method Detail
-
createSession
public SSession createSession(long tenantId, java.lang.String userName) throws SSessionException
Description copied from interface:SessionServiceCreate a new session for the given user;- Specified by:
createSessionin interfaceSessionServiceuserName- userName- Returns:
- a new session
- Throws:
SSessionException- if some error arrives while creating the session
-
createSession
public SSession createSession(long tenantId, long userId, java.lang.String userName, boolean isTechnicalUser) throws SSessionException
- Specified by:
createSessionin interfaceSessionService- Throws:
SSessionException
-
createSession
public SSession createSession(long tenantId, long userId, java.lang.String userName, boolean isTechnicalUser, java.util.List<java.lang.String> profiles, java.util.Set<java.lang.String> permissions) throws SSessionException
- Specified by:
createSessionin interfaceSessionService- Throws:
SSessionException
-
deleteSession
public void deleteSession(long sessionId) throws SSessionNotFoundExceptionDescription copied from interface:SessionServiceDelete a session having the given id- Specified by:
deleteSessionin interfaceSessionService- Parameters:
sessionId- the session's id- Throws:
SSessionNotFoundException- if no session exists for the given id
-
isValid
public boolean isValid(long sessionId) throws SSessionNotFoundExceptionDescription copied from interface:SessionServiceVerify if a session is valid- Specified by:
isValidin interfaceSessionService- Parameters:
sessionId- the session's id- Returns:
- true if the session is valid, false otherwise
- Throws:
SSessionNotFoundException- if no session exists for the given id
-
getSession
public SSession getSession(long sessionId) throws SSessionNotFoundException
Description copied from interface:SessionServiceRetrieve a session by its id- Specified by:
getSessionin interfaceSessionService- Parameters:
sessionId- the session's id- Returns:
- the session associated to the given id
- Throws:
SSessionNotFoundException- if no session exists for the given id
-
getLoggedUserFromSession
public long getLoggedUserFromSession(ReadSessionAccessor sessionAccessor)
- Specified by:
getLoggedUserFromSessionin interfaceSessionService- Parameters:
sessionAccessor- the sessionAccessor that contains the current session- Returns:
- the logged user or -1 if there is no session
-
setSessionDuration
public void setSessionDuration(long duration)
Description copied from interface:SessionServiceDefine how long, in milliseconds, the created sessions will be valid. This does not affect already created session- Specified by:
setSessionDurationin interfaceSessionService
-
getDefaultSessionDuration
public long getDefaultSessionDuration()
Description copied from interface:SessionServiceRetrieve the default sessions's duration, in milliseconds.- Specified by:
getDefaultSessionDurationin interfaceSessionService- Returns:
- the default sessions's duration
-
getSessionDuration
public long getSessionDuration()
Description copied from interface:SessionServiceRetrieve the duration, in milliseconds, of new created session. If no duration was specified, the default duration will be used- Specified by:
getSessionDurationin interfaceSessionService- Returns:
- the duration of new created session.
-
renewSession
public void renewSession(long sessionId) throws SSessionExceptionDescription copied from interface:SessionServiceUpdate the expiration and the last update dates of the session.- Specified by:
renewSessionin interfaceSessionService- Parameters:
sessionId- the session id- Throws:
SSessionException- if some error arrives while creating the session
-
cleanInvalidSessions
public void cleanInvalidSessions()
Description copied from interface:SessionServiceDelete all invalid sessions- Specified by:
cleanInvalidSessionsin interfaceSessionService
-
deleteSessionsOfTenant
public void deleteSessionsOfTenant(long tenantId)
Description copied from interface:SessionServiceDelete all sessions of a tenant- Specified by:
deleteSessionsOfTenantin interfaceSessionService
-
deleteSessionsOfTenantExceptTechnicalUser
public void deleteSessionsOfTenantExceptTechnicalUser(long tenantId)
Description copied from interface:SessionServiceDelete all sessions of a tenant except the one of the technical user- Specified by:
deleteSessionsOfTenantExceptTechnicalUserin interfaceSessionService
-
deleteSessions
public void deleteSessions()
Description copied from interface:SessionServiceDeletes all the sessions.- Specified by:
deleteSessionsin interfaceSessionService
-
-