Class DefaultProductConsolidationService

java.lang.Object
com.broadleafcommerce.catalog.service.product.consolidation.DefaultProductConsolidationService
All Implemented Interfaces:
ProductConsolidationService

public class DefaultProductConsolidationService extends Object implements ProductConsolidationService
  • Field Details

  • Constructor Details

    • DefaultProductConsolidationService

      public DefaultProductConsolidationService(List<ProductConsolidationContributor> productConsolidationContributors, ProductService<Product> productSvc, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> catalogService, @Nullable com.broadleafcommerce.data.tracking.core.marketplace.service.CommonMarketplaceApplicationCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.MarketplaceApplicationCatalog> marketplaceApplicationCatalogService, cz.jirutka.rsql.parser.RSQLParser rsqlParser)
  • Method Details

    • readAllConsolidatedProducts

      public List<ConsolidatedProduct> readAllConsolidatedProducts(@NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: ProductConsolidationService
      Read and consolidate products with their related domain.
      Specified by:
      readAllConsolidatedProducts in interface ProductConsolidationService
      Parameters:
      filters - the RSQL Node used to restrict results, must not be null
      context - context information around sandboxing and multitenant state
      Returns:
      list of products consolidated with relations
    • getBaseCatalogIds

      protected Set<String> getBaseCatalogIds(List<Product> products)
    • getOverrideCatalogIds

      protected Set<String> getOverrideCatalogIds(List<Product> products)
    • consolidateProducts

      protected List<ConsolidatedProduct> consolidateProducts(List<Product> products, com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, Map<String,com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> catalogsById, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      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.
      Parameters:
      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:
      A list of products combined with all relations including every overridden state
    • processSandboxOwner

      protected void processSandboxOwner(ConsolidatedProduct product)
      Populate the sandbox owner of the product, if in a user sandbox context.
      Parameters:
      product - the ConsolidatedProduct on which to populate the sandbox owner
    • processVendorRef

      protected void processVendorRef(ConsolidatedProduct consolidatedProduct, Map<String,com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> catalogsById)
      Populate the vendor ref from the Product's catalog.
      Parameters:
      consolidatedProduct - the ConsolidatedProduct on which to populate the vendor ref
      catalogsById - the map of the catalogs with the catalog id as a key
    • readMarketplaceApplicationsForCatalogs

      protected Map<String,Set<String>> readMarketplaceApplicationsForCatalogs(Set<String> catalogs, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • createPostProcessor

      protected ConsolidatedProductPostProcessor createPostProcessor(List<ConsolidatedProduct> products, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, Map<String,Set<String>> marketplaceApplicationsForCatalogs)
    • getProductConsolidationContributors

      protected List<ProductConsolidationContributor> getProductConsolidationContributors()
    • getProductSvc

      protected ProductService<Product> getProductSvc()
    • getTypeFactory

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

      protected com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> getCatalogService()
    • getMarketplaceApplicationCatalogService

      @Nullable protected com.broadleafcommerce.data.tracking.core.marketplace.service.CommonMarketplaceApplicationCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.MarketplaceApplicationCatalog> getMarketplaceApplicationCatalogService()
    • getRsqlParser

      protected cz.jirutka.rsql.parser.RSQLParser getRsqlParser()