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, TechnicalLoggerService logger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanInvalidSessions()
Delete all invalid sessionsSSession
createSession(long tenantId, long userId, java.lang.String userName, boolean isTechnicalUser)
SSession
createSession(long tenantId, long userId, java.lang.String userName, boolean isTechnicalUser, java.util.List<java.lang.String> profiles)
SSession
createSession(long tenantId, java.lang.String userName)
Create a new session for the given user;void
deleteSession(long sessionId)
Delete a session having the given idvoid
deleteSessions()
Deletes all the sessions.void
deleteSessionsOfTenant(long tenantId)
Delete all sessions of a tenantvoid
deleteSessionsOfTenantExceptTechnicalUser(long tenantId)
Delete all sessions of a tenant except the one of the technical userlong
getDefaultSessionDuration()
Retrieve the default sessions's duration, in milliseconds.long
getLoggedUserFromSession(ReadSessionAccessor sessionAccessor)
SSession
getSession(long sessionId)
Retrieve a session by its idlong
getSessionDuration()
Retrieve the duration, in milliseconds, of new created session.boolean
isValid(long sessionId)
Verify if a session is validvoid
renewSession(long sessionId)
Update the expiration and the last update dates of the session.void
setSessionDuration(long duration)
Define how long, in milliseconds, the created sessions will be valid.
-
-
-
Constructor Detail
-
SessionServiceImpl
public SessionServiceImpl(SessionProvider sessionProvider, java.lang.String applicationName, TechnicalLoggerService logger)
-
-
Method Detail
-
createSession
public SSession createSession(long tenantId, java.lang.String userName) throws SSessionException
Description copied from interface:SessionService
Create a new session for the given user;- Specified by:
createSession
in interfaceSessionService
userName
- 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:
createSession
in interfaceSessionService
- Throws:
SSessionException
-
createSession
public SSession createSession(long tenantId, long userId, java.lang.String userName, boolean isTechnicalUser, java.util.List<java.lang.String> profiles) throws SSessionException
- Specified by:
createSession
in interfaceSessionService
- Throws:
SSessionException
-
deleteSession
public void deleteSession(long sessionId) throws SSessionNotFoundException
Description copied from interface:SessionService
Delete a session having the given id- Specified by:
deleteSession
in interfaceSessionService
- Parameters:
sessionId
- the session's id- Throws:
SSessionNotFoundException
- if no session exists for the given id
-
isValid
public boolean isValid(long sessionId) throws SSessionNotFoundException
Description copied from interface:SessionService
Verify if a session is valid- Specified by:
isValid
in 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:SessionService
Retrieve a session by its id- Specified by:
getSession
in 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:
getLoggedUserFromSession
in 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:SessionService
Define how long, in milliseconds, the created sessions will be valid. This does not affect already created session- Specified by:
setSessionDuration
in interfaceSessionService
-
getDefaultSessionDuration
public long getDefaultSessionDuration()
Description copied from interface:SessionService
Retrieve the default sessions's duration, in milliseconds.- Specified by:
getDefaultSessionDuration
in interfaceSessionService
- Returns:
- the default sessions's duration
-
getSessionDuration
public long getSessionDuration()
Description copied from interface:SessionService
Retrieve the duration, in milliseconds, of new created session. If no duration was specified, the default duration will be used- Specified by:
getSessionDuration
in interfaceSessionService
- Returns:
- the duration of new created session.
-
renewSession
public void renewSession(long sessionId) throws SSessionException
Description copied from interface:SessionService
Update the expiration and the last update dates of the session.- Specified by:
renewSession
in interfaceSessionService
- Parameters:
sessionId
- the session id- Throws:
SSessionException
- if some error arrives while creating the session
-
cleanInvalidSessions
public void cleanInvalidSessions()
Description copied from interface:SessionService
Delete all invalid sessions- Specified by:
cleanInvalidSessions
in interfaceSessionService
-
deleteSessionsOfTenant
public void deleteSessionsOfTenant(long tenantId)
Description copied from interface:SessionService
Delete all sessions of a tenant- Specified by:
deleteSessionsOfTenant
in interfaceSessionService
-
deleteSessionsOfTenantExceptTechnicalUser
public void deleteSessionsOfTenantExceptTechnicalUser(long tenantId)
Description copied from interface:SessionService
Delete all sessions of a tenant except the one of the technical user- Specified by:
deleteSessionsOfTenantExceptTechnicalUser
in interfaceSessionService
-
deleteSessions
public void deleteSessions()
Description copied from interface:SessionService
Deletes all the sessions.- Specified by:
deleteSessions
in interfaceSessionService
-
-