Class ProcessProductAssetSortingHandler
java.lang.Object
com.broadleafcommerce.catalog.messaging.ProcessProductAssetSortingHandler
A listener that accepts triggered scheduled job events of type
JOB_TYPE
and updates the
attributes of all assets in the data store.
The purpose of this job is to apply a sorting order to all assets currently in the system while
attempting to preserve the current display order.
This is typically only ever run once, when the drag-and-drop assets feature is enabled. To
trigger this job, add a Scheduled Job with a Job Type of `UPDATE_PRODUCT_ASSET_SORTING`.- Author:
- Jon Fleschler (jfleschler)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionProcessProductAssetSortingHandler
(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, ProductService<Product> productService, ProductAssetService<ProductAsset> productAssetService, List<com.broadleafcommerce.data.tracking.core.data.CatalogDataRouteSupporting> routes, com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator contextRequestHydrator, com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> catalogService, com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application> applicationService) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.data.tracking.core.context.ContextInfo
buildContextInfo
(com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog catalog) filterCatalogProducts
(com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog catalog, org.springframework.data.domain.Page<Product> products) protected List<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog>
protected com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application>
protected com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog>
protected com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator
protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService
protected int
getPageSize
(com.broadleafcommerce.common.messaging.domain.ScheduledJobRef scheduledJobRef) protected ProductAssetService<ProductAsset>
protected ProductService<Product>
protected List<com.broadleafcommerce.data.tracking.core.data.CatalogDataRouteSupporting>
protected void
handleMessage
(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) void
listen
(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) Queries the data store for all assets and updates their attributes.protected void
updateContextInfoForUpdate
(com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog catalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-
Field Details
-
JOB_TYPE
- See Also:
-
-
Constructor Details
-
ProcessProductAssetSortingHandler
public ProcessProductAssetSortingHandler(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, ProductService<Product> productService, ProductAssetService<ProductAsset> productAssetService, List<com.broadleafcommerce.data.tracking.core.data.CatalogDataRouteSupporting> routes, com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator contextRequestHydrator, com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> catalogService, com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application> applicationService)
-
-
Method Details
-
listen
@StreamListener("triggeredJobEventProcessProductAssets") public void listen(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) Queries the data store for all assets and updates their attributes.- Parameters:
message
- a scheduled job trigger event - will only be handled if it has typeJOB_TYPE
-
handleMessage
protected void handleMessage(org.springframework.messaging.Message<com.broadleafcommerce.common.messaging.domain.ScheduledJobRef> message) -
updateContextInfoForUpdate
protected void updateContextInfoForUpdate(com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog catalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
filterCatalogProducts
-
getAllCatalogs
-
getPageSize
protected int getPageSize(com.broadleafcommerce.common.messaging.domain.ScheduledJobRef scheduledJobRef) -
buildContextInfo
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildContextInfo(com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog catalog) -
getIdempotentConsumptionService
protected com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService getIdempotentConsumptionService() -
getProductService
-
getProductAssetService
-
getRoutes
@NonNull protected List<com.broadleafcommerce.data.tracking.core.data.CatalogDataRouteSupporting> getRoutes() -
getContextRequestHydrator
@NonNull protected com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator getContextRequestHydrator() -
getCatalogService
@NonNull protected com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> getCatalogService() -
getApplicationService
@NonNull protected com.broadleafcommerce.data.tracking.core.tenant.service.CommonApplicationService<com.broadleafcommerce.data.tracking.core.tenant.domain.Application> getApplicationService()
-