Class DefaultInventoryAvailabilityIndexService

java.lang.Object
com.broadleafcommerce.catalogbrowse.service.DefaultInventoryAvailabilityIndexService
All Implemented Interfaces:
InventoryAvailabilityIndexService

public class DefaultInventoryAvailabilityIndexService extends Object implements InventoryAvailabilityIndexService
Default implementation of InventoryAvailabilityIndexService.
Since:
Catalog Browse Service 2.2.0, Release Train 2.3.0
Author:
Susana Cruz (susanacruz)
  • Constructor Details

    • DefaultInventoryAvailabilityIndexService

      public DefaultInventoryAvailabilityIndexService(CatalogProvider browseCatalogProvider, InventoryProvider inventoryProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • buildProductAvailabilityIndex

      public ProductAvailabilityIndex buildProductAvailabilityIndex(@NonNull String productId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: InventoryAvailabilityIndexService
      Constructs a ProductAvailabilityIndex for a given product by gathering relevant variants and their associated inventory availability details. The index is intended to optimize payload size and improve performance, especially when dealing with products having multiple variants.
      Specified by:
      buildProductAvailabilityIndex in interface InventoryAvailabilityIndexService
      Parameters:
      productId - the unique identifier of the product for which the availability index is built
      contextInfo - additional context information (such as sandbox or multitenant details) relevant to the operation
      Returns:
      a ProductAvailabilityIndex containing the related variants and their inventory availability details
    • getLiteVariantsWithAvailability

      public Map<String,VariantAvailabilityInfo> getLiteVariantsWithAvailability(@NonNull String productId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: InventoryAvailabilityIndexService
      Fetches the LiteVariants for a given productId and then fetches their inventory availability using a grouping of their SKUs. The result is hydrated onto each corresponding LiteVariant.
      Specified by:
      getLiteVariantsWithAvailability in interface InventoryAvailabilityIndexService
      Parameters:
      productId - the productId to find variants for
      contextInfo - context information around sandbox and multitenant state
      Returns:
      the LiteVariants with their inventory availability
    • getVariantAvailabilityInfo

      protected VariantAvailabilityInfo getVariantAvailabilityInfo(LiteVariant variant)
    • buildOptionValuesKey

      protected String buildOptionValuesKey(Map<String,String> optionValues)
      Builds a key representative of the LiteVariant.getOptionValues(). By default, the key is built by joining every option value in alphabetical order.
    • getBrowseCatalogProvider

      protected CatalogProvider getBrowseCatalogProvider()
    • getInventoryProvider

      protected InventoryProvider getInventoryProvider()
    • getTypeFactory

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