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.HandlerInterceptorAdapterDefault 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 Constructor Description PageOperationsInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CatalogSynchronizationServicegetCatalogSynchronizationService()protected CatalogVersionModelgetCatalogVersionModel(java.lang.String catalog, java.lang.String catalogVersion)Gets the catalogVersionModelprotected CatalogVersionServicegetCatalogVersionService()protected java.util.Optional<SyncItemJobModel>getSyncItemJob(java.lang.String catalogId, java.lang.String sourceCatalgVersion, java.lang.String targetCatalogVersion)Returns first active synchronization job from source catalog.protected UserServicegetUserService()booleanpreHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.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)
-
-
-
Method Detail
-
preHandle
public boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler) throws java.lang.ExceptionDetermines 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.- Specified by:
preHandlein interfaceorg.springframework.web.servlet.HandlerInterceptor- Overrides:
preHandlein classorg.springframework.web.servlet.handler.HandlerInterceptorAdapter- Throws:
java.lang.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 java.util.Optional<SyncItemJobModel> getSyncItemJob(java.lang.String catalogId, java.lang.String sourceCatalgVersion, java.lang.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
protected CatalogVersionModel getCatalogVersionModel(java.lang.String catalog, java.lang.String catalogVersion)
Gets the catalogVersionModel- Parameters:
catalog- the catalog namecatalogVersion- the catalog version name- Returns:
- the catalogVersionModel
-
getCatalogVersionService
protected CatalogVersionService getCatalogVersionService()
-
setCatalogVersionService
public void setCatalogVersionService(CatalogVersionService catalogVersionService)
-
getUserService
protected UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
getCatalogSynchronizationService
protected CatalogSynchronizationService getCatalogSynchronizationService()
-
setCatalogSynchronizationService
public void setCatalogSynchronizationService(CatalogSynchronizationService catalogSynchronizationService)
-
-