Class PageOperationsInterceptor
java.lang.Object
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
de.hybris.platform.cmssmarteditwebservices.interceptor.PageOperationsInterceptor
- All Implemented Interfaces:
org.springframework.web.servlet.AsyncHandlerInterceptor,org.springframework.web.servlet.HandlerInterceptor
public class PageOperationsInterceptor
extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter
Default interceptor to run before controllers' execution to extract the catalogId and sourceCatalogVersion and
targetCatalogVersion from the request URI to determine if the current user has required sync permissions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CatalogSynchronizationServiceprotected CatalogVersionModelgetCatalogVersionModel(String catalog, String catalogVersion) Gets the catalogVersionModelprotected CatalogVersionServiceprotected Optional<SyncItemJobModel>getSyncItemJob(String catalogId, String sourceCatalgVersion, String targetCatalogVersion) Returns first active synchronization job from source catalog.protected UserServicebooleanpreHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler) Determines if the current user has permissions to sync from source catalog version to target catalog version.voidsetCatalogSynchronizationService(CatalogSynchronizationService catalogSynchronizationService) voidsetCatalogVersionService(CatalogVersionService catalogVersionService) voidsetUserService(UserService userService) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.servlet.AsyncHandlerInterceptor
afterConcurrentHandlingStartedMethods inherited from interface org.springframework.web.servlet.HandlerInterceptor
afterCompletion, postHandle
-
Constructor Details
-
PageOperationsInterceptor
public PageOperationsInterceptor()
-
-
Method Details
-
preHandle
public boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler) throws Exception Determines if the current user has permissions to sync from source catalog version to target catalog version. In the case that the user does not have permission, we return an error in the HTTP response using the status code 403 - Forbidden.- Throws:
Exception-UnknownIdentifierExceptionif no CatalogVersion with the specified catalog id and version existsAmbiguousIdentifierExceptionif more than one CatalogVersion is found with the specified catalog id and version
-
getSyncItemJob
protected Optional<SyncItemJobModel> getSyncItemJob(String catalogId, String sourceCatalgVersion, String targetCatalogVersion) Returns first active synchronization job from source catalog.- Parameters:
catalogId- the catalog namesourceCatalgVersion- the source catalog version nametargetCatalgVersion- the target catalog version name- Returns:
Optionalsynchronization job
-
getCatalogVersionModel
Gets the catalogVersionModel- Parameters:
catalog- the catalog namecatalogVersion- the catalog version name- Returns:
- the catalogVersionModel
-
getCatalogVersionService
-
setCatalogVersionService
-
getUserService
-
setUserService
-
getCatalogSynchronizationService
-
setCatalogSynchronizationService
public void setCatalogSynchronizationService(CatalogSynchronizationService catalogSynchronizationService)
-