Class ProductTagConsolidationContributor

java.lang.Object
com.broadleafcommerce.catalog.service.product.consolidation.ContextualProductConsolidationContributor<ProductTag>
com.broadleafcommerce.catalog.service.product.consolidation.ProductTagConsolidationContributor
All Implemented Interfaces:
ProductConsolidationContributor

public class ProductTagConsolidationContributor extends ContextualProductConsolidationContributor<ProductTag>
Author:
Nathan Moore (nathandmoore)
  • Field Details

  • Constructor Details

    • ProductTagConsolidationContributor

      public ProductTagConsolidationContributor(com.broadleafcommerce.common.extension.TypeFactory typeFactory, ProductTagService<ProductTag> productTagService, com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationEntityService, AdvancedTagService<AdvancedTag> advancedTagService)
  • Method Details

    • shouldConsolidate

      public boolean shouldConsolidate(Set<String> productIds, List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: ProductConsolidationContributor
      Determines whether this contributor should be executed based on the given parameters and context.

      Returns true by default.

      Parameters:
      productIds - the IDs of the products to consolidate
      products - the product in all explicit context states
      inheritanceLines - the catalog inheritance lines top-down from all of the products
      context - context information surrounding sandboxing/multitenant state
    • consolidateProducts

      public void consolidateProducts(Set<String> productIds, List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: ProductConsolidationContributor
      Consolidate products with their related domain and translations. This includes both hydrating Product fields and combining external references like CategoryProduct. Any catalog or sandbox overrides made to external references for non-overridden products will generate new placeholder products to store those overrides.
      Specified by:
      consolidateProducts in interface ProductConsolidationContributor
      Overrides:
      consolidateProducts in class ContextualProductConsolidationContributor<ProductTag>
      Parameters:
      productIds - the IDs of the products to consolidate
      products - the product in all explicit context states
      inheritanceLines - the catalog inheritance lines top-down from all of the products
      context - context information surrounding sandboxing/multitenant state
    • getObjectsToConsolidate

      protected List<ProductTag> getObjectsToConsolidate(@NonNull @NonNull Set<String> productIds, @NonNull @NonNull List<ConsolidatedProduct> products, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from class: ContextualProductConsolidationContributor
      Retrieve the full list of domain objects of this type to be consolidated into the products.
      Specified by:
      getObjectsToConsolidate in class ContextualProductConsolidationContributor<ProductTag>
      Parameters:
      productIds - the IDs of the products to consolidate
      products - the products in all explicit context states
      inheritanceLines - the catalog inheritance lines top-down from all of the products
      context - context information surrounding sandboxing/multitenant state
      Returns:
      all domain objects of this type to consolidate into the products
    • productIdGetter

      protected Function<ProductTag,String> productIdGetter()
      Description copied from class: ContextualProductConsolidationContributor
      Defines the function which retrieves the Product ID from the domain object to consolidate, in order to group it with the appropriate product for processing.
      Specified by:
      productIdGetter in class ContextualProductConsolidationContributor<ProductTag>
      Returns:
      function to retrieve Product ID of the domain object
    • setter

      Description copied from class: ContextualProductConsolidationContributor
      Defines the function which should be used to set the domain objects on the consolidated product.
      Specified by:
      setter in class ContextualProductConsolidationContributor<ProductTag>
      Returns:
      function to set domain objects on the consolidated product
    • setTags

      protected void setTags(@NonNull @NonNull ConsolidatedProduct product, @NonNull @NonNull List<? extends ProductTag> productTags)
    • getAdvancedTags

      protected List<AdvancedTagRef> getAdvancedTags(@NonNull @NonNull Collection<? extends ProductTag> productTags)
    • getSearchableAdvancedTags

      protected List<AdvancedTagRef> getSearchableAdvancedTags(@NonNull @NonNull Collection<? extends ProductTag> productTags)
    • getTranslations

      protected List<com.broadleafcommerce.translation.domain.Translation> getTranslations(List<String> entityIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • idGetter

      protected Function<ProductTag,String> idGetter()
      Description copied from class: ContextualProductConsolidationContributor
      Defines the function which retrieves the contextId of the domain object in order to recognize it in different contexts.
      Specified by:
      idGetter in class ContextualProductConsolidationContributor<ProductTag>
      Returns:
      function to retrieve contextId of the domain object
    • getProductTagService

      protected ProductTagService<ProductTag> getProductTagService()
    • getAdvancedTagService

      protected AdvancedTagService<AdvancedTag> getAdvancedTagService()
    • getTranslationEntityService

      protected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> getTranslationEntityService()