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 Constructor Description PageOperationsInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CatalogSynchronizationService
getCatalogSynchronizationService()
protected CatalogVersionModel
getCatalogVersionModel(java.lang.String catalog, java.lang.String catalogVersion)
Gets the catalogVersionModelprotected CatalogVersionService
getCatalogVersionService()
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 UserService
getUserService()
boolean
preHandle(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.void
setCatalogSynchronizationService(CatalogSynchronizationService catalogSynchronizationService)
void
setCatalogVersionService(CatalogVersionService catalogVersionService)
void
setUserService(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.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.- Specified by:
preHandle
in interfaceorg.springframework.web.servlet.HandlerInterceptor
- Overrides:
preHandle
in classorg.springframework.web.servlet.handler.HandlerInterceptorAdapter
- Throws:
java.lang.Exception
-UnknownIdentifierException
if no CatalogVersion with the specified catalog id and version existsAmbiguousIdentifierException
if 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:
Optional
synchronization 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)
-
-