@Service(value="blAdvancedInventoryService") public class AdvancedInventoryServiceImpl extends org.broadleafcommerce.core.inventory.service.InventoryServiceImpl implements AdvancedInventoryService
| Modifier and Type | Field and Description |
|---|---|
protected org.broadleafcommerce.common.persistence.EntityConfiguration |
entityConfiguration |
protected FulfillmentLocationService |
fulfillmentLocationService |
protected AdvancedInventoryDao |
inventoryDao |
| Constructor and Description |
|---|
AdvancedInventoryServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected Inventory |
createInventoryRecord(UpdateInventoryInfo info,
FulfillmentLocation location)
Creates an Inventory record for the given fulfillment location and is based on the given UpdateInventoryInfo record
|
protected void |
decrementInventory(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory,
List<InventoryReservation> reservations,
boolean useQtyOnHand) |
void |
decrementInventoryFromLocations(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory)
Subtracts the quantity from available inventory for each sku in the map for the given fulfillment location.
|
void |
decrementInventoryFromLocations(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory,
List<InventoryReservation> reservations)
The same as
AdvancedInventoryService.decrementInventoryFromLocations(Map) except that this will also persist the given reservations
so that everything can be apart of a single transaction |
void |
decrementInventoryOnHand(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory)
Subtracts the quantity from inventory on hand for each sku in the map for the given fulfillment location.
|
void |
deleteReservation(InventoryReservation reservation)
Deletes the reservation from the system
|
Inventory |
findInventory(org.broadleafcommerce.core.catalog.domain.Sku sku)
Retrieves inventory for this sku at the default fulfillment location.
|
Inventory |
findInventory(org.broadleafcommerce.core.catalog.domain.Sku sku,
FulfillmentLocation fulfillmentLocation)
|
List<Inventory> |
findInventoryAcrossFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku)
Gets the list of inventory across all
FulfillmentLocations for the given sku |
List<Inventory> |
findInventoryAcrossFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku,
org.broadleafcommerce.core.order.service.type.FulfillmentType fulfillmentType)
|
int |
findInventoryCountAcrossFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku)
Counts the quantity available across all
FulfillmentLocations |
int |
findInventoryCountAcrossFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku,
org.broadleafcommerce.core.order.service.type.FulfillmentType fulfillmentType)
Counts the quantity available across all
FulfillmentLocations for the given FulfillmentType |
int |
findInventoryCountInFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku,
List<FulfillmentLocation> locations)
Counts the quantity available across the given set of locations for a given sku
|
List<Inventory> |
findInventoryForFulfillmentLocation(FulfillmentLocation fulfillmentLocation)
Retrieves all instances of Inventory for this fulfillmentLocation
|
int |
findMaxInventoryAcrossFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku)
Gets the maximum quantity available in a single
FulfillmentLocation for the given sku across all
FulfillmentLocations |
int |
findMaxInventoryInFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku,
List<FulfillmentLocation> locations)
Gets the maximum quantity available in a single
FulfillmentLocation for the given sku filtered by the
list of given locations |
protected void |
handleNegativeInventory(Map<Long,Integer> unavailableInventoryHolder,
org.broadleafcommerce.core.catalog.domain.Sku sku,
Inventory inventory,
int qtyToUpdate,
int decrementedQuantity,
boolean useQtyOnHand) |
protected void |
handlePositiveInventory(Inventory inventory,
int qtyToUpdate,
int decrementedQuantity,
boolean useQtyOnHand) |
void |
incrementInventoryFromLocations(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory)
Add available inventory to sku.
|
void |
incrementInventoryFromLocations(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory,
List<InventoryReservation> reservations) |
void |
incrementInventoryOnHand(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory)
Add inventory on hand to sku.
|
Map<org.broadleafcommerce.core.catalog.domain.Sku,Boolean> |
isAvailable(org.broadleafcommerce.core.catalog.domain.Product product,
Integer quantity)
Returns a map indicating if the quantity requested is available for each sku associated with the Product in the default fulfillment location.
|
Map<org.broadleafcommerce.core.catalog.domain.Sku,Boolean> |
isAvailable(org.broadleafcommerce.core.catalog.domain.Product product,
Integer quantity,
FulfillmentLocation fulfillmentLocation)
Returns a map indicating whether the quantity requested is available for the specified Product in the fulfillment location.
|
boolean |
isAvailable(org.broadleafcommerce.core.catalog.domain.Sku sku,
Integer quantity,
FulfillmentLocation fulfillmentLocation)
Retrieves whether or not the quantity is available for a sku at a fulfillment location.
|
boolean |
isAvailable(org.broadleafcommerce.core.catalog.domain.Sku sku,
int quantity,
List<FulfillmentLocation> locations)
Determines if quantity is available for the given sku at the given locations
|
boolean |
isAvailableAtDefaultFulfillmentLocation(org.broadleafcommerce.core.catalog.domain.Sku sku,
Integer quantity)
Retrieves whether or not the quantity is available for a sku at the default fulfillment location.
|
boolean |
isSkuEligibleForInventoryCheck(org.broadleafcommerce.core.catalog.domain.Sku sku)
Tests whether an inventory check will be invoked for the given Sku.
|
boolean |
isSkuEligibleForReservation(org.broadleafcommerce.core.catalog.domain.Sku sku)
Tests whether a reservation will be created for a given Sku.
|
Inventory |
save(Inventory inventory)
Persists the inventory
|
InventoryReservation |
saveReservation(InventoryReservation reservation)
Saves the given reservation
|
void |
setInventory(Map<FulfillmentLocation,List<UpdateInventoryInfo>> inventoryInfos)
Sets the on hand and available quantities for a sku at a fulfillment location.
|
protected Inventory |
updateInventoryRecord(UpdateInventoryInfo info,
Inventory inventory)
Given an UpdateInventoryInfo record, updates the related inventory record
|
protected boolean |
validateUpdateInventoryRequest(org.broadleafcommerce.core.catalog.domain.Sku sku,
UpdateInventoryInfo info)
Validates that the Sku and UpdateInventoryInfo objects valid when trying to update/create an inventory record
|
buildSkuInventoryMap, checkBasicAvailablility, checkSkuAvailability, decrementInventory, decrementInventory, decrementInventory, decrementInventory, decrementSku, incrementInventory, incrementInventory, incrementInventory, incrementInventory, incrementSku, invalidateEntity, invalidateSkuInventory, isAvailable, isAvailable, reconcileChangeOrderInventory, retrieveQuantitiesAvailable, retrieveQuantitiesAvailable, retrieveQuantityAvailable, retrieveQuantityAvailableprotected AdvancedInventoryDao inventoryDao
protected FulfillmentLocationService fulfillmentLocationService
protected org.broadleafcommerce.common.persistence.EntityConfiguration entityConfiguration
public boolean isSkuEligibleForInventoryCheck(org.broadleafcommerce.core.catalog.domain.Sku sku)
AdvancedInventoryServiceisSkuEligibleForInventoryCheck in interface AdvancedInventoryServicepublic boolean isSkuEligibleForReservation(org.broadleafcommerce.core.catalog.domain.Sku sku)
AdvancedInventoryServiceisSkuEligibleForReservation in interface AdvancedInventoryServicepublic boolean isAvailableAtDefaultFulfillmentLocation(org.broadleafcommerce.core.catalog.domain.Sku sku,
Integer quantity)
AdvancedInventoryServiceisAvailableAtDefaultFulfillmentLocation in interface AdvancedInventoryServicesku - the skuquantity - the amount for which to check; must be a positive integerpublic boolean isAvailable(org.broadleafcommerce.core.catalog.domain.Sku sku,
Integer quantity,
FulfillmentLocation fulfillmentLocation)
AdvancedInventoryServiceisAvailable in interface AdvancedInventoryServicesku - the skuquantity - the amount for which to check; must be a positive integerfulfillmentLocation - the fulfillment location@Transactional(propagation=REQUIRES_NEW,
value="blTransactionManager",
rollbackFor={org.broadleafcommerce.core.inventory.service.InventoryUnavailableException.class,ConcurrentInventoryModificationException.class})
public void decrementInventoryFromLocations(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory)
throws ConcurrentInventoryModificationException,
org.broadleafcommerce.core.inventory.service.InventoryUnavailableException
AdvancedInventoryServicedecrementInventoryFromLocations in interface AdvancedInventoryServiceskuInventory - a map which contains the quantity of inventory to subtract from available inventory for each skuConcurrentInventoryModificationExceptionorg.broadleafcommerce.core.inventory.service.InventoryUnavailableException@Transactional(propagation=REQUIRES_NEW,
value="blTransactionManager",
rollbackFor={org.broadleafcommerce.core.inventory.service.InventoryUnavailableException.class,ConcurrentInventoryModificationException.class})
public void decrementInventoryFromLocations(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory,
List<InventoryReservation> reservations)
throws ConcurrentInventoryModificationException,
org.broadleafcommerce.core.inventory.service.InventoryUnavailableException
AdvancedInventoryServiceAdvancedInventoryService.decrementInventoryFromLocations(Map) except that this will also persist the given reservations
so that everything can be apart of a single transactiondecrementInventoryFromLocations in interface AdvancedInventoryServiceskuInventory - the inventory map to decrementreservations - optional list of reservations that should be persisted along with the new decremented inventory
valuesConcurrentInventoryModificationExceptionorg.broadleafcommerce.core.inventory.service.InventoryUnavailableExceptionprotected void decrementInventory(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory, List<InventoryReservation> reservations, boolean useQtyOnHand) throws ConcurrentInventoryModificationException, org.broadleafcommerce.core.inventory.service.InventoryUnavailableException
ConcurrentInventoryModificationExceptionorg.broadleafcommerce.core.inventory.service.InventoryUnavailableException@Transactional(propagation=REQUIRES_NEW,
value="blTransactionManager",
rollbackFor={org.broadleafcommerce.core.inventory.service.InventoryUnavailableException.class,ConcurrentInventoryModificationException.class})
public void decrementInventoryOnHand(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory)
throws ConcurrentInventoryModificationException,
org.broadleafcommerce.core.inventory.service.InventoryUnavailableException
AdvancedInventoryServicedecrementInventoryOnHand in interface AdvancedInventoryServiceConcurrentInventoryModificationExceptionorg.broadleafcommerce.core.inventory.service.InventoryUnavailableException@Transactional(propagation=REQUIRES_NEW,
value="blTransactionManager",
rollbackFor={org.broadleafcommerce.core.inventory.service.InventoryUnavailableException.class,ConcurrentInventoryModificationException.class})
public void incrementInventoryFromLocations(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory)
throws ConcurrentInventoryModificationException
AdvancedInventoryServiceIllegalArgumentException.incrementInventoryFromLocations in interface AdvancedInventoryServiceConcurrentInventoryModificationException@Transactional(propagation=REQUIRES_NEW,
value="blTransactionManager",
rollbackFor={org.broadleafcommerce.core.inventory.service.InventoryUnavailableException.class,ConcurrentInventoryModificationException.class})
public void incrementInventoryFromLocations(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory,
List<InventoryReservation> reservations)
throws ConcurrentInventoryModificationException
incrementInventoryFromLocations in interface AdvancedInventoryServiceConcurrentInventoryModificationException@Transactional(propagation=REQUIRES_NEW,
value="blTransactionManager",
rollbackFor={org.broadleafcommerce.core.inventory.service.InventoryUnavailableException.class,ConcurrentInventoryModificationException.class})
public void incrementInventoryOnHand(Map<FulfillmentLocation,Map<org.broadleafcommerce.core.catalog.domain.Sku,Integer>> skuInventory)
throws ConcurrentInventoryModificationException
AdvancedInventoryServiceIllegalArgumentException.incrementInventoryOnHand in interface AdvancedInventoryServiceConcurrentInventoryModificationException@Transactional(propagation=REQUIRES_NEW,
value="blTransactionManager",
rollbackFor={org.broadleafcommerce.core.inventory.service.InventoryUnavailableException.class,ConcurrentInventoryModificationException.class})
public void setInventory(Map<FulfillmentLocation,List<UpdateInventoryInfo>> inventoryInfos)
throws ConcurrentInventoryModificationException
AdvancedInventoryServicesetInventory in interface AdvancedInventoryServiceConcurrentInventoryModificationExceptionprotected boolean validateUpdateInventoryRequest(org.broadleafcommerce.core.catalog.domain.Sku sku,
UpdateInventoryInfo info)
sku - info - protected Inventory updateInventoryRecord(UpdateInventoryInfo info, Inventory inventory) throws ConcurrentInventoryModificationException
info - inventory - ConcurrentInventoryModificationException - If the inventory record was being modified elsewhere after we pulled the record but before we persisted our changesprotected Inventory createInventoryRecord(UpdateInventoryInfo info, FulfillmentLocation location) throws ConcurrentInventoryModificationException
info - location - ConcurrentInventoryModificationException - Only if an inventory record with the same sku/fulfillment location pair was made after we checked if it existed and it didn't and before we persisted our versionpublic Inventory findInventory(org.broadleafcommerce.core.catalog.domain.Sku sku, FulfillmentLocation fulfillmentLocation)
AdvancedInventoryServicefindInventory in interface AdvancedInventoryServicesku - SkufulfillmentLocation - FulfillmentLocationInventorypublic Inventory findInventory(org.broadleafcommerce.core.catalog.domain.Sku sku)
AdvancedInventoryServicefindInventory in interface AdvancedInventoryServicepublic List<Inventory> findInventoryForFulfillmentLocation(FulfillmentLocation fulfillmentLocation)
AdvancedInventoryServicefindInventoryForFulfillmentLocation in interface AdvancedInventoryServiceInventory@Transactional(value="blTransactionManager") public Inventory save(Inventory inventory) throws ConcurrentInventoryModificationException
AdvancedInventoryServicesave in interface AdvancedInventoryServiceConcurrentInventoryModificationExceptionpublic Map<org.broadleafcommerce.core.catalog.domain.Sku,Boolean> isAvailable(org.broadleafcommerce.core.catalog.domain.Product product, Integer quantity)
AdvancedInventoryServiceisAvailable in interface AdvancedInventoryServicepublic Map<org.broadleafcommerce.core.catalog.domain.Sku,Boolean> isAvailable(org.broadleafcommerce.core.catalog.domain.Product product, Integer quantity, FulfillmentLocation fulfillmentLocation)
AdvancedInventoryServiceisAvailable in interface AdvancedInventoryServicepublic int findInventoryCountAcrossFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku)
AdvancedInventoryServiceFulfillmentLocationsfindInventoryCountAcrossFulfillmentLocations in interface AdvancedInventoryServicesku - the Sku to look for inventory forFulfillmentLocations for this Sku#findInventoryAcrossFulfillmentLocations(Sku)}public int findInventoryCountAcrossFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku,
org.broadleafcommerce.core.order.service.type.FulfillmentType fulfillmentType)
AdvancedInventoryServiceFulfillmentLocations for the given FulfillmentTypefindInventoryCountAcrossFulfillmentLocations in interface AdvancedInventoryServicesku - the Sku from the catalog to find inventory forfulfillmentType - restriction on the types of FulfillmentLocations that should be checked for inventoryInventory.getQuantityAvailable() for the given sku within
FulfillmentLocations filtered by the given fulfillmentType#findInventoryAcrossFulfillmentLocations(Sku, FulfillmentType)}public List<Inventory> findInventoryAcrossFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku)
AdvancedInventoryServiceFulfillmentLocations for the given skufindInventoryAcrossFulfillmentLocations in interface AdvancedInventoryServicesku - the Sku to find inventory forInventory for the given sku#findInventoryAcrossFulfillmentLocations(Sku, FulfillmentType)},
#findInventoryCountAcrossFulfillmentLocations(Sku)}public List<Inventory> findInventoryAcrossFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku, org.broadleafcommerce.core.order.service.type.FulfillmentType fulfillmentType)
AdvancedInventoryServicefindInventoryAcrossFulfillmentLocations in interface AdvancedInventoryServicesku - the Sku from the catalog to find inventory forfulfillmentType - (optional) restriction on the types of FulfillmentLocations that should be checked for inventoryInventory records for the given sku within all
FulfillmentLocations filtered by the given fulfillmentType#findInventoryCountAcrossFulfillmentLocations(Sku, FulfillmentType)}public boolean isAvailable(org.broadleafcommerce.core.catalog.domain.Sku sku,
int quantity,
List<FulfillmentLocation> locations)
AdvancedInventoryServiceisAvailable in interface AdvancedInventoryServicesku - the Sku to checkquantity - the quantity that should be verified for availabilitylocations - the locations that should be checked for the given skuInventory.getQuantityAvailable() at any of the given locations is greater than
or equal to the given quantity, false otherwise.#findInventoryCountInFulfillmentLocations(Sku, List)}public int findInventoryCountInFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku,
List<FulfillmentLocation> locations)
AdvancedInventoryServicefindInventoryCountInFulfillmentLocations in interface AdvancedInventoryServicesku - the Sku from the catalog to find inventory forlocations - restriction on the FulfillmentLocations to count inventory forInventory.getQuantityAvailable() across all of the fulfillment locations@Transactional(value="blTransactionManager") public InventoryReservation saveReservation(InventoryReservation reservation)
AdvancedInventoryServicesaveReservation in interface AdvancedInventoryServicereservation - the entity to save@Transactional(value="blTransactionManager") public void deleteReservation(InventoryReservation reservation)
AdvancedInventoryServicedeleteReservation in interface AdvancedInventoryServicereservation - the InventoryReservation to deletepublic int findMaxInventoryAcrossFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku)
AdvancedInventoryServiceFulfillmentLocation for the given sku across all
FulfillmentLocationsfindMaxInventoryAcrossFulfillmentLocations in interface AdvancedInventoryServicesku - the Sku to find inventory forFulfillmentLocations then this will return 0public int findMaxInventoryInFulfillmentLocations(org.broadleafcommerce.core.catalog.domain.Sku sku,
List<FulfillmentLocation> locations)
AdvancedInventoryServiceFulfillmentLocation for the given sku filtered by the
list of given locationsfindMaxInventoryInFulfillmentLocations in interface AdvancedInventoryServicesku - the Sku to find inventory forlocations - a subset of FulfillmentLocations to look for inventoryprotected void handleNegativeInventory(Map<Long,Integer> unavailableInventoryHolder, org.broadleafcommerce.core.catalog.domain.Sku sku, Inventory inventory, int qtyToUpdate, int decrementedQuantity, boolean useQtyOnHand) throws ConcurrentInventoryModificationException
protected void handlePositiveInventory(Inventory inventory, int qtyToUpdate, int decrementedQuantity, boolean useQtyOnHand) throws ConcurrentInventoryModificationException
Copyright © 2020. All rights reserved.