Interface UniqueInventory<T extends UniqueInventoryItem>
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<T,InventoryItemIdentifier>
,Inventory<T>
,org.springframework.data.repository.Repository<T,InventoryItemIdentifier>
public interface UniqueInventory<T extends UniqueInventoryItem> extends Inventory<T>, org.springframework.data.repository.CrudRepository<T,InventoryItemIdentifier>
AUniqueInventory
managesUniqueInventoryItem
s, i.e. only a singleInventoryItem
can exist perProduct
. This simplifies the lookup of the quantity available for a givenProduct
to the lookup of a singleUniqueInventoryItem
.Also, on
Order
completion, aUniqueInventoryItem
can be updated and get itsQuantity
deducted based on the quantity of products ordered.- Since:
- 7.2
- Author:
- Oliver Drotbohm
- See Also:
MultiInventoryItem
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods 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, findAll, findAllById, findById, save, saveAll
-
Methods inherited from interface org.salespointframework.inventory.Inventory
findItemsOutOfStock
-
-
-
-
Method Detail
-
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
default Optional<T> findByProduct(Product product)
Returns theInventoryItem
for the givenProduct
.- Parameters:
product
- must not be null.- Returns:
-
-