Class CatalogEntityDeletedEventListener

java.lang.Object
com.broadleafcommerce.catalog.messaging.entitydeletion.CatalogEntityDeletedEventListener

public class CatalogEntityDeletedEventListener extends Object
The event listener for processing InternalPersistenceEvent and CatalogEntityDeletedEvent that are emitted when a CatalogTrackable entity is deleted.

InternalPersistenceEvent is handled for cases where the deleted entity has catalog-level overrides, this event is emitted at deletion. CatalogEntityDeletedEvent is handled for cases where the overrides don't exist, this event is emitted during propagation.

Author:
Sunny Yu
See Also:
  • DefaultPropagationHandler
  • WorkflowTransitionHelper
  • Constructor Details

  • Method Details

    • handleInternalPersistenceEvent

      @EventListener public void handleInternalPersistenceEvent(@NonNull @NonNull com.broadleafcommerce.common.messaging.notification.domain.InternalPersistenceEvent event)
    • handleCatalogEntityDeletedEvent

      @EventListener public void handleCatalogEntityDeletedEvent(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.catalog.CatalogEntityDeletedEvent event)
    • shouldProcessEvent

      protected boolean shouldProcessEvent(@NonNull @NonNull com.broadleafcommerce.common.messaging.notification.domain.InternalPersistenceEvent event)
      Determines whether the given InternalPersistenceEvent should be processed.

      Since there can be multiple instances of InternalPersistenceEvents be emitted for a single entity deletion deployment as the catalog tree is iterated, there are a list of criteria where an InternalPersistenceEvent would be processed:

      1. The event's entity is CatalogTrackable
      2. The event is for a TrackingLevel.PRODUCTION-level change
      3. The event represents an entity deletion
      4. The deleted entity has field overrides
      5. The deleted entity belongs to a lower-level catalog
      Parameters:
      event - the InternalPersistenceEvent to check
      Returns:
      true if the given InternalPersistenceEvent should be processed, otherwise false.