Class DefaultImpersonationService
java.lang.Object
de.hybris.platform.commerceservices.impersonation.impl.DefaultImpersonationService
- All Implemented Interfaces:
ImpersonationService
The impersonation service executes code passed in a
ImpersonationService.Executor in the context of user,
currency, language, site, etc.-
Nested Class Summary
Nested classes/interfaces inherited from interface de.hybris.platform.commerceservices.impersonation.ImpersonationService
ImpersonationService.Executor<R,T extends Throwable>, ImpersonationService.Nothing -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureSession(ImpersonationContext context) Impersonates local session with parameters passed in context.protected BaseSiteModelprotected Collection<CatalogVersionModel>protected CurrencyModelprotected LanguageModelprotected UserTaxGroupprotected UserModeldetermineSessionUser(ImpersonationContext context) <R,T extends Throwable>
RexecuteInContext(ImpersonationContext context, ImpersonationService.Executor<R, T> wrapper) Execute the wrapper code in the context of the specified userprotected Collection<CatalogVersionModel>Get all the active catalog versions in the system.protected BaseSiteServiceprotected BaseStoreServiceprotected CatalogVersionServiceprotected FlexibleSearchServiceprotected CommonI18NServiceprotected SearchRestrictionServiceprotected Set<CatalogVersionModel>Get the session catalog versions for the specified user.protected SessionServiceprotected UserServicevoidsetBaseSiteService(BaseSiteService baseSiteService) voidsetBaseStoreService(BaseStoreService baseStoreService) voidsetCatalogVersionService(CatalogVersionService catalogVersionService) voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService) voidsetI18nService(CommonI18NService i18nService) voidsetSearchRestrictionService(SearchRestrictionService searchRestrictionService) voidsetSessionService(SessionService sessionService) voidsetUserService(UserService userService)
-
Constructor Details
-
DefaultImpersonationService
public DefaultImpersonationService()
-
-
Method Details
-
executeInContext
public <R,T extends Throwable> R executeInContext(ImpersonationContext context, ImpersonationService.Executor<R, T> wrapper) throws TDescription copied from interface:ImpersonationServiceExecute the wrapper code in the context of the specified user- Specified by:
executeInContextin interfaceImpersonationService- Type Parameters:
R- The type of the return valueT- The type of the exception thrown by the wrapper- Parameters:
context- The context to execute inwrapper- The code to execute in that context- Returns:
- The result of method being executed
- Throws:
T- The exception thrown by the wrapper if an error occurs
-
configureSession
Impersonates local session with parameters passed in context.- Parameters:
context- The context to impersonate
-
determineSessionBaseSite
- Parameters:
context- The context to impersonate- Returns:
- base site that should be used in session context. No null returned.
-
determineSessionCurrency
- Parameters:
context- The context to impersonate- Returns:
- currency that should be used in session context. No null returned.
-
determineSessionLanguage
- Parameters:
context- The context to impersonate- Returns:
- language that should be used in session context. No null returned.
-
determineSessionCatalogVersions
protected Collection<CatalogVersionModel> determineSessionCatalogVersions(ImpersonationContext context) - Parameters:
context- The context to impersonate- Returns:
- catalog versions that should be used in session context. No null returned.
-
determineSessionTaxGroup
- Parameters:
context- The context to impersonate- Returns:
- tax group that should be used into session context.
-
determineSessionUser
- Parameters:
context- The context to impersonate- Returns:
- user that should be used into session context. No null returned.
-
getSessionCatalogVersionsForUser
Get the session catalog versions for the specified user. Get the set of catalog versions that should be visible to the specified user and should be set on the user's session. These catalog versions will be used in all search restrictions for code run in the impersonation context of the user. The default implementation is to get all the active catalog versions. Sub-classes can implement a different strategy.- Parameters:
user- The user- Returns:
- The set of catalog versions for this specified user
-
getActiveCatalogVersions
Get all the active catalog versions in the system.- Returns:
- The active catalog versions or an empty list if none found
-
getSessionService
-
setSessionService
-
getCatalogVersionService
-
setCatalogVersionService
-
getUserService
-
setUserService
-
getSearchRestrictionService
-
setSearchRestrictionService
-
getFlexibleSearchService
-
setFlexibleSearchService
-
getI18nService
-
setI18nService
-
getBaseStoreService
-
setBaseStoreService
-
getBaseSiteService
-
setBaseSiteService
-