Class DefaultSkuInventoryAdjustmentService<I extends SkuInventory>
java.lang.Object
com.broadleafcommerce.inventory.service.DefaultSkuInventoryAdjustmentService<I>
- All Implemented Interfaces:
SkuInventoryAdjustmentService<I>
@Transactional(transactionManager="inventoryTransactionManager",
rollbackFor={InventoryUnavailableException.class,InventoryNotReservedException.class},
propagation=REQUIRES_NEW)
public class DefaultSkuInventoryAdjustmentService<I extends SkuInventory>
extends Object
implements SkuInventoryAdjustmentService<I>
This component is responsible for reading, locking, and adjusting
SkuInventory records,
as well as for creating hard and soft inventory reservations. This component is also responsible
for other types of InventoryTransactionTypes and for the adjustment of SkuInventory
records for those as well.- Author:
- Kelly Tisdell (ktisdell)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSkuInventoryAdjustmentService(SkuInventoryRepository<com.broadleafcommerce.data.tracking.core.Trackable> skuInventoryRepository, InventoryTransactionService<InventoryTransaction> inventoryTransactionService, com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager domainMapperManager, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, com.broadleafcommerce.common.extension.TypeFactory typeFactory, StockChangeNotificationService stockChangeNotificationService) -
Method Summary
Modifier and TypeMethodDescriptionprotected InventoryTransactionbuildInventoryTransaction(int quantity, InventoryTransactionType type, String reference, String skuInventoryId, String batchId, Instant dateProcessed) protected intcalculateQuantityAvailable(SkuInventory inventory) Deprecated.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.convertSkuInventoryFromPersistentDomain(Iterable<com.broadleafcommerce.data.tracking.core.Trackable> iterable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected InventoryTransactioncreateCancelledTransaction(@NonNull SkuInventory inventory, int quantity, @NonNull String referenceNumber, @NonNull String batchId) Builds a cancelledInventoryTransactionand adjusts theSkuInventoryquantities.protected InventoryTransactioncreateFulfilledTransaction(@NonNull SkuInventory inventory, int quantity, @NonNull String referenceNumber, @NonNull String batchId) Builds a fulfilledInventoryTransactionand adjusts theSkuInventoryquantities.protected InventoryTransactioncreateHardReservation(@NonNull SkuInventory inventory, InventoryTransaction softTransaction, @NonNull Integer quantityRequested, @NonNull String referenceNumber, @NonNull String batchId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hard inventory reservation.createHardReservations(Map<I, List<SkuInventoryAdjustmentRequestItem>> skuInventoryReservationRequestItems, String batchId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hard reservations that represent final inventory reservations.protected InventoryTransactioncreateOrUpdateInventoryTransaction(InventoryTransaction inventoryTransaction, InventoryTransaction existingSoftReservation, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Create an inventory transaction, or update an existing transaction if a previous soft transaction existsprotected InventoryTransactioncreateReturnedTransaction(@NonNull SkuInventory inventory, int quantity, @NonNull String referenceNumber, @NonNull String batchId) Builds a returnedInventoryTransactionand adjusts theSkuInventoryquantities.protected InventoryTransactioncreateSoftReservation(@NonNull SkuInventory inventory, @NonNull Integer quantityRequested, @NonNull String referenceNumber, @NonNull String batchId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Soft inventory reservation.createSoftReservations(Map<I, List<SkuInventoryAdjustmentRequestItem>> skuInventoryReservationRequestItems, String batchId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Soft reservations that represent temporary inventory reservations.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.protected voiddeleteInventoryTransaction(InventoryTransaction transaction, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Convenience method for deleting (archiving) an inventory transaction.protected InventoryTransactionfreeSoftReservationQuantity(InventoryTransaction softReservation, SkuInventory skuInventory) Adjusts the SKU inventory quantities to reflect a soft inventory reservation being released (back to the available pool).voidfreeSoftReservations(List<InventoryTransaction> softReservations, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Release soft reservations and add back to on-hand quantity.fulfillInventory(@NonNull Map<I, List<SkuInventoryAdjustmentRequestItem>> skuInventoryAdjustmentRequestItems, @NonNull String batchId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Perform the fulfillment of inventory to remove reserved quantity and decrement on-hand quantity.protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManagerprotected Map<String,List<InventoryTransaction>> getExistingReservationsByReferences(List<String> referenceNumbers, Set<String> transactionTypesToRead, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected InventoryTransactionService<InventoryTransaction>protected Comparator<SkuInventory>protected SkuInventoryRepository<com.broadleafcommerce.data.tracking.core.Trackable>protected StockChangeNotificationServiceprotected com.broadleafcommerce.common.extension.TypeFactoryprotected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManagerprotected booleanhasExistingReservations(List<InventoryTransaction> transactions) protected InventoryUnavailableExceptioninventoryUnavailableException(SkuInventory inventory, SkuInventoryAdjustmentRequestItem item, InventoryTransactionType transactionType, String reason) protected Map<String,List<InventoryTransaction>> readExistingTransactionsForItemByType(SkuInventoryAdjustmentRequestItem item, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) readOptionalSkuInventory(@NonNull String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected IreadSkuInventory(@NonNull String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) 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.protected List<InventoryTransaction>saveInventoryTransactions(List<InventoryTransaction> transactions, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) saveSkuInventories(Collection<I> inventories, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected intsumQuantityForTransactionType(Map<String, List<InventoryTransaction>> transactionsByType, InventoryTransactionType type) protected List<InventoryTransaction>updateInventoryTransactions(List<com.broadleafcommerce.data.tracking.core.service.Update<InventoryTransaction>> transactions, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidupdateSkuInventoryQuantityReservation(@NonNull SkuInventory inventory, @NonNull Integer quantityRequested) protected List<com.broadleafcommerce.data.tracking.core.service.Update<InventoryTransaction>>updateSoftReservationTransactionAndInventory(@NonNull List<InventoryTransaction> inventoryTransactions, @NonNull Map<String, I> refreshedInventories, @NonNull SkuInventoryAdjustmentRequestItem item) protected List<com.broadleafcommerce.data.tracking.core.service.Update<InventoryTransaction>>updateSoftReservationTransactionAndInventory(List<InventoryTransaction> inventoryTransactions, SkuInventory refreshedInventory, SkuInventoryAdjustmentRequestItem item) Deprecated.protected voidvalidateCanCancelInventory(SkuInventory inventory, SkuInventoryAdjustmentRequestItem item, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidvalidateCanFulfillInventory(SkuInventory inventory, SkuInventoryAdjustmentRequestItem item, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidvalidateExistingHardReservations(@NonNull SkuInventoryAdjustmentRequestItem item, @NonNull List<InventoryTransaction> existingTransactions) Validates that there is not an existingInventoryTransactionsthat isDefaultInventoryTransactionType.HARD_RESERVEDfor the givenSkuInventoryAdjustmentRequestItem.protected voidvalidateSufficientQuantityReservedForItemAdjustment(SkuInventory inventory, SkuInventoryAdjustmentRequestItem item, Map<String, List<InventoryTransaction>> existingTransactionsByType, InventoryTransactionType transactionType)
-
Constructor Details
-
DefaultSkuInventoryAdjustmentService
public DefaultSkuInventoryAdjustmentService(SkuInventoryRepository<com.broadleafcommerce.data.tracking.core.Trackable> skuInventoryRepository, InventoryTransactionService<InventoryTransaction> inventoryTransactionService, com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager domainMapperManager, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, com.broadleafcommerce.common.extension.TypeFactory typeFactory, StockChangeNotificationService stockChangeNotificationService)
-
-
Method Details
-
createSoftReservations
public List<InventoryTransaction> createSoftReservations(@NonNull Map<I, List<SkuInventoryAdjustmentRequestItem>> skuInventoryReservationRequestItems, @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableExceptionDescription copied from interface:SkuInventoryAdjustmentServiceSoft reservations that represent temporary inventory reservations.- Specified by:
createSoftReservationsin interfaceSkuInventoryAdjustmentService<I extends SkuInventory>- Parameters:
skuInventoryReservationRequestItems- - the key to the map is theSkuInventorythat 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
-
getExistingReservationsByReferences
-
createSoftReservations
public List<InventoryTransaction> createSoftReservations(@NonNull Map<I, List<SkuInventoryAdjustmentRequestItem>> skuInventoryReservationRequestItems, Map<String, throws InventoryUnavailableExceptionList<InventoryTransaction>> existingSoftReservationsByReference, @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:SkuInventoryAdjustmentServiceSoft reservations that represent temporary inventory reservations.- Specified by:
createSoftReservationsin interfaceSkuInventoryAdjustmentService<I extends SkuInventory>- Parameters:
skuInventoryReservationRequestItems- - the key to the map is theSkuInventorythat 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
-
updateSoftReservationTransactionAndInventory
@Deprecated protected List<com.broadleafcommerce.data.tracking.core.service.Update<InventoryTransaction>> updateSoftReservationTransactionAndInventory(List<InventoryTransaction> inventoryTransactions, SkuInventory refreshedInventory, SkuInventoryAdjustmentRequestItem item) throws InventoryUnavailableException Deprecated.- Throws:
InventoryUnavailableException
-
updateSoftReservationTransactionAndInventory
protected List<com.broadleafcommerce.data.tracking.core.service.Update<InventoryTransaction>> updateSoftReservationTransactionAndInventory(@NonNull @NonNull List<InventoryTransaction> inventoryTransactions, @NonNull @NonNull Map<String, I> refreshedInventories, @NonNull @NonNull SkuInventoryAdjustmentRequestItem item) throws InventoryUnavailableException- Throws:
InventoryUnavailableException
-
createHardReservations
public List<InventoryTransaction> createHardReservations(@NonNull Map<I, List<SkuInventoryAdjustmentRequestItem>> skuInventoryReservationRequestItems, @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableExceptionDescription copied from interface:SkuInventoryAdjustmentServiceHard reservations that represent final inventory reservations.- Specified by:
createHardReservationsin interfaceSkuInventoryAdjustmentService<I extends SkuInventory>- Parameters:
skuInventoryReservationRequestItems- - the key to the map is theSkuInventorythat 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
-
hasExistingReservations
-
validateExistingHardReservations
protected void validateExistingHardReservations(@NonNull @NonNull SkuInventoryAdjustmentRequestItem item, @NonNull @NonNull List<InventoryTransaction> existingTransactions) Validates that there is not an existingInventoryTransactionsthat isDefaultInventoryTransactionType.HARD_RESERVEDfor the givenSkuInventoryAdjustmentRequestItem.- Parameters:
item- theSkuInventoryAdjustmentRequestItemto validate forexistingTransactions- the existingInventoryTransactions- Throws:
IllegalArgumentException- if there is already aDefaultInventoryTransactionType.HARD_RESERVED
-
createSoftReservation
protected InventoryTransaction createSoftReservation(@NonNull @NonNull SkuInventory inventory, @NonNull @NonNull Integer quantityRequested, @NonNull @NonNull String referenceNumber, @NonNull @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException Soft inventory reservation. This also appropriately adjusts the inventory record passed in. This method, by default, does not save anything. Rather, it allows the calling method to handle that to allow for situations where a single SkuInventory may be adjusted more than once in a single call. That can happen, for example, when a PICKUP and a SHIP reservation for the same item are being requested for the same inventory. As a result, this method does the adjustment to the SkuInventory record and persists the associated InventoryTransaction.- Parameters:
inventory-quantityRequested-referenceNumber-batchId-contextInfo-- Returns:
- Throws:
InventoryUnavailableException
-
updateSkuInventoryQuantityReservation
protected void updateSkuInventoryQuantityReservation(@NonNull @NonNull SkuInventory inventory, @NonNull @NonNull Integer quantityRequested) throws InventoryUnavailableException - Throws:
InventoryUnavailableException
-
buildInventoryTransaction
protected InventoryTransaction buildInventoryTransaction(int quantity, InventoryTransactionType type, String reference, String skuInventoryId, String batchId, Instant dateProcessed) -
createHardReservation
protected InventoryTransaction createHardReservation(@NonNull @NonNull SkuInventory inventory, @Nullable InventoryTransaction softTransaction, @NonNull @NonNull Integer quantityRequested, @NonNull @NonNull String referenceNumber, @NonNull @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException Hard inventory reservation. If an associated soft reservation is found, this method converts it to a hard reservation. Otherwise, this method decrements quantity available and increments quantity reserved and creates a new InventoryTransaction with a transaction type of "HARD_RESERVED". In this case, the providedSkuInventoryargument is a hint or an option in case a SOFT reservation was not completed or in case it expired and has been rolled back. The logic is as follows: 1. Look upInventoryTransactions based on the referenceNumber andInventoryTransactionType.
2. If a HARD reservation exists, throw an exception
3. If a SOFT reservation exists, then look up theSkuInventoryrecord associated with the SOFT transaction, decrement inventory, and create a HARD reservation.
4. If a SOFT reservation does not exist, then decrement inventory as if it was a soft reservation, and create a HARD reservation
TheSkuInventoryrecord provided as an argument is a hint. If a SOFT reservation exists, then we want to use the SkuInventory that is already soft reserved (which may be the same). However, if a soft record does not exist, then we try to use the providedSkuInventoryrecord.- Parameters:
inventory- - The inventory that should be adjustedsoftTransaction- - existing soft inventory reservation that will be converted to a hard reservationquantityRequested- - Quantity to reserve - Must be greater than 0referenceNumber- - Arbitrary, unique reference number - usually Fulfillment Group Item ReferencebatchId- - arbitrary batch ID (typically to identify a logical transaction)contextInfo-- Returns:
- A single entry Map keyed by the
SkuInventorythat should be persisted and the associatedInventoryTransaction - Throws:
InventoryUnavailableException
-
createOrUpdateInventoryTransaction
protected InventoryTransaction createOrUpdateInventoryTransaction(InventoryTransaction inventoryTransaction, @Nullable InventoryTransaction existingSoftReservation, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Create an inventory transaction, or update an existing transaction if a previous soft transaction exists- Parameters:
inventoryTransaction- inventory transaction to be created or updatedexistingSoftReservation- existing soft inventory reservation to be converted to a hard reservationcontextInfo- context info- Returns:
- the created or updated inventory transaction
-
fulfillInventory
public List<InventoryTransaction> fulfillInventory(@NonNull @NonNull @NonNull Map<I, List<SkuInventoryAdjustmentRequestItem>> skuInventoryAdjustmentRequestItems, @NonNull @NonNull @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException, InventoryNotReservedExceptionDescription copied from interface:SkuInventoryAdjustmentServicePerform the fulfillment of inventory to remove reserved quantity and decrement on-hand quantity.- Specified by:
fulfillInventoryin interfaceSkuInventoryAdjustmentService<I extends SkuInventory>- Parameters:
skuInventoryAdjustmentRequestItems- - the key to the map is theSkuInventorythat 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
-
validateCanFulfillInventory
protected void validateCanFulfillInventory(SkuInventory inventory, SkuInventoryAdjustmentRequestItem item, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException, InventoryNotReservedException -
createFulfilledTransaction
protected InventoryTransaction createFulfilledTransaction(@NonNull @NonNull SkuInventory inventory, int quantity, @NonNull @NonNull String referenceNumber, @NonNull @NonNull String batchId) Builds a fulfilledInventoryTransactionand adjusts theSkuInventoryquantities.- Parameters:
inventory- the inventory being fulfilledquantity- the quantity being fulfilledreferenceNumber- the reference number of the item fulfilling inventorybatchId- identifier for the current batch of items updating inventory- Returns:
- the inventory transaction for this fulfilled item quantity
-
cancelInventory
public List<InventoryTransaction> cancelInventory(@NonNull Map<I, List<SkuInventoryAdjustmentRequestItem>> skuInventoryAdjustmentRequestItems, @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException, InventoryNotReservedExceptionDescription copied from interface:SkuInventoryAdjustmentServicePerform the cancel of inventory to remove reserved quantity.- Specified by:
cancelInventoryin interfaceSkuInventoryAdjustmentService<I extends SkuInventory>- Parameters:
skuInventoryAdjustmentRequestItems- - the key to the map is theSkuInventorythat 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
-
freeSoftReservations
public void freeSoftReservations(@NonNull List<InventoryTransaction> softReservations, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:SkuInventoryAdjustmentServiceRelease soft reservations and add back to on-hand quantity. Note that this archives the soft reservation in-place, no new inventory transactions are created.- Specified by:
freeSoftReservationsin interfaceSkuInventoryAdjustmentService<I extends SkuInventory>- Parameters:
softReservations- the soft reservations to freecontextInfo- the context around sandboxing and multitenant state
-
freeSoftReservationQuantity
protected InventoryTransaction freeSoftReservationQuantity(@NonNull InventoryTransaction softReservation, @NonNull SkuInventory skuInventory) Adjusts the SKU inventory quantities to reflect a soft inventory reservation being released (back to the available pool).- Parameters:
softReservation- the soft reservation to releaseskuInventory- the SKU inventory to adjust the quantities of (will be mutated)- Returns:
- the soft reservation
-
validateCanCancelInventory
protected void validateCanCancelInventory(SkuInventory inventory, SkuInventoryAdjustmentRequestItem item, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException, InventoryNotReservedException -
createCancelledTransaction
protected InventoryTransaction createCancelledTransaction(@NonNull @NonNull SkuInventory inventory, int quantity, @NonNull @NonNull String referenceNumber, @NonNull @NonNull String batchId) Builds a cancelledInventoryTransactionand adjusts theSkuInventoryquantities.- Parameters:
inventory- the inventory being cancelledquantity- the quantity being cancelledreferenceNumber- the reference number of the item cancelling inventorybatchId- identifier for the current batch of items updating inventory- Returns:
- the inventory transaction for this cancelled item quantity
-
readExistingTransactionsForItemByType
protected Map<String,List<InventoryTransaction>> readExistingTransactionsForItemByType(SkuInventoryAdjustmentRequestItem item, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
validateSufficientQuantityReservedForItemAdjustment
protected void validateSufficientQuantityReservedForItemAdjustment(SkuInventory inventory, SkuInventoryAdjustmentRequestItem item, Map<String, List<InventoryTransaction>> existingTransactionsByType, InventoryTransactionType transactionType) throws InventoryUnavailableException, InventoryNotReservedException -
sumQuantityForTransactionType
protected int sumQuantityForTransactionType(Map<String, List<InventoryTransaction>> transactionsByType, InventoryTransactionType type) -
calculateQuantityAvailable
Deprecated.in favor ofSkuInventory.updateQuantityAvailable() -
returnInventory
public List<InventoryTransaction> returnInventory(@NonNull Map<I, List<SkuInventoryAdjustmentRequestItem>> skuInventoryAdjustmentRequestItems, @NonNull String batchId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:SkuInventoryAdjustmentServicePerform the return of inventory to add back on-hand quantity.- Specified by:
returnInventoryin interfaceSkuInventoryAdjustmentService<I extends SkuInventory>- Parameters:
skuInventoryAdjustmentRequestItems- - the key to the map is theSkuInventorythat 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
-
createReturnedTransaction
protected InventoryTransaction createReturnedTransaction(@NonNull @NonNull SkuInventory inventory, int quantity, @NonNull @NonNull String referenceNumber, @NonNull @NonNull String batchId) Builds a returnedInventoryTransactionand adjusts theSkuInventoryquantities.- Parameters:
inventory- the inventory being returnedquantity- the quantity being returnedreferenceNumber- the reference number of the item returning inventorybatchId- identifier for the current batch of items returning inventory- Returns:
- the inventory transaction for this returned item quantity
-
readSkuInventory
-
readOptionalSkuInventory
-
saveSkuInventories
protected List<I> saveSkuInventories(@NonNull Collection<I> inventories, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
saveInventoryTransactions
protected List<InventoryTransaction> saveInventoryTransactions(@NonNull List<InventoryTransaction> transactions, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
updateInventoryTransactions
protected List<InventoryTransaction> updateInventoryTransactions(@NonNull List<com.broadleafcommerce.data.tracking.core.service.Update<InventoryTransaction>> transactions, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
deleteInventoryTransaction
protected void deleteInventoryTransaction(@NonNull InventoryTransaction transaction, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Convenience method for deleting (archiving) an inventory transaction.- Parameters:
transaction- the transaction to deletecontextInfo- the context in which to delete in
-
getSkuInventoryComparator
-
convertSkuInventoryFromPersistentDomain
-
getInventoryReservationTypes
-
getSkuInventoryRepository
@NonNull protected SkuInventoryRepository<com.broadleafcommerce.data.tracking.core.Trackable> getSkuInventoryRepository() -
getInventoryTransactionService
@NonNull protected InventoryTransactionService<InventoryTransaction> getInventoryTransactionService() -
getStockChangeNotificationService
-
getDomainMapperManager
@NonNull protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager getDomainMapperManager() -
getValidator
@NonNull protected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager getValidator() -
getTypeFactory
@NonNull protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
SkuInventory.updateQuantityAvailable()