Class CatalogEntityEventHandlerUtility

java.lang.Object
com.broadleafcommerce.recommendationengine.service.messaging.handlers.CatalogEntityEventHandlerUtility

public class CatalogEntityEventHandlerUtility extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    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 Summary

    Modifier and Type
    Method
    Description
    protected 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 a ContextInfo based on the given ContextRequest.
    protected com.broadleafcommerce.data.tracking.core.context.ContextInfo
    buildMatchingContextInfo(@NonNull org.springframework.context.ApplicationEvent event)
    Builds a hydrated ContextInfo 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 matching ContextInfo based on the given InternalPersistenceEvent.
    protected com.broadleafcommerce.data.tracking.core.context.ContextRequest
    buildMatchingContextRequest(@NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityCreatedEvent event)
    Builds a matching ContextInfo based on the given CatalogEntityCreatedEvent.
    protected com.broadleafcommerce.data.tracking.core.context.ContextRequest
    buildMatchingContextRequest(@NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityDeletedEvent event)
    Builds a matching ContextInfo based on the given CatalogEntityDeletedEvent.
    protected com.broadleafcommerce.data.tracking.core.context.ContextRequest
    buildMatchingContextRequest(@NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityUpdatedEvent event)
    Builds a matching ContextInfo based on the given CatalogEntityUpdatedEvent.
    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
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 hydrated ContextInfo that matches the context of the deleted entity from the given event.
      Parameters:
      event - the ApplicationEvent 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 given ApplicationEvent 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 a ContextInfo based on the given ContextRequest.

      Note that ContextRequest.isForceFilterByCatalogExcludeInheritance() is set to true, 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 - the ContextRequest to hydrate
      Returns:
      a hydrated ContextInfo based on the given ContextRequest
    • buildMatchingContextRequest

      protected com.broadleafcommerce.data.tracking.core.context.ContextRequest buildMatchingContextRequest(@NonNull @NonNull com.broadleafcommerce.common.messaging.notification.domain.InternalPersistenceEvent event)
      Builds a matching ContextInfo based on the given InternalPersistenceEvent.
    • buildMatchingContextRequest

      protected com.broadleafcommerce.data.tracking.core.context.ContextRequest buildMatchingContextRequest(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityCreatedEvent event)
      Builds a matching ContextInfo based on the given CatalogEntityCreatedEvent.
    • buildMatchingContextRequest

      protected com.broadleafcommerce.data.tracking.core.context.ContextRequest buildMatchingContextRequest(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityDeletedEvent event)
      Builds a matching ContextInfo based on the given CatalogEntityDeletedEvent.
    • buildMatchingContextRequest

      protected com.broadleafcommerce.data.tracking.core.context.ContextRequest buildMatchingContextRequest(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityUpdatedEvent event)
      Builds a matching ContextInfo based on the given CatalogEntityUpdatedEvent.
    • buildMatchingContextRequest

      protected com.broadleafcommerce.data.tracking.core.context.ContextRequest buildMatchingContextRequest(@Nullable String tenantId, @Nullable String applicationId, @Nullable String catalogId)
    • 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()