Class DefaultSessionService
java.lang.Object
de.hybris.platform.servicelayer.internal.service.AbstractService
de.hybris.platform.servicelayer.session.impl.DefaultSessionService
- All Implemented Interfaces:
SessionService,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
MockSessionService
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTONested classes/interfaces inherited from interface de.hybris.platform.servicelayer.session.SessionService
SessionService.SessionAttributeLoader<T> -
Field Summary
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClose the currentSessionvoidcloseSession(Session session) Closed the givenSessionCreates a newSession.Must be overwritten! Use <lookup-method> in spring.Executes the givenSessionExecutionBodyin a localSessionContextexecuteInLocalView(SessionExecutionBody body, UserModel model) Executes the givenSessionExecutionBodyin a localSessionContextand sets session user to given UserModel.<T> TexecuteInLocalViewWithParams(Map<String, Object> localViewParameters, SessionExecutionBody body) Executes the givenSessionExecutionBodyin a localSessionContextthat is populated with parameters provided in the map.shortcut to getCurrentSession().getAllAttributes().<T> TgetAttribute(String name) shortcut to getCurrentSession().getAttribute(String).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.<T> TgetOrLoadAttribute(String name, SessionService.SessionAttributeLoader<T> loader) Returns for the given name the content which is stored in the currentSessionor loads a new value atomically by calling the loader instance.getRawSession(Session session) Returns JaloSession bound to given service layer session.getSession(String sessionID) Deprecated, for removal: This API element is subject to removal in a future version.since 5.5.1 session management was changed and this method always returns current session or nullbooleanCheck if current session exists and neither closed nor inactive.voidremoveAttribute(String name) Removes the given attribute from the current session.voidsetAttribute(String name, Object value) shortcut to getCurrentSession().setAttribute(String,Object).voidsetModelService(ModelService modelService) Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
Constructor Details
-
DefaultSessionService
public DefaultSessionService()
-
-
Method Details
-
getCurrentSession
- Specified by:
getCurrentSessionin interfaceSessionService- Returns:
- the current
Session
-
getSession
Deprecated, for removal: This API element is subject to removal in a future version.since 5.5.1 session management was changed and this method always returns current session or nullDescription copied from interface:SessionServiceGetSessionby given id- Specified by:
getSessionin interfaceSessionService
-
createNewSession
Description copied from interface:SessionServiceCreates a newSession.- Specified by:
createNewSessionin interfaceSessionService
-
executeInLocalView
Description copied from interface:SessionServiceExecutes the givenSessionExecutionBodyin a localSessionContext- Specified by:
executeInLocalViewin interfaceSessionService
-
executeInLocalViewWithParams
public <T> T executeInLocalViewWithParams(Map<String, Object> localViewParameters, SessionExecutionBody body) Description copied from interface:SessionServiceExecutes the givenSessionExecutionBodyin a localSessionContextthat is populated with parameters provided in the map.- Specified by:
executeInLocalViewWithParamsin interfaceSessionService- Parameters:
localViewParameters- parameters that will be set in local viewbody- callback to be invoked- Returns:
- callback result
-
executeInLocalView
Description copied from interface:SessionServiceExecutes the givenSessionExecutionBodyin a localSessionContextand sets session user to given UserModel.- Specified by:
executeInLocalViewin interfaceSessionService
-
closeSession
Description copied from interface:SessionServiceClosed the givenSession- Specified by:
closeSessionin interfaceSessionService- Parameters:
session- the session which will be closed
-
closeCurrentSession
public void closeCurrentSession()Description copied from interface:SessionServiceClose the currentSession- Specified by:
closeCurrentSessionin interfaceSessionService
-
setAttribute
shortcut to getCurrentSession().setAttribute(String,Object). this method is just a delegate to the Session object and it should not be overwritten.- Specified by:
setAttributein interfaceSessionService- Parameters:
name- name of the attributevalue- the value to be set
-
removeAttribute
Description copied from interface:SessionServiceRemoves the given attribute from the current session. Do nothing if the attribute doesn't exists in the session.- Specified by:
removeAttributein interfaceSessionService- Parameters:
name- the attribute name
-
getAttribute
shortcut to getCurrentSession().getAttribute(String). this method is just a delegate to the Session object and it should not be overwritten- Specified by:
getAttributein interfaceSessionService- Parameters:
name- the attribute name- Returns:
nullif such attribute don't exist in the current session.
-
getOrLoadAttribute
Description copied from interface:SessionServiceReturns for the given name the content which is stored in the currentSessionor loads a new value atomically by calling the loader instance.- Specified by:
getOrLoadAttributein interfaceSessionService
-
getAllAttributes
shortcut to getCurrentSession().getAllAttributes(). this method is just a delegate to the Session object and it should not be overwritten- Specified by:
getAllAttributesin interfaceSessionService- Returns:
- all attributes from the current
Sessionas Map.
-
hasCurrentSession
public boolean hasCurrentSession()Description copied from interface:SessionServiceCheck if current session exists and neither closed nor inactive. KAM-158: Replacement forJaloSession.hasCurrentSession()- Specified by:
hasCurrentSessionin interfaceSessionService
-
setModelService
-
createSession
Must be overwritten! Use <lookup-method> in spring. -
getBoundSession
Description copied from interface:SessionServiceReturns service layer session bound to given JaloSession or creates new session (if no session is bound to given JaloSession) and returns it.- Specified by:
getBoundSessionin interfaceSessionService
-
getRawSession
Description copied from interface:SessionServiceReturns JaloSession bound to given service layer session.- Specified by:
getRawSessionin interfaceSessionService
-