Interface UniqueInventory<T extends UniqueInventoryItem>
- All Superinterfaces:
CrudRepository<T,InventoryItemIdentifier>
,Inventory<T>
,Repository<T,InventoryItemIdentifier>
,SalespointRepository<T,InventoryItemIdentifier>
public interface UniqueInventory<T extends UniqueInventoryItem> extends Inventory<T>, SalespointRepository<T,InventoryItemIdentifier>
A
UniqueInventory
manages UniqueInventoryItem
s, i.e. only a single InventoryItem
can exist
per Product
. This simplifies the lookup of the quantity available for a given Product
to the lookup
of a single UniqueInventoryItem
.
Also, on Order
completion, a UniqueInventoryItem
can be updated and get its Quantity
deducted
based on the quantity of products ordered.
- Since:
- 7.2
- Author:
- Oliver Drotbohm
- See Also:
MultiInventoryItem
-
Method Summary
Modifier and Type Method Description default Optional<T>
findByProduct(Product product)
Returns theInventoryItem
for the givenProduct
.Optional<T>
findByProductIdentifier(ProductIdentifier productIdentifier)
Returns theInventoryItem
for the givenProductIdentifier
.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteById, existsById, findAllById, findById, save, saveAll
Methods inherited from interface org.salespointframework.inventory.Inventory
findItemsOutOfStock, streamAll
-
Method Details
-
findByProductIdentifier
@Query("select i from #{#entityName} i where i.product.id = ?1") Optional<T> findByProductIdentifier(ProductIdentifier productIdentifier)Returns theInventoryItem
for the givenProductIdentifier
.- Parameters:
productIdentifier
- must not be null.- Returns:
-
findByProduct
Returns theInventoryItem
for the givenProduct
.- Parameters:
product
- must not be null.- Returns:
-