Class EmptyInventoryProvider

  • All Implemented Interfaces:
    InventoryProvider

    public class EmptyInventoryProvider
    extends Object
    implements InventoryProvider
    This is an "empty" or "pass-through" Inventory Provider. By Default, it does nothing. Some implementors will want this as they either don't need to do inventory checks or have different requirements about how or when to reserve inventory.
    Author:
    Chad Harchar (charchar)
    See Also:
    InventoryProvider, ExternalInventoryProvider
    • Constructor Detail

      • EmptyInventoryProvider

        public EmptyInventoryProvider()
    • Method Detail

      • reserveInventory

        public void reserveInventory​(@NonNull
                                     @NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
                                     @Nullable
                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: InventoryProvider
        Decrement or otherwise "reserve" inventory for a cart during checkout.
        Specified by:
        reserveInventory in interface InventoryProvider
        Parameters:
        cart - The cart for which to decrement inventory.
        contextInfo - Context information around sandbox and multitenant state.
      • isInventoryAvailable

        public boolean isInventoryAvailable​(String skuCode,
                                            int quantity,
                                            @Nullable
                                            com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: InventoryProvider
        Determines whether Inventory is available for a particular SKU.
        Specified by:
        isInventoryAvailable in interface InventoryProvider
        Parameters:
        skuCode - the sku code for which to check inventory availability
        quantity - the quantity of the sku code that will be requested
        contextInfo - context information surrounding sandboxing and multitenant state
        Returns:
        true if inventory is available for the SKU and quantity, false otherwise
      • isInventoryAvailable

        public Map<String,​Boolean> isInventoryAvailable​(Map<String,​Integer> skuCodesAndQuantity,
                                                              @Nullable
                                                              com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: InventoryProvider
        Determines whether Inventory is available for a list of SKUs.

        By default, if the SKU is available for one of the SKU locations or vendors, then it's considered available overall.

        Use InventoryProvider.getInventorySummariesBySku(Map, ContextInfo) for custom logic on SKU inventory availability.

        Specified by:
        isInventoryAvailable in interface InventoryProvider
        Parameters:
        skuCodesAndQuantity - a map of the sku codes and quantity for which to check inventory availability
        contextInfo - context information surrounding sandboxing and multitenant state
        Returns:
        a map of the sku code with true if inventory is available for the SKU and quantity, and false otherwise