Class PropagationHelperUtility
java.lang.Object
com.broadleafcommerce.data.tracking.core.transition.PropagationHelperUtility
Functionality supporting propagation operations such as those in
PropagationIntegrator
.-
Constructor Summary
ConstructorDescriptionPropagationHelperUtility
(com.broadleafcommerce.common.extension.TypeFactory typeFactory, org.modelmapper.ModelMapper cloneMapper) -
Method Summary
Modifier and TypeMethodDescriptionbuildSlimPropagationTracking
(Trackable trackable) Builds aSlimPropagationTracking
for the providedTrackable
instance.buildSlimPropagationTrackingMap
(Map<String, Trackable> trackablesById) Builds aSlimPropagationTracking
for each of the providedTrackable
instances.protected List<FieldOverride>
deepCloneFieldOverrides
(List<FieldOverride> fieldOverrides) Deep cloning is important, as propagation-related flows often directly mutate the original values inTracking
.protected org.modelmapper.ModelMapper
protected com.broadleafcommerce.common.extension.TypeFactory
protected boolean
isCatalogChangeAnApplicationOverride
(Trackable updated, SlimPropagationTracking originalTracking) Determines if a catalog-discriminated entity change is an application override of an existing instance.boolean
isCatalogChangeAnOverride
(Trackable original, Trackable updated) Given the original and updated states of a catalog-discriminated change, determine whether the update is an override.boolean
isCatalogChangeAnOverride
(SlimPropagationTracking originalTracking, Trackable updated) Given the original and updated states of a catalog-discriminated change, determine whether the update is an override.protected boolean
isCatalogChangeATenantOverride
(Trackable updated, SlimPropagationTracking originalTracking) Determines if a catalog-discriminated entity change is a tenant override of an existing instance.
-
Constructor Details
-
PropagationHelperUtility
public PropagationHelperUtility(com.broadleafcommerce.common.extension.TypeFactory typeFactory, org.modelmapper.ModelMapper cloneMapper)
-
-
Method Details
-
buildSlimPropagationTrackingMap
public Map<String,SlimPropagationTracking> buildSlimPropagationTrackingMap(@Nullable Map<String, Trackable> trackablesById) Builds aSlimPropagationTracking
for each of the providedTrackable
instances.- Parameters:
trackablesById
- a map of context IDs toTrackable
instances to buildSlimPropagationTracking
for- Returns:
- a map of context IDs to
SlimPropagationTracking
instances
-
buildSlimPropagationTracking
Builds aSlimPropagationTracking
for the providedTrackable
instance.- Parameters:
trackable
- theTrackable
instance to buildSlimPropagationTracking
for- Returns:
- the
SlimPropagationTracking
built for the provided instance
-
deepCloneFieldOverrides
@Nullable protected List<FieldOverride> deepCloneFieldOverrides(@Nullable List<FieldOverride> fieldOverrides) Deep cloning is important, as propagation-related flows often directly mutate the original values inTracking
. Since we intend to capture the original values as-is, deep-copying offers protection against downstream mutation.- Parameters:
fieldOverrides
- the list to deep-clone- Returns:
- the deep-cloned list
-
isCatalogChangeAnOverride
public boolean isCatalogChangeAnOverride(@Nullable SlimPropagationTracking originalTracking, Trackable updated) Given the original and updated states of a catalog-discriminated change, determine whether the update is an override.- Parameters:
originalTracking
- the original tracking informationupdated
- the updated instance- Returns:
- true if the change is an override, false otherwise
-
isCatalogChangeATenantOverride
protected boolean isCatalogChangeATenantOverride(@NonNull Trackable updated, @NonNull SlimPropagationTracking originalTracking) Determines if a catalog-discriminated entity change is a tenant override of an existing instance.- Parameters:
updated
- the updated catalog-discriminated entityoriginalTracking
- tracking details from the original entity being targeted for an update- Returns:
- true if
changed
should be considered a tenant-level catalog override, false otherwise
-
isCatalogChangeAnApplicationOverride
protected boolean isCatalogChangeAnApplicationOverride(@NonNull Trackable updated, @NonNull SlimPropagationTracking originalTracking) Determines if a catalog-discriminated entity change is an application override of an existing instance.- Parameters:
updated
- the updated catalog-discriminated entityoriginalTracking
- tracking details from the original entity being targeted for an update- Returns:
- true if
changed
should be considered an application override, false otherwise
-
isCatalogChangeAnOverride
Given the original and updated states of a catalog-discriminated change, determine whether the update is an override.- Parameters:
original
- the original instanceupdated
- the updated instance- Returns:
- true if the change is an override, false otherwise
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getCloneMapper
protected org.modelmapper.ModelMapper getCloneMapper()
-