Interface UniqueInventory<T extends UniqueInventoryItem>
- All Superinterfaces:
CrudRepository<T,
,InventoryItem.InventoryItemIdentifier> Inventory<T>
,PagingAndSortingRepository<T,
,InventoryItem.InventoryItemIdentifier> Repository<T,
,InventoryItem.InventoryItemIdentifier> SalespointRepository<T,
InventoryItem.InventoryItemIdentifier>
public interface UniqueInventory<T extends UniqueInventoryItem>
extends Inventory<T>, SalespointRepository<T,InventoryItem.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:
-
Method Summary
Modifier and TypeMethodDescriptionfindByProduct
(Product product) Returns theInventoryItem
for the givenProduct
.findByProductIdentifier
(Product.ProductIdentifier productIdentifier) Returns theInventoryItem
for the givenProduct.ProductIdentifier
.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save
Methods inherited from interface org.salespointframework.inventory.Inventory
findItemsOutOfStock, streamAll
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll
Methods inherited from interface org.salespointframework.core.SalespointRepository
findAll, findAll, findAllById, saveAll
-
Method Details
-
findByProductIdentifier
@Query("select i from #{#entityName} i\n where i.product.id = ?1\n") Optional<T> findByProductIdentifier(Product.ProductIdentifier productIdentifier) Returns theInventoryItem
for the givenProduct.ProductIdentifier
.- Parameters:
productIdentifier
- must not be null.- Returns:
-
findByProduct
Returns theInventoryItem
for the givenProduct
.- Parameters:
product
- must not be null.- Returns:
-