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 InventoryItem
s 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. Product
s held in UniqueInventoryItem
s
are suspect to automatic inventory updates on order completion. See
InventoryListeners.InventoryOrderEventListener
for details.
If you absolutely need to model Product
s managed in multiple warehouses, use MultiInventoryItem
alongside MultiInventory
. MultiInventory.findByProductIdentifier(ProductIdentifier)
rather returns an
InventoryItems
instance. The overall Quantity
of Product
s in the system can then be obtained
via InventoryItems.getTotalQuantity()
. MultiInventoryItem
s are not suspect to auto-inventory updates
upon order completion as it's not clear which of the InventoryItem
s is supposed to be deducted.
- Since:
- 7.2
- Author:
- Oliver Drotbohm
-
Method Summary
Modifier and TypeMethodDescriptionReturns allUniqueInventoryItem
s that are out of stock (i.e.Returns allInventoryItem
s asStreamable
usually to concatenate with otherStreamable
s ofInventoryItem
s.
-
Method Details
-
streamAll
Returns allInventoryItem
s asStreamable
usually to concatenate with otherStreamable
s ofInventoryItem
s. For dedicated access to the concrete sub-type ofInventoryItem
useSalespointRepository.findAll()
.- Returns:
- Since:
- 7.3
- See Also:
-
findItemsOutOfStock
@Query("select i from #{#entityName} i where i.quantity.amount <= 0") Streamable<T> findItemsOutOfStock()Returns allUniqueInventoryItem
s that are out of stock (i.e. theQuantity
's amount is equal or less than zero).- Returns:
- will never be null.
-