java.lang.Object
com.broadleafcommerce.common.dataimport.util.ContextUtil

public final class ContextUtil extends Object
Provides common functionality for processing tracking and context related data on an import.
Author:
Kelly Tisdell (ktisdell)
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    overrideChangeContainerForChildOfEntity(String parentResourceId, Class<?> parentClass, com.broadleafcommerce.data.tracking.core.ChangeContainerOverridable child, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
    Overrides the ChangeContainer on the provided child to align with that of the parent, specified by the ID of the parent and the type (Class) of the parent.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • overrideChangeContainerForChildOfEntity

      public static void overrideChangeContainerForChildOfEntity(String parentResourceId, Class<?> parentClass, com.broadleafcommerce.data.tracking.core.ChangeContainerOverridable child, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
      Overrides the ChangeContainer on the provided child to align with that of the parent, specified by the ID of the parent and the type (Class) of the parent. Variants, Entity Assets, and Category Products are examples of child entities that have parents of Product or Category type.

      The actual change container and sub container names will be determined by the highest level type mapping available. Therefore, if a parent entity is an extension, e.g., MyProduct, the change container name will still be PRODUCT since that is the highest level mapping. Otherwise, it would have been MY_PRODUCT. This ensures consistent behavior across entities and extensions.

      Parameters:
      parentResourceId - the context ID of the parent entity
      parentClass - the type of the parent (e.g. Product.class)
      child - the child entity implementing ChangeContainerOverridable
      typeFactory - a standard TypeFactory