Class CatalogEntityEventHandlerUtility
java.lang.Object
com.broadleafcommerce.recommendationengine.service.messaging.handlers.CatalogEntityEventHandlerUtility
-
Constructor Summary
ConstructorsConstructorDescriptionCatalogEntityEventHandlerUtility
(com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> catalogService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator contextRequestHydrator) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.data.tracking.core.context.ContextInfo
buildContext
(@NonNull com.broadleafcommerce.data.tracking.core.type.OperationType operationType, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest) protected com.broadleafcommerce.data.tracking.core.context.ContextInfo
buildHydratedContextInfo
(com.broadleafcommerce.data.tracking.core.type.OperationType operationType, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydratedContextRequest) Hydrates and builds aContextInfo
based on the givenContextRequest
.protected com.broadleafcommerce.data.tracking.core.context.ContextInfo
buildMatchingContextInfo
(@NonNull org.springframework.context.ApplicationEvent event) Builds a hydratedContextInfo
that matches the context of the deleted entity from the given event.protected com.broadleafcommerce.data.tracking.core.context.ContextRequest
buildMatchingContextRequest
(@NonNull com.broadleafcommerce.common.messaging.notification.domain.InternalPersistenceEvent event) Builds a matchingContextInfo
based on the givenInternalPersistenceEvent
.protected com.broadleafcommerce.data.tracking.core.context.ContextRequest
buildMatchingContextRequest
(@NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityCreatedEvent event) Builds a matchingContextInfo
based on the givenCatalogEntityCreatedEvent
.protected com.broadleafcommerce.data.tracking.core.context.ContextRequest
buildMatchingContextRequest
(@NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityDeletedEvent event) Builds a matchingContextInfo
based on the givenCatalogEntityDeletedEvent
.protected com.broadleafcommerce.data.tracking.core.context.ContextRequest
buildMatchingContextRequest
(@NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityUpdatedEvent event) Builds a matchingContextInfo
based on the givenCatalogEntityUpdatedEvent
.protected com.broadleafcommerce.data.tracking.core.context.ContextRequest
buildMatchingContextRequest
(String tenantId, String applicationId, String catalogId) 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.jayway.jsonpath.Configuration
protected com.broadleafcommerce.common.extension.TypeFactory
-
Constructor Details
-
CatalogEntityEventHandlerUtility
public CatalogEntityEventHandlerUtility(com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> catalogService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator contextRequestHydrator)
-
-
Method Details
-
buildMatchingContextInfo
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildMatchingContextInfo(@NonNull @NonNull org.springframework.context.ApplicationEvent event) throws UnsupportedOperationException Builds a hydratedContextInfo
that matches the context of the deleted entity from the given event.- Parameters:
event
- theApplicationEvent
that was emitted for the deleted entity- Returns:
- a
ContextInfo
that matches the context of the deleted entity from the given event - Throws:
UnsupportedOperationException
- if the givenApplicationEvent
is not supported
-
buildHydratedContextInfo
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildHydratedContextInfo(com.broadleafcommerce.data.tracking.core.type.OperationType operationType, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydratedContextRequest) Hydrates and builds aContextInfo
based on the givenContextRequest
.Note that
ContextRequest.isForceFilterByCatalogExcludeInheritance()
is set totrue
, which is to ensure that the relationship entities are only fetched from the specified catalog instead of from the entire catalog hierarchy. Since the catalog tree is walked and an event is emitted for each level, there is no need to fetch entities from other catalogs that are not explicitly specified in the current context.- Parameters:
dehydratedContextRequest
- theContextRequest
to hydrate- Returns:
- a hydrated
ContextInfo
based on the givenContextRequest
-
buildMatchingContextRequest
protected com.broadleafcommerce.data.tracking.core.context.ContextRequest buildMatchingContextRequest(@NonNull @NonNull com.broadleafcommerce.common.messaging.notification.domain.InternalPersistenceEvent event) Builds a matchingContextInfo
based on the givenInternalPersistenceEvent
. -
buildMatchingContextRequest
protected com.broadleafcommerce.data.tracking.core.context.ContextRequest buildMatchingContextRequest(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityCreatedEvent event) Builds a matchingContextInfo
based on the givenCatalogEntityCreatedEvent
. -
buildMatchingContextRequest
protected com.broadleafcommerce.data.tracking.core.context.ContextRequest buildMatchingContextRequest(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityDeletedEvent event) Builds a matchingContextInfo
based on the givenCatalogEntityDeletedEvent
. -
buildMatchingContextRequest
protected com.broadleafcommerce.data.tracking.core.context.ContextRequest buildMatchingContextRequest(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityUpdatedEvent event) Builds a matchingContextInfo
based on the givenCatalogEntityUpdatedEvent
. -
buildMatchingContextRequest
-
buildContext
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildContext(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.type.OperationType operationType, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest) -
getDefaultJsonPathConfiguration
protected com.jayway.jsonpath.Configuration getDefaultJsonPathConfiguration()- Returns:
- The default JsonPath configuration.
-
getCatalogService
protected com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> getCatalogService() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getContextRequestHydrator
protected com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator getContextRequestHydrator()
-