Class DefaultPropagationManager
java.lang.Object
com.broadleafcommerce.data.tracking.core.transition.DefaultPropagationManager
- All Implemented Interfaces:
PropagationManager
Default version of
PropagationManager- Author:
- Jeff Fischer
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPropagationManager(CommonCatalogService<? extends Catalog> catalogService, List<PropagationHandler> handlers) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.context.ApplicationEventPublisherprotected TrackablehandleCreate(Trackable incoming, String incomingCatalog, String parentCatalog, String propagationId, TrackableRepository<Trackable> repository) protected TrackablehandleDelete(Trackable incoming, String incomingCatalog, String parentCatalog, String propagationId, Trackable candidate, TrackableRepository<Trackable> repository) protected TrackablehandleUpdate(Trackable incoming, String incomingCatalog, String parentCatalog, String propagationId, Trackable candidate, TrackableRepository<Trackable> repository) protected voidnotifyCatalogEntityDeletion(Trackable entity, String catalogId) Inform the system via aCatalogEntityDeletedEventmessage that a catalog entity has been deleted if applicable.voidpropagate(Trackable deployed, String parentCatalog, OperationType changeType, String propagationId, TrackableRepository<Trackable> repository) 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 ofPropagationHandler.protected voidpropagateThroughChildCatalogs(Trackable deployed, String parentCatalog, OperationType changeType, String propagationId, TrackableRepository<Trackable> repository) Propagates the changes for each child catalog of the given parent catalog.voidsetEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
-
Constructor Details
-
DefaultPropagationManager
public DefaultPropagationManager(CommonCatalogService<? extends Catalog> catalogService, List<PropagationHandler> handlers)
-
-
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:PropagationManagerGiven a deployed catalog discriminated change, recurse through versions of the entity in child catalogs and transfer the deployed changes using the process defined implementations ofPropagationHandler.PropagationHandlerinstances are registered with Spring and ordered. The first instance capable of handling is used and others are ignored.For deletion, a
CatalogEntityDeletedEventis 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,InternalPersistenceEventis used instead.- Specified by:
propagatein interfacePropagationManager- Parameters:
deployed- The deployed item containing changes to propagateparentCatalog- The catalog whose children will be checked for propagation itemschangeType- The type of operation to be propagated (CREATE,UPDATE,DELETE)propagationId- An id that identifies changes as part of this propagation. SeeChangeDetail.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 propagateparentCatalog- The catalog whose children will be checked for propagation itemschangeType- The type of operation to be propagated (CREATE,UPDATE,DELETE)propagationId- An id that identifies changes as part of this propagation. SeeChangeDetail.getPropagationId().repository- The repository responsible for persistence of the entity type
-
handleDelete
-
handleCreate
-
handleUpdate
-
notifyCatalogEntityDeletion
Inform the system via aCatalogEntityDeletedEventmessage 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 haveTrackableBehavior.CATALOGthrough its inheritance from another entity, e.g. translations.- Parameters:
entity- the entity to notify deletion if it's CatalogTrackablecatalogId- 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)
-