public interface ContextualInventoryService extends InventoryService
InventoryService but with optional, additional context information. This context
can then be passed on to an InventoryServiceExtensionHandlerInventoryService},
InventoryServiceExtensionHandler},
CheckAvailabilityActivity},
DecrementInventoryActivity}| Modifier and Type | Field and Description |
|---|---|
static String |
CHANGE_ORDER_KEY
Used as a key in the context map methods below.
|
static String |
ORDER_KEY
Used as a key in the context map methods below.
|
static String |
ROLLBACK_STATE_KEY
Used as a key in the context map methods below.
|
| Modifier and Type | Method and Description |
|---|---|
Map<Sku,Integer> |
buildSkuInventoryMap(Order order)
Convenience method to build the sku inventory map given an
Order |
void |
decrementInventory(Map<Sku,Integer> skuQuantities,
Map<String,Object> context)
Usually invoked from
DecrementInventoryActivity |
void |
decrementInventory(Sku sku,
int quantity,
Map<String,Object> context)
Pass through for
decrementInventory(Map, Map) |
void |
incrementInventory(Map<Sku,Integer> skuQuantities,
Map<String,Object> context)
Callers that invoke this method directly should check for a
ROLLBACK_STATE_KEY in the given context. |
void |
incrementInventory(Sku sku,
int quantity,
Map<String,Object> context) |
boolean |
isAvailable(Sku sku,
int quantity,
Map<String,Object> context) |
void |
reconcileChangeOrderInventory(Map<Sku,Integer> decrementSkuQuantities,
Map<Sku,Integer> incrementSkuQuantities,
Map<String,Object> context)
Explicit method that defines exactly how to reconcile inventory in the event of a change order.
|
Map<Sku,Integer> |
retrieveQuantitiesAvailable(Collection<Sku> skus,
Map<String,Object> context) |
Integer |
retrieveQuantityAvailable(Sku sku,
Map<String,Object> context) |
checkBasicAvailablility, decrementInventory, decrementInventory, incrementInventory, incrementInventory, isAvailable, retrieveQuantitiesAvailable, retrieveQuantityAvailablestatic final String ORDER_KEY
static final String CHANGE_ORDER_KEY
reconcileChangeOrderInventory(java.util.Map, java.util.Map, java.util.Map) belowstatic final String ROLLBACK_STATE_KEY
DecrementInventoryActivity
and is utilized in the DecrementInventoryRollbackHandler. This can be cast to a MapInteger retrieveQuantityAvailable(Sku sku, Map<String,Object> context)
context - can be null. If not null, this should at least contain the #CART_CONTEXT_KEY#retrieveQuantitiesAvailable(Collection, Map)}Map<Sku,Integer> retrieveQuantitiesAvailable(Collection<Sku> skus, Map<String,Object> context)
context - can be null. If not null, this should at least contain the #CART_CONTEXT_KEY#retrieveQuantitiesAvailable(Collection)}boolean isAvailable(Sku sku, int quantity, Map<String,Object> context)
context - can be null. If not null, this should at least contain the #CART_CONTEXT_KEY#isAvailable(Sku, int)}void decrementInventory(Sku sku, int quantity, Map<String,Object> context) throws InventoryUnavailableException
Pass through for decrementInventory(Map, Map)
InventoryUnavailableException#decrementInventory(Map, Map)}void decrementInventory(Map<Sku,Integer> skuQuantities, Map<String,Object> context) throws InventoryUnavailableException
Usually invoked from DecrementInventoryActivity
Callers that invoke this method directly should check the given context object for a ROLLBACK_STATE_KEY.
This will contain information about what actually happened in terms of decrementing inventory. For implementers of this
interface
Implementers of this method (explicitly those that are utilizing the InventoryServiceExtensionHandler)
should populate a ROLLBACK_STATE_KEY within the given context in order to communicate back to the
caller what actually happened while decrementing inventory so that it can be undone later
context - can be null. If not null, this should at least contain the ORDER_KEY and/or the
ROLLBACK_STATE_KEYInventoryUnavailableException#decrementInventory(Map)}void incrementInventory(Sku sku, int quantity, Map<String,Object> context)
#incrementInventory(Map, Map)}void incrementInventory(Map<Sku,Integer> skuQuantities, Map<String,Object> context)
Callers that invoke this method directly should check for a ROLLBACK_STATE_KEY in the given context.
This will contain information about what actually happened in terms of decrementing inventory
Implementers of this method (explicitly those that are utilizing the InventoryServiceExtensionHandler)
should populate a ROLLBACK_STATE_KEY within the given context in order to communicate back to the
caller what actually happened while decrementing inventory so that it can be undone later
context - can be null. If not null, this should at least contain the ROLLBACK_STATE_KEY#incrementInventory(Map)}void reconcileChangeOrderInventory(Map<Sku,Integer> decrementSkuQuantities, Map<Sku,Integer> incrementSkuQuantities, Map<String,Object> context) throws InventoryUnavailableException
Explicit method that defines exactly how to reconcile inventory in the event of a change order. This usually occurs after an order has been submitted and any inventory changes and reservations/holds have already been committed.
Implementers of this method should assume that the quantities passed in are deltas and represent the changed quantities (either incremented or decremented) from the old order to the newly changed order.
decrementSkuQuantities - - the delta change of sku quantities to decrementincrementSkuQuantities - - the delta change of sku quantities to incrementcontext - InventoryUnavailableExceptionCopyright © 2021. All rights reserved.