Class EmptyInventoryProvider
java.lang.Object
com.broadleafcommerce.cartoperation.service.provider.EmptyInventoryProvider
- All Implemented Interfaces:
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetInventorySummariesBySku(Map<String, Integer> skuCodesWithQuantity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets a map ofSkuInventoryAvailabilitySummariesby SKU.booleanisInventoryAvailable(@NonNull InventoryAvailabilityRequest inventoryAvailabilityRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines whether Inventory is available for a particular catalog item.isInventoryAvailable(@NonNull List<InventoryAvailabilityRequest> inventoryAvailabilityRequests, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines whether Inventory is available for a list of catalog items.booleanisInventoryAvailable(String skuCode, int quantity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines whether Inventory is available for a particular SKU.isInventoryAvailable(Map<String, Integer> skuCodesAndQuantity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines whether Inventory is available for a list of SKUs.voidreserveInventory(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Decrement or otherwise "reserve" inventory for a cart during checkout.voidsoftReserveInventory(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> itemsToReserve, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform a soft reservation on a specific item.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.cartoperation.service.provider.InventoryProvider
releaseSoftReservations
-
Constructor Details
-
EmptyInventoryProvider
public EmptyInventoryProvider()
-
-
Method Details
-
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:InventoryProviderDecrement or otherwise "reserve" inventory for a cart during checkout.- Specified by:
reserveInventoryin interfaceInventoryProvider- Parameters:
cart- The cart for which to decrement inventory.contextInfo- Context information around sandbox and multitenant state.
-
isInventoryAvailable
public boolean isInventoryAvailable(@NonNull @NonNull InventoryAvailabilityRequest inventoryAvailabilityRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryProviderDetermines whether Inventory is available for a particular catalog item.- Specified by:
isInventoryAvailablein interfaceInventoryProvider- Parameters:
inventoryAvailabilityRequest- the catalog item for which to check inventory availabilitycontextInfo- context information surrounding sandboxing and multitenant state- Returns:
trueif inventory is available for the catalog item and quantity,falseotherwise
-
isInventoryAvailable
public Map<String,Boolean> isInventoryAvailable(@NonNull @NonNull List<InventoryAvailabilityRequest> inventoryAvailabilityRequests, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryProviderDetermines whether Inventory is available for a list of catalog items.By default, if the catalog item 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:
isInventoryAvailablein interfaceInventoryProvider- Parameters:
inventoryAvailabilityRequests- a list ofinventory requestsfor which to check inventory availabilitycontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a map of the sku code with
trueif inventory is available for the SKU and quantity, andfalseotherwise
-
isInventoryAvailable
public boolean isInventoryAvailable(String skuCode, int quantity, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryProviderDetermines whether Inventory is available for a particular SKU.- Specified by:
isInventoryAvailablein interfaceInventoryProvider- Parameters:
skuCode- the sku code for which to check inventory availabilityquantity- the quantity of the sku code that will be requestedcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
trueif inventory is available for the SKU and quantity,falseotherwise
-
isInventoryAvailable
public Map<String,Boolean> isInventoryAvailable(Map<String, Integer> skuCodesAndQuantity, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryProviderDetermines 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:
isInventoryAvailablein interfaceInventoryProvider- Parameters:
skuCodesAndQuantity- a map of the sku codes and quantity for which to check inventory availabilitycontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a map of the sku code with
trueif inventory is available for the SKU and quantity, andfalseotherwise
-
getInventorySummariesBySku
public Map<String,List<SkuInventoryAvailabilitySummary>> getInventorySummariesBySku(Map<String, Integer> skuCodesWithQuantity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryProviderGets a map ofSkuInventoryAvailabilitySummariesby SKU.There can be multiple
SkuInventoryAvailabilitySummariesfor one SKU, if there are SKU inventories set up at multiple inventory locations or vendors.This is useful for custom SKU inventory availability logic.
- Specified by:
getInventorySummariesBySkuin interfaceInventoryProvider- Parameters:
skuCodesWithQuantity- a map of the sku codes and quantity for which to check inventory availabilitycontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a map of
SkuInventoryAvailabilitySummariesby SKU
-
softReserveInventory
public void softReserveInventory(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> itemsToReserve, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:InventoryProviderPerform a soft reservation on a specific item. Intended to be used if an item has an "Add to Cart" reservation strategy- Specified by:
softReserveInventoryin interfaceInventoryProvideritemsToReserve- The items added to the cart to be soft reservedcontextInfo- Context information around sandbox and multitenant state.
-