public interface SessionService
Session lifecycle and attributes.| Modifier and Type | Interface and Description |
|---|---|
static interface |
SessionService.SessionAttributeLoader<T>
Interface for loading attribute values while setting a new attribute in the current session.
|
| 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. |
<T> T |
executeInLocalView(SessionExecutionBody body)
Executes the given
SessionExecutionBody in a local SessionContext |
<T> T |
executeInLocalView(SessionExecutionBody body,
UserModel model)
Executes the given
SessionExecutionBody in a local SessionContext and sets session user to given
UserModel. |
<T> T |
executeInLocalViewWithParams(Map<String,Object> localViewParameters,
SessionExecutionBody body)
Executes the given
SessionExecutionBody in a local SessionContext that is populated with
parameters provided in the map. |
<T> Map<String,T> |
getAllAttributes() |
<T> T |
getAttribute(String name)
Returns for the given attribute name the content which is stored in the current
Session |
Session |
getBoundSession(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(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. |
Object |
getRawSession(Session session)
Returns JaloSession bound to given service layer session.
|
Session |
getSession(String id)
Deprecated.
since 5.5.1 session management was changed and this method always returns null
|
boolean |
hasCurrentSession()
Check if current session exists and neither closed nor inactive.
|
void |
removeAttribute(String name)
Removes the given attribute from the current session.
|
void |
setAttribute(String name,
Object value)
Set the given value object to the current
Session as attribute with the given name. |
@Deprecated Session getSession(String id)
Session by given idvoid closeSession(Session session)
Sessionsession - the session which will be closedvoid closeCurrentSession()
Sessionboolean hasCurrentSession()
JaloSession.hasCurrentSession()void setAttribute(String name, Object value)
Session as attribute with the given name. If the value object is
a (persisted) model than the model is written to the session attribute.name - name of the attributevalue - the value to be set<T> T getAttribute(String name)
Sessionname - the attribute namenull if such attribute don't exist in the current session.<T> T getOrLoadAttribute(String name, SessionService.SessionAttributeLoader<T> loader)
Session or loads a new value
atomically by calling the loader instance.<T> Map<String,T> getAllAttributes()
Session as Map.<T> T executeInLocalView(SessionExecutionBody body)
SessionExecutionBody in a local SessionContext<T> T executeInLocalViewWithParams(Map<String,Object> localViewParameters, SessionExecutionBody body)
SessionExecutionBody in a local SessionContext that is populated with
parameters provided in the map.localViewParameters - parameters that will be set in local viewbody - callback to be invoked<T> T executeInLocalView(SessionExecutionBody body, UserModel model)
SessionExecutionBody in a local SessionContext and sets session user to given
UserModel.void removeAttribute(String name)
name - the attribute nameSession getBoundSession(Object rawSession)
Copyright © 2017 SAP SE. All Rights Reserved.