Interface Inventory<T extends InventoryItem<?>>
-
- All Known Subinterfaces:
MultiInventory<T>,UniqueInventory<T>
@NoRepositoryBean public interface Inventory<T extends InventoryItem<?>>Base interface forInventoryItemimplementations. Choose eitherUniqueInventoryorMultiInventoryfor your application depending on whether you need to keep track of multiple locations (e.g. warehouses) in whichInventoryItems are supposed to be managed.UniqueInventoryItemexpects a one-to-one relationship to a product, which is equivalent to modeling a single warehouse. That's simple and allows to look up theUniqueInventoryItembyProductIdentifier. I.e. theQuantitycontained in thatUniqueInventoryItemis equivalent to the overall quantity in the system. This is the simpler model in general and should be preferred.Products held inUniqueInventoryItems are suspect to automatic inventory updates on order completion. SeeInventoryOrderEventListenerfor details.If you absolutely need to model
Products managed in multiple warehouses, useMultiInventoryItemalongsideMultiInventory.MultiInventory.findByProductIdentifier(ProductIdentifier)rather returns anInventoryItemsinstance. The overallQuantityofProducts in the system can then be obtained viaInventoryItems.getTotalQuantity().MultiInventoryItems are not suspect to auto-inventory updates upon order completion as it's not clear which of theInventoryItems is supposed to be deducted.- Since:
- 7.2
- Author:
- Oliver Drotbohm
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.springframework.data.util.Streamable<T>findItemsOutOfStock()Returns allUniqueInventoryItems that are out of stock (i.e. theQuantity's amount is equal or less than zero).
-
-
-
Method Detail
-
findItemsOutOfStock
@Query("select i from #{#entityName} i where i.quantity.amount <= 0") org.springframework.data.util.Streamable<T> findItemsOutOfStock()Returns allUniqueInventoryItems that are out of stock (i.e. theQuantity's amount is equal or less than zero).- Returns:
- will never be null.
-
-