Class BreadcrumbsProductDetailsContributor

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

public class BreadcrumbsProductDetailsContributor extends Object implements ProductDetailsContributor
This contributor is responsible for the ProductDetails' breadcrumbs.
Author:
Nathan Moore (nathandmoore), Samarth Dhruva (samarthd)
  • Field Details

  • Constructor Details

  • Method Details

    • getOrder

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

      public <D extends ProductDetails, C extends ProductDetailsContext> Collection<D> contribute(@NonNull @NonNull Collection<D> productDetailsList, @NonNull @NonNull Collection<C> productDetailsContexts, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ProductDetailsContributor
      Contributes to the supplied ProductDetails. This should not mutate the inputted details, but return a new one with the new contributions.
      Specified by:
      contribute in interface ProductDetailsContributor
      Parameters:
      productDetailsList - The details to which to contribute
      productDetailsContexts - The context containing information that may be important for contributors such as active price lists.
      contextInfo - context information surrounding sandboxing/multitenant state
      Returns:
      An version of the supplied ProductDetails with the new contributions.
    • getPrimaryCategoryAncestryByProductId

      protected Map<String,CategoryAncestorList> getPrimaryCategoryAncestryByProductId(Set<String> productIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Given a collection of product ids, finds the primary category of each product along with that category's ancestors.
      Parameters:
      productIds - the ids of products whose primary category and ancestors should be found
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      a map from product id to a CategoryAncestorList object containing its primary category and that category's ancestors. If a product did not have a designated primary category, the referenced category was not found in the data store, or there was an error fetching the category's ancestry, there will not be an entry for it in the result map.
    • getPrimaryCategoryIdsByProductId

      protected Map<String,String> getPrimaryCategoryIdsByProductId(Set<String> productIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Given a collection of product ids, finds the id of the primary category for each product.
      Parameters:
      productIds - the ids of products whose primary category id should be found in the data store
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      a map from product id to the id of its primary category. If a product did not have a designated primary category, there will not be an entry for it in the result map.
    • getAncestriesByCategoryId

      protected Map<String,CategoryAncestorList> getAncestriesByCategoryId(Collection<String> categoryIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Given a collection of category ids, finds those categories and their entire ancestries in the data store.
      Parameters:
      categoryIds - the ids of categories to find (along with their ancestors)
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      a map from category id to a CategoryAncestorList object containing the hydrated category itself and its ancestors. If a category was not found in the data store or there was an error fetching its ancestry, there will not be an entry for it in the result map.
      See Also:
    • buildBreadcrumbsForProductWithPrimaryCategory

      protected List<Breadcrumb> buildBreadcrumbsForProductWithPrimaryCategory(@NonNull @NonNull ProductDetails product, @NonNull @NonNull CategoryAncestorList primaryCategoryAndAncestry)
      Generates the expected list of Breadcrumbs for a product which was found to have a primary category.
      Parameters:
      product - the product for which breadcrumbs are being created
      primaryCategoryAndAncestry - the primary category of the product along with its ancestors
      Returns:
      a list of breadcrumbs starting with the top-level category ancestor and ending with the primary category followed by the product itself
    • createCrumbForProduct

      protected final Breadcrumb createCrumbForProduct(ProductDetails product)
    • createCrumbForCategory

      protected final Breadcrumb createCrumbForCategory(Category ancestor)
    • getCategoryProductService

      protected CategoryProductService<CategoryProduct> getCategoryProductService()
    • getCategoryService

      protected CategoryService<Category> getCategoryService()
    • getCategoryAncestryHydrationService

      protected CategoryAncestryHydrationService getCategoryAncestryHydrationService()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
    • getCacheStateManager

      @Nullable protected com.broadleafcommerce.common.extension.cache.CacheStateManager getCacheStateManager()
    • setCacheByBreadcrumbProductContributionKeyGen

      @Autowired @Qualifier("catalogCacheByBreadcrumbProductContribution") public void setCacheByBreadcrumbProductContributionKeyGen(@Nullable com.broadleafcommerce.common.extension.cache.key.ContextKeyGen cacheByBreadcrumbProductContributionKeyGen)
      See Also:
    • getCacheByBreadcrumbProductContributionKeyGen

      @Nullable protected com.broadleafcommerce.common.extension.cache.key.ContextKeyGen getCacheByBreadcrumbProductContributionKeyGen()
      See Also: