Interface Inventory<T extends InventoryItem<?>>
- All Known Subinterfaces:
MultiInventory<T>,UniqueInventory<T>
InventoryItem implementations. Choose either UniqueInventory or
MultiInventory for your application depending on whether you need to keep track of multiple locations (e.g.
warehouses) in which InventoryItems are supposed to be managed.
UniqueInventoryItem expects a one-to-one relationship to a product, which is equivalent to modeling a single
warehouse. That's simple and allows to look up the UniqueInventoryItem by Product.ProductIdentifier. I.e. the
Quantity contained in that UniqueInventoryItem is equivalent to the overall quantity in the system.
This is the simpler model in general and should be preferred. Products held in UniqueInventoryItems
are suspect to automatic inventory updates on order completion. See
InventoryListeners.InventoryOrderEventListener for details.
If you absolutely need to model Products managed in multiple warehouses, use MultiInventoryItem
alongside MultiInventory. MultiInventory.findByProductIdentifier(ProductIdentifier) rather returns an
InventoryItems instance. The overall Quantity of Products in the system can then be obtained
via InventoryItems.getTotalQuantity(). MultiInventoryItems are not suspect to auto-inventory updates
upon order completion as it's not clear which of the InventoryItems is supposed to be deducted.
- Since:
- 7.2
- Author:
- Oliver Drotbohm
-
Method Summary
Modifier and TypeMethodDescriptionReturns allUniqueInventoryItems that are out of stock (i.e.Returns allInventoryItems asStreamableusually to concatenate with otherStreamables ofInventoryItems.
-
Method Details
-
streamAll
Returns allInventoryItems asStreamableusually to concatenate with otherStreamables ofInventoryItems. For dedicated access to the concrete sub-type ofInventoryItemuseSalespointRepository.findAll().- Returns:
- Since:
- 7.3
- See Also:
-
findItemsOutOfStock
@Query("select i from #{#entityName} i where i.quantity.amount <= 0") 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.
-