public class DefaultSessionService extends AbstractService implements SessionService
AbstractService.SerializableDTOSessionService.SessionAttributeLoader<T>tenant| Constructor and Description |
|---|
DefaultSessionService() |
| Modifier and Type | Method and Description |
|---|---|
void |
closeCurrentSession()
Close the current
Session |
void |
closeSession(Session session)
Closed the given
Session |
Session |
createNewSession()
Creates a new
Session. |
Session |
createSession()
Must be overwritten! Use <lookup-method> in spring.
|
java.lang.Object |
executeInLocalView(SessionExecutionBody body)
Executes the given
SessionExecutionBody in a local SessionContext |
java.lang.Object |
executeInLocalView(SessionExecutionBody body,
UserModel model)
Executes the given
SessionExecutionBody in a local SessionContext and sets session user to given
UserModel. |
<T> T |
executeInLocalViewWithParams(java.util.Map<java.lang.String,java.lang.Object> localViewParameters,
SessionExecutionBody body)
Executes the given
SessionExecutionBody in a local SessionContext that is populated with
parameters provided in the map. |
<T> java.util.Map<java.lang.String,T> |
getAllAttributes()
shortcut to getCurrentSession().getAllAttributes().
|
<T> T |
getAttribute(java.lang.String name)
shortcut to getCurrentSession().getAttribute(String).
|
Session |
getBoundSession(java.lang.Object rawSession)
Returns service layer session bound to given JaloSession or creates new session (if no session is bound to given
JaloSession) and returns it.
|
Session |
getCurrentSession() |
<T> T |
getOrLoadAttribute(java.lang.String name,
SessionService.SessionAttributeLoader<T> loader)
Returns for the given name the content which is stored in the current
Session or loads a new value
atomically by calling the loader instance. |
java.lang.Object |
getRawSession(Session session)
Returns JaloSession bound to given service layer session.
|
Session |
getSession(java.lang.String sessionID)
Deprecated.
since 5.5.1 session management was changed and this method always returns current session or null
|
boolean |
hasCurrentSession()
Check if current session exists and neither closed nor inactive.
|
void |
removeAttribute(java.lang.String name)
Removes the given attribute from the current session.
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
shortcut to getCurrentSession().setAttribute(String,Object).
|
void |
setModelService(ModelService modelService) |
void |
setTenantScope(TenantScope tenantScope)
To set a current scope use a
AbstractService.setCurrentTenant(Tenant) this method has no effect any more. |
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplacepublic Session getCurrentSession()
getCurrentSession in interface SessionServiceSession@Deprecated public Session getSession(java.lang.String sessionID)
SessionServiceSession by given idgetSession in interface SessionServicepublic Session createNewSession()
SessionServiceSession.createNewSession in interface SessionServicepublic java.lang.Object executeInLocalView(SessionExecutionBody body)
SessionServiceSessionExecutionBody in a local SessionContextexecuteInLocalView in interface SessionServicepublic <T> T executeInLocalViewWithParams(java.util.Map<java.lang.String,java.lang.Object> localViewParameters,
SessionExecutionBody body)
SessionServiceSessionExecutionBody in a local SessionContext that is populated with
parameters provided in the map.executeInLocalViewWithParams in interface SessionServicelocalViewParameters - parameters that will be set in local viewbody - callback to be invokedpublic java.lang.Object executeInLocalView(SessionExecutionBody body, UserModel model)
SessionServiceSessionExecutionBody in a local SessionContext and sets session user to given
UserModel.executeInLocalView in interface SessionServicepublic void closeSession(Session session)
SessionServiceSessioncloseSession in interface SessionServicesession - the session which will be closedpublic void closeCurrentSession()
SessionServiceSessioncloseCurrentSession in interface SessionServicepublic void setAttribute(java.lang.String name,
java.lang.Object value)
setAttribute in interface SessionServicename - name of the attributevalue - the value to be setpublic void removeAttribute(java.lang.String name)
SessionServiceremoveAttribute in interface SessionServicename - the attribute namepublic <T> T getAttribute(java.lang.String name)
getAttribute in interface SessionServicename - the attribute namenull if such attribute don't exist in the current session.public <T> T getOrLoadAttribute(java.lang.String name,
SessionService.SessionAttributeLoader<T> loader)
SessionServiceSession or loads a new value
atomically by calling the loader instance.getOrLoadAttribute in interface SessionServicepublic <T> java.util.Map<java.lang.String,T> getAllAttributes()
getAllAttributes in interface SessionServiceSession as Map.public boolean hasCurrentSession()
SessionServiceJaloSession.hasCurrentSession()hasCurrentSession in interface SessionServicepublic void setTenantScope(TenantScope tenantScope)
AbstractServiceAbstractService.setCurrentTenant(Tenant) this method has no effect any more.setTenantScope in class AbstractServicepublic void setModelService(ModelService modelService)
public Session createSession()
public Session getBoundSession(java.lang.Object rawSession)
SessionServicegetBoundSession in interface SessionServicepublic java.lang.Object getRawSession(Session session)
SessionServicegetRawSession in interface SessionServiceCopyright © 2018 SAP SE. All Rights Reserved.