Class PropagationHelperUtility

java.lang.Object
com.broadleafcommerce.data.tracking.core.transition.PropagationHelperUtility

public class PropagationHelperUtility extends Object
Functionality supporting propagation operations such as those in PropagationIntegrator.
  • 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 a SlimPropagationTracking for each of the provided Trackable instances.
      Parameters:
      trackablesById - a map of context IDs to Trackable instances to build SlimPropagationTracking for
      Returns:
      a map of context IDs to SlimPropagationTracking instances
    • buildSlimPropagationTracking

      public SlimPropagationTracking buildSlimPropagationTracking(Trackable trackable)
      Builds a SlimPropagationTracking for the provided Trackable instance.
      Parameters:
      trackable - the Trackable instance to build SlimPropagationTracking 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 in Tracking. 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 information
      updated - 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 entity
      originalTracking - 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 entity
      originalTracking - tracking details from the original entity being targeted for an update
      Returns:
      true if changed should be considered an application override, false otherwise
    • isCatalogChangeAnOverride

      public boolean isCatalogChangeAnOverride(@Nullable Trackable original, Trackable updated)
      Given the original and updated states of a catalog-discriminated change, determine whether the update is an override.
      Parameters:
      original - the original instance
      updated - 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()