Interface SkuInventoryAdjustmentService<I extends SkuInventory>
-
- All Known Implementing Classes:
DefaultSkuInventoryAdjustmentService
public interface SkuInventoryAdjustmentService<I extends SkuInventory>
This service handles serializing updates to individualSkuInventory
records. This handles business logic associated with incrementing or decrementing inventory based on the type ofInventoryTransaction
being requested. This component may interact directly with aRepository
to ensure that records are locked for update. As a result, this component is typically transactional, and may create a new transaction on every request. Callers are urged to keep track of successfulInventoryTransaction
results to apply a compensating transaction if necessary. The batchId can assist with this.- Author:
- Kelly Tisdell (ktisdell)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<InventoryTransaction>
cancelInventory(Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryAdjustmentRequestItems, String batchId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Perform the cancel of inventory to remove reserved quantity.List<InventoryTransaction>
createHardReservations(Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryReservationRequestItems, String batchId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Hard reservations that represent final inventory reservations.List<InventoryTransaction>
createSoftReservations(Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryReservationRequestItems, String batchId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Soft reservations that represent temporary inventory reservations.List<InventoryTransaction>
createSoftReservations(Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryReservationRequestItems, Map<String,List<InventoryTransaction>> existingSoftReservationsByReference, String batchId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Soft reservations that represent temporary inventory reservations.void
freeSoftReservations(List<InventoryTransaction> softReservations, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Release soft reservations and add back to on-hand quantity.List<InventoryTransaction>
fulfillInventory(Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryAdjustmentRequestItems, String batchId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Perform the fulfillment of inventory to remove reserved quantity and decrement on-hand quantity.List<InventoryTransaction>
returnInventory(Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryAdjustmentRequestItems, String batchId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Perform the return of inventory to add back on-hand quantity.
-
-
-
Method Detail
-
createSoftReservations
List<InventoryTransaction> createSoftReservations(@NonNull Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryReservationRequestItems, @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException
Soft reservations that represent temporary inventory reservations.- Parameters:
skuInventoryReservationRequestItems
- - the key to the map is theSkuInventory
that needs to be updated (pre-determined outside of this method).batchId
- identifier for the current batch of items updating inventorycontextInfo
- the context around sandboxing and multitenant state- Returns:
- the created inventory transactions
- Throws:
InventoryUnavailableException
- if there was insufficient inventory to be reserved
-
createSoftReservations
List<InventoryTransaction> createSoftReservations(@NonNull Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryReservationRequestItems, Map<String,List<InventoryTransaction>> existingSoftReservationsByReference, @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException
Soft reservations that represent temporary inventory reservations.- Parameters:
skuInventoryReservationRequestItems
- - the key to the map is theSkuInventory
that needs to be updated (pre-determined outside of this method).existingSoftReservationsByReference
- the existing soft reservations grouped by reference numberbatchId
- identifier for the current batch of items updating inventorycontextInfo
- the context around sandboxing and multitenant state- Returns:
- the created inventory transactions
- Throws:
InventoryUnavailableException
- if there was insufficient inventory to be reserved
-
createHardReservations
List<InventoryTransaction> createHardReservations(@NonNull Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryReservationRequestItems, @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException
Hard reservations that represent final inventory reservations.- Parameters:
skuInventoryReservationRequestItems
- - the key to the map is theSkuInventory
that needs to be updated (pre-determined outside of this method).batchId
- identifier for the current batch of items updating inventorycontextInfo
- the context around sandboxing and multitenant state- Returns:
- the created inventory transactions
- Throws:
InventoryUnavailableException
- if there was insufficient inventory to be reserved
-
fulfillInventory
List<InventoryTransaction> fulfillInventory(@NonNull Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryAdjustmentRequestItems, @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException, InventoryNotReservedException
Perform the fulfillment of inventory to remove reserved quantity and decrement on-hand quantity.- Parameters:
skuInventoryAdjustmentRequestItems
- - the key to the map is theSkuInventory
that needs to be updated (pre-determined outside of this method).batchId
- identifier for the current batch of items updating inventorycontextInfo
- the context around sandboxing and multitenant state- Returns:
- the created inventory transactions
- Throws:
InventoryUnavailableException
- if there was insufficient inventory reserved or on handInventoryNotReservedException
- if there were not already hard reservations for these inventory items
-
cancelInventory
List<InventoryTransaction> cancelInventory(@NonNull Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryAdjustmentRequestItems, @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException, InventoryNotReservedException
Perform the cancel of inventory to remove reserved quantity.- Parameters:
skuInventoryAdjustmentRequestItems
- - the key to the map is theSkuInventory
that needs to be updated (pre-determined outside of this method).batchId
- identifier for the current batch of items updating inventorycontextInfo
- the context around sandboxing and multitenant state- Returns:
- the created inventory transactions
- Throws:
InventoryUnavailableException
- if there was insufficient inventory reservedInventoryNotReservedException
- if there were not already hard reservations for these inventory items
-
returnInventory
List<InventoryTransaction> returnInventory(@NonNull Map<I,List<SkuInventoryAdjustmentRequestItem>> skuInventoryAdjustmentRequestItems, @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Perform the return of inventory to add back on-hand quantity.- Parameters:
skuInventoryAdjustmentRequestItems
- - the key to the map is theSkuInventory
that needs to be updated (pre-determined outside of this method).batchId
- identifier for the current batch of items updating inventorycontextInfo
- the context around sandboxing and multitenant state- Returns:
- the created inventory transactions
-
freeSoftReservations
void freeSoftReservations(@NonNull List<InventoryTransaction> softReservations, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Release soft reservations and add back to on-hand quantity. Note that this archives the soft reservation in-place, no new inventory transactions are created.- Parameters:
softReservations
- the soft reservations to freecontextInfo
- the context around sandboxing and multitenant state
-
-