Class DefaultPropagationManager

java.lang.Object
com.broadleafcommerce.data.tracking.core.transition.DefaultPropagationManager
All Implemented Interfaces:
PropagationManager

public class DefaultPropagationManager extends Object implements PropagationManager
Default version of PropagationManager
Author:
Jeff Fischer
  • Constructor Details

  • Method Details

    • propagate

      @SuppressNotification("SINGLE_INDEX_REQUEST") public void propagate(Trackable deployed, String parentCatalog, OperationType changeType, String propagationId, TrackableRepository<Trackable> repository)
      Description copied from interface: PropagationManager
      Given a deployed catalog discriminated change, recurse through versions of the entity in child catalogs and transfer the deployed changes using the process defined implementations of PropagationHandler. PropagationHandler instances are registered with Spring and ordered. The first instance capable of handling is used and others are ignored.

      For deletion, a CatalogEntityDeletedEvent is emitted at the parent catalog level, and then one for each child catalog if propagation candidate doesn't exist. If propagation candidate exists for a child catalog, InternalPersistenceEvent is used instead.

      Specified by:
      propagate in interface PropagationManager
      Parameters:
      deployed - The deployed item containing changes to propagate
      parentCatalog - The catalog whose children will be checked for propagation items
      changeType - The type of operation to be propagated (CREATE,UPDATE,DELETE)
      propagationId - An id that identifies changes as part of this propagation. See ChangeDetail.getPropagationId().
      repository - The repository responsible for persistence of the entity type
    • propagateThroughChildCatalogs

      protected void propagateThroughChildCatalogs(Trackable deployed, String parentCatalog, OperationType changeType, String propagationId, TrackableRepository<Trackable> repository)
      Propagates the changes for each child catalog of the given parent catalog.
      Parameters:
      deployed - The deployed item containing changes to propagate
      parentCatalog - The catalog whose children will be checked for propagation items
      changeType - The type of operation to be propagated (CREATE,UPDATE,DELETE)
      propagationId - An id that identifies changes as part of this propagation. See ChangeDetail.getPropagationId().
      repository - The repository responsible for persistence of the entity type
    • handleDelete

      protected Trackable handleDelete(Trackable incoming, String incomingCatalog, String parentCatalog, String propagationId, @Nullable Trackable candidate, TrackableRepository<Trackable> repository)
    • handleCreate

      protected Trackable handleCreate(Trackable incoming, String incomingCatalog, String parentCatalog, String propagationId, TrackableRepository<Trackable> repository)
    • handleUpdate

      protected Trackable handleUpdate(Trackable incoming, String incomingCatalog, String parentCatalog, String propagationId, @Nullable Trackable candidate, TrackableRepository<Trackable> repository)
    • notifyCatalogEntityDeletion

      protected void notifyCatalogEntityDeletion(Trackable entity, String catalogId)
      Inform the system via a CatalogEntityDeletedEvent message that a catalog entity has been deleted if applicable.

      This is useful for consuming services to delete any relationship entities that are no longer relevant.

      The given entity class is still checked for whether it's CatalogTrackable, to avoid sending the event for entities that only have TrackableBehavior.CATALOG through its inheritance from another entity, e.g. translations.

      Parameters:
      entity - the entity to notify deletion if it's CatalogTrackable
      catalogId - the id of the catalog to emit the event for
      See Also:
    • getEventPublisher

      protected org.springframework.context.ApplicationEventPublisher getEventPublisher()
    • setEventPublisher

      @Autowired public void setEventPublisher(@Nullable org.springframework.context.ApplicationEventPublisher eventPublisher)