Class DefaultPropagationManager
- All Implemented Interfaces:
PropagationManager
PropagationManager- Author:
- Jeff Fischer
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPropagationManager(CommonCatalogService<? extends Catalog> catalogService, List<PropagationHandler> handlers) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected HierarchyPropagationHandlerInputbuildHierarchyPropagationHandlerInput(Trackable deployed, String parentCatalog, OperationType changeType, String propagationId, TrackableRepository<Trackable> repository) protected StringgetCatalogId(Trackable trackable) protected org.springframework.context.ApplicationEventPublisherprotected List<HierarchyPropagationHandler>protected PropagationManagerPropertiesprotected intprotected com.broadleafcommerce.common.extension.TypeFactoryprotected 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 HierarchyPropagationHandlerOutputprotected TrackablehandleUpdate(Trackable incoming, String incomingCatalog, String parentCatalog, String propagationId, Trackable candidate, TrackableRepository<Trackable> repository) protected voidnotifyCatalogEntityCreation(Trackable entity, String catalogId) protected voidnotifyCatalogEntityDeletion(Trackable entity, String catalogId) Inform the system via aCatalogEntityDeletedEventmessage that a catalog entity has been deleted if applicable.protected voidnotifyCatalogEntityUpdated(Trackable entity, String catalogId) 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 to those versions as appropriate.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.protected HierarchyPropagationHandlerOutputpropagateThroughChildCatalogsViaHierarchyHandler(Trackable deployed, String parentCatalog, OperationType changeType, String propagationId, TrackableRepository<Trackable> repository) Find and invoke aHierarchyPropagationHandlerto handle the propagation request.voidsetEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher) voidsetHierarchyPropagationHandlers(List<HierarchyPropagationHandler> hierarchyPropagationHandlers) voidsetPropagationManagerProperties(PropagationManagerProperties propagationManagerProperties) voidsetTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
Constructor Details
-
DefaultPropagationManager
public DefaultPropagationManager(CommonCatalogService<? extends Catalog> catalogService, List<PropagationHandler> handlers)
-
-
Method Details
-
setHierarchyPropagationHandlers
@Autowired(required=false) public void setHierarchyPropagationHandlers(@Nullable List<HierarchyPropagationHandler> hierarchyPropagationHandlers) -
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 to those versions as appropriate.
Since DataTracking 2.0.7, if
PropagationManagerProperties.isAllowHierarchyPropagationHandlers(), the default implementation will first try finding aHierarchyPropagationHandlerthat can handle the request. See the documentation onHierarchyPropagationHandlerfor more details. If the global setting is disabled, or if noHierarchyPropagationHandlercould handle the request, the behavior will fall back to the standard propagation flow as described below.In the standard propagation flow, the default implementation defers to implementations of
PropagationHandler.PropagationHandlerinstances are registered with Spring and ordered. The first instance capable of handling is used and others are ignored. By default, for deletion, aCatalogEntityDeletedEventis 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
-
areHierarchyPropagationHandlersAllowed
protected boolean areHierarchyPropagationHandlersAllowed()- Returns:
- whether hierarchy propagation handler support is enabled at all in the system
- Since:
- DataTracking 2.0.7
-
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
-
getRecursivePropagationCatalogIdsProcessingBatchSize
protected int getRecursivePropagationCatalogIdsProcessingBatchSize()- Returns:
- catalog ids processing batch size for recursive propagation flow
- Since:
- DataTracking 2.0.7
-
getCatalogId
-
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:
-
notifyCatalogEntityUpdated
-
notifyCatalogEntityCreation
-
propagateThroughChildCatalogsViaHierarchyHandler
protected HierarchyPropagationHandlerOutput propagateThroughChildCatalogsViaHierarchyHandler(Trackable deployed, String parentCatalog, OperationType changeType, String propagationId, TrackableRepository<Trackable> repository) Find and invoke aHierarchyPropagationHandlerto handle the propagation request.- 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- Returns:
- result details
- Since:
- DataTracking 2.0.7
-
buildHierarchyPropagationHandlerInput
protected HierarchyPropagationHandlerInput buildHierarchyPropagationHandlerInput(Trackable deployed, String parentCatalog, OperationType changeType, String propagationId, TrackableRepository<Trackable> repository) -
handleHierarchyPropagationHandlerNotFound
protected HierarchyPropagationHandlerOutput handleHierarchyPropagationHandlerNotFound(HierarchyPropagationHandlerInput input) -
getEventPublisher
protected org.springframework.context.ApplicationEventPublisher getEventPublisher() -
setEventPublisher
@Autowired public void setEventPublisher(@Nullable org.springframework.context.ApplicationEventPublisher eventPublisher) -
getPropagationManagerProperties
-
setPropagationManagerProperties
@Autowired public void setPropagationManagerProperties(@Nullable PropagationManagerProperties propagationManagerProperties) -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
getHierarchyPropagationHandlers
-