Class RelatedDataDrivenEnumsProductContextContributor

java.lang.Object
com.broadleafcommerce.catalog.service.product.commerce.context.contributor.RelatedDataDrivenEnumsProductContextContributor
All Implemented Interfaces:
ProductDetailsContextContributor, org.springframework.core.Ordered

public class RelatedDataDrivenEnumsProductContextContributor extends Object implements ProductDetailsContextContributor
Contributes all of the related DataDrivenEnums to the ProductDetailsContext.
Author:
Sunny Yu
  • Field Details

  • Constructor Details

  • Method Details

    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • contribute

      public <T extends ProductDetailsContext> Collection<T> contribute(@NonNull @NonNull Collection<T> productDetailsContexts, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ProductDetailsContextContributor
      Contributes to the supplied ProductDetailsContext. This should not mutate the inputted context, but return a new one with the new contributions.
      Specified by:
      contribute in interface ProductDetailsContextContributor
      Parameters:
      productDetailsContexts - The contexts to which to contribute
      contextInfo - context information surrounding sandboxing/multitenant state
      Returns:
      A version of the supplied ProductDetailsContext with the new contributions.
    • getDataDrivenEnumIdsByProductId

      protected Map<String,Set<String>> getDataDrivenEnumIdsByProductId(@NonNull @NonNull Collection<? extends ProductDetailsContext> productDetailsContexts)
      Gets a set of referenced data driven enum ids mapped by the resolved product id.
      Parameters:
      productDetailsContexts - a collection of ProductDetailsContext to get the resolved product and its referenced data driven enums from
      Returns:
      a set of referenced data driven enum ids mapped by the resolved product id
    • addDataDrivenEnumIdsForProduct

      protected void addDataDrivenEnumIdsForProduct(Product product, Map<String,Set<String>> enumIdsByProductId)
    • addDataDrivenEnumIdByProductId

      protected void addDataDrivenEnumIdByProductId(@Nullable DataDrivenEnum dataDrivenEnum, String productId, Map<String,Set<String>> enumIdsByProductId)
    • setDataDrivenEnums

      protected void setDataDrivenEnums(@NonNull @NonNull Collection<? extends ProductDetailsContext> productDetailsContexts, List<DataDrivenEnum> dataDrivenEnumsForAllProducts, Map<String,Set<String>> enumIdsByProductId)
    • getDataDrivenEnumService

      protected DataDrivenEnumService<DataDrivenEnum> getDataDrivenEnumService()