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.ContextInfobuildContext(@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.ContextInfobuildHydratedContextInfo(com.broadleafcommerce.data.tracking.core.type.OperationType operationType, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydratedContextRequest) Hydrates and builds aContextInfobased on the givenContextRequest.protected com.broadleafcommerce.data.tracking.core.context.ContextInfobuildMatchingContextInfo(@NonNull org.springframework.context.ApplicationEvent event) Builds a hydratedContextInfothat matches the context of the deleted entity from the given event.protected com.broadleafcommerce.data.tracking.core.context.ContextRequestbuildMatchingContextRequest(@NonNull com.broadleafcommerce.common.messaging.notification.domain.InternalPersistenceEvent event) Builds a matchingContextInfobased on the givenInternalPersistenceEvent.protected com.broadleafcommerce.data.tracking.core.context.ContextRequestbuildMatchingContextRequest(@NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityCreatedEvent event) Builds a matchingContextInfobased on the givenCatalogEntityCreatedEvent.protected com.broadleafcommerce.data.tracking.core.context.ContextRequestbuildMatchingContextRequest(@NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityDeletedEvent event) Builds a matchingContextInfobased on the givenCatalogEntityDeletedEvent.protected com.broadleafcommerce.data.tracking.core.context.ContextRequestbuildMatchingContextRequest(@NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityUpdatedEvent event) Builds a matchingContextInfobased on the givenCatalogEntityUpdatedEvent.protected com.broadleafcommerce.data.tracking.core.context.ContextRequestbuildMatchingContextRequest(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.ContextRequestHydratorprotected com.jayway.jsonpath.Configurationprotected 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 hydratedContextInfothat matches the context of the deleted entity from the given event.- Parameters:
event- theApplicationEventthat was emitted for the deleted entity- Returns:
- a
ContextInfothat matches the context of the deleted entity from the given event - Throws:
UnsupportedOperationException- if the givenApplicationEventis 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 aContextInfobased 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- theContextRequestto hydrate- Returns:
- a hydrated
ContextInfobased 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 matchingContextInfobased 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 matchingContextInfobased 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 matchingContextInfobased 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 matchingContextInfobased 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()
-