Interface SkuInventoryService<I extends SkuInventory>
- Type Parameters:
I
-
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<I>
- All Known Implementing Classes:
DefaultSkuInventoryService
public interface SkuInventoryService<I extends SkuInventory>
extends com.broadleafcommerce.data.tracking.core.service.CrudEntityService<I>
Service API for adjusting
SkuInventory
.- Author:
- Kelly Tisdell (ktisdell)
-
Method Summary
Modifier and TypeMethodDescriptioncancelInventory
(SkuInventoryAdjustmentRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Performs theDefaultInventoryTransactionType.CANCELLED
InventoryTransactions
to updateSkuInventory
for fulfilled items.createSkuInventoryReservations
(SkuInventoryReservationRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates HARD or a SOFT Inventory Reservations.void
deleteAllByInventoryLocationId
(String inventoryLocationId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deletes all theSkuInventory
for the specified inventory location idboolean
existsByInventoryLocationAndSkuRefFieldValues
(String inventoryLocationId, Optional<String> skuContextId, Optional<String> externalId, Optional<String> skuCode, Optional<String> upc, Optional<String> ean, Optional<String> gtin, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Determines is aSkuInventory
record exists in a given location, based onSkuRef
fields.boolean
existsByParentSkuInventoryId
(String parentSkuInventoryId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Determines if anySkuInventory
records exist with the givenSkuInventory.getParentSkuInventoryId()
.org.springframework.data.domain.Page<I>
findAllByInventoryLocationContextId
(String inventoryLocationId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all Sku Inventories for the specified inventory location id matching the given filters.fulfillInventory
(SkuInventoryAdjustmentRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Performs theDefaultInventoryTransactionType.FULFILLED
InventoryTransactions
to updateSkuInventory
for fulfilled items.readAll
(Optional<cz.jirutka.rsql.parser.ast.Node> filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Generally used for batch export, this allows a caller to query, filter, and stream paged results.readAllByInventoryLocationId
(String inventoryLocationId, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all Sku Inventories for the specified inventory location id matching the given filters.org.springframework.data.domain.Page<I>
readAllByName
(String nameQuery, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all Inventory Locations, optionally filtered by name or number.readByInventoryLocationAndSkuRefFieldValues
(String inventoryLocationId, Optional<String> externalId, Optional<String> skuCode, Optional<String> upc, Optional<String> ean, Optional<String> gtin, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads a (unique)SkuInventory
record for a given location, based onSkuRef
fields.readByInventoryLocationAndSkuRefFieldValuesAndNotSerialized
(String inventoryLocationId, Optional<String> externalId, Optional<String> skuCode, Optional<String> upc, Optional<String> ean, Optional<String> gtin, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads a (unique) non-serializedSkuInventory
record for a given location, based onSkuRef
fields.readByParentSkuInventoryIdAndSerializationValue
(String parentSkuInventoryId, String serializationValue, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads a (unique)SkuInventory
record for a parent sku inventory id and serialization value.readSkuInventoryDetails
(SkuReferenceFieldType skuRefType, Set<String> skuRefs, InventoryLocation location, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) ReadsSkuInventory
details based on specificSkuRef
details, specified by theSkuReferenceFieldType
for a givenInventoryLocation
.releaseSkuInventoryReservations
(ReleaseSkuInventoryReservationRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Releases inventory reservations based on the givenReleaseSkuInventoryReservationRequest
.returnInventory
(SkuInventoryAdjustmentRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Performs theDefaultInventoryTransactionType.RETURNED
InventoryTransactions
to updateSkuInventory
for returned items.Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
-
Method Details
-
readAllByName
org.springframework.data.domain.Page<I> readAllByName(@Nullable String nameQuery, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all Inventory Locations, optionally filtered by name or number.- Parameters:
nameQuery
- (optional) the name to filter bypage
- the requested page of results from the databasefilters
- additional filters to apply in the query, can be nullcontext
- context information surrounding sandboxing and multitenant state- Returns:
- all SkuInventory, optionally filtered by name
-
findAllByInventoryLocationContextId
org.springframework.data.domain.Page<I> findAllByInventoryLocationContextId(String inventoryLocationId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all Sku Inventories for the specified inventory location id matching the given filters. Read all Inventory Locations,- Parameters:
inventoryLocationId
- the inventory location idfilters
- additional filters to apply in the query, can be nullpage
- the requested page of results from the databasecontext
- context information surrounding sandboxing and multitenant state- Returns:
- the Sku Inventories for the specified inventory location id
-
readAllByInventoryLocationId
Stream<I> readAllByInventoryLocationId(String inventoryLocationId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all Sku Inventories for the specified inventory location id matching the given filters.- Parameters:
inventoryLocationId
- the inventory location idfilters
- additional filters to apply in the query, can be nullcontext
- context information surrounding sandboxing and multitenant state- Returns:
- the Sku Inventories for the specified inventory location id
-
deleteAllByInventoryLocationId
void deleteAllByInventoryLocationId(String inventoryLocationId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deletes all theSkuInventory
for the specified inventory location id- Parameters:
inventoryLocationId
- the inventory location idcontextInfo
- context information surrounding sandboxing and multitenant state
-
readByParentSkuInventoryIdAndSerializationValue
Optional<I> readByParentSkuInventoryIdAndSerializationValue(String parentSkuInventoryId, String serializationValue, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads a (unique)SkuInventory
record for a parent sku inventory id and serialization value.- Parameters:
parentSkuInventoryId
- the parent sku inventory idserializationValue
- the serialization valuecontext
- context information surrounding sandboxing and multitenant state- Returns:
- a (unique)
SkuInventory
record for a given parent sku inventory id and serialization value.
-
existsByParentSkuInventoryId
boolean existsByParentSkuInventoryId(String parentSkuInventoryId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Determines if anySkuInventory
records exist with the givenSkuInventory.getParentSkuInventoryId()
.- Parameters:
parentSkuInventoryId
- the parent sku inventory id to filter bycontext
- context information surrounding sandboxing and multitenant state- Returns:
- true if any
SkuInventory
records exist with the givenSkuInventory.getParentSkuInventoryId()
, otherwise false
-
createSkuInventoryReservations
List<InventoryTransaction> createSkuInventoryReservations(@NonNull SkuInventoryReservationRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException Creates HARD or a SOFT Inventory Reservations. This results in the creation of 1 or moreInventoryTransaction
records. A SOFT inventory reservation is a temporary reservation that may be removed or rolled back after a period of time. A SOFT reservation typically results in decrementing quantityAvailable on theSkuInventory
record. These are typically created prior to payment processing. A HARD reservation makes the SOFT reservation permanent. These are typically created after payment processing. If a corresponding SOFT reservation does not exist, then the creation of a HARD reservation will attempt to decrement quantityAvailable as well. In this case, the process is similar to creating a SOFT reservation immediately followed by a HARD reservation.- Parameters:
request
-SkuInventoryReservationRequest
to be processedcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The
InventoryTransactions
resulting from processing therequest
. - Throws:
InventoryUnavailableException
- if inventory cannot be reserved or otherwise decremented
-
releaseSkuInventoryReservations
ReleaseSkuInventoryReservationResponse releaseSkuInventoryReservations(ReleaseSkuInventoryReservationRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Releases inventory reservations based on the givenReleaseSkuInventoryReservationRequest
.By default, it only releases the soft reservations
- Parameters:
request
- theReleaseSkuInventoryReservationRequest
containing details about the releasecontextInfo
- context information around sandbox and multitenant state- Returns:
- a
ReleaseSkuInventoryReservationResponse
represents the result
-
fulfillInventory
List<InventoryTransaction> fulfillInventory(@NonNull SkuInventoryAdjustmentRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException, InventoryNotReservedException Performs theDefaultInventoryTransactionType.FULFILLED
InventoryTransactions
to updateSkuInventory
for fulfilled items.This transaction decrements the reserved and on-hand inventory for the requested items. This should only be performed after the items have already been
DefaultInventoryTransactionType.HARD_RESERVED
.- Parameters:
request
- inventory adjustment to be processed as fulfilledcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The
InventoryTransactions
resulting from processing therequest
. - Throws:
InventoryUnavailableException
- if inventory could not be decrementedInventoryNotReservedException
- if inventory was not already reserved
-
cancelInventory
List<InventoryTransaction> cancelInventory(@NonNull SkuInventoryAdjustmentRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) throws InventoryUnavailableException, InventoryNotReservedException Performs theDefaultInventoryTransactionType.CANCELLED
InventoryTransactions
to updateSkuInventory
for fulfilled items.This transaction decrements the reserved inventory for the requested items. This should only be performed after the items have already been
DefaultInventoryTransactionType.HARD_RESERVED
.- Parameters:
request
- inventory adjustment to be processed as cancelledcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The
InventoryTransactions
resulting from processing therequest
. - Throws:
InventoryUnavailableException
- if inventory could not be decrementedInventoryNotReservedException
- if inventory was not already reserved
-
returnInventory
List<InventoryTransaction> returnInventory(@NonNull SkuInventoryAdjustmentRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Performs theDefaultInventoryTransactionType.RETURNED
InventoryTransactions
to updateSkuInventory
for returned items.This transaction increments the on-hand inventory for the requested items.
- Parameters:
request
- inventory adjustment to be processed as returnedcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The
InventoryTransactions
resulting from processing therequest
.
-
readByInventoryLocationAndSkuRefFieldValues
Optional<I> readByInventoryLocationAndSkuRefFieldValues(String inventoryLocationId, Optional<String> externalId, Optional<String> skuCode, Optional<String> upc, Optional<String> ean, Optional<String> gtin, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads a (unique)SkuInventory
record for a given location, based onSkuRef
fields.- Parameters:
inventoryLocationId
-externalId
-skuCode
-upc
-ean
-gtin
-context
-- Returns:
-
readByInventoryLocationAndSkuRefFieldValuesAndNotSerialized
Optional<I> readByInventoryLocationAndSkuRefFieldValuesAndNotSerialized(String inventoryLocationId, Optional<String> externalId, Optional<String> skuCode, Optional<String> upc, Optional<String> ean, Optional<String> gtin, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads a (unique) non-serializedSkuInventory
record for a given location, based onSkuRef
fields.Typically used for the validation to ensure that the parent of serialized inventories do not have duplicate sku reference.
-
existsByInventoryLocationAndSkuRefFieldValues
boolean existsByInventoryLocationAndSkuRefFieldValues(String inventoryLocationId, Optional<String> skuContextId, Optional<String> externalId, Optional<String> skuCode, Optional<String> upc, Optional<String> ean, Optional<String> gtin, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Determines is aSkuInventory
record exists in a given location, based onSkuRef
fields.- Parameters:
inventoryLocationId
-skuContextId
-externalId
-skuCode
-upc
-ean
-gtin
-context
-- Returns:
-
readSkuInventoryDetails
List<I> readSkuInventoryDetails(SkuReferenceFieldType skuRefType, Set<String> skuRefs, InventoryLocation location, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) ReadsSkuInventory
details based on specificSkuRef
details, specified by theSkuReferenceFieldType
for a givenInventoryLocation
.- Parameters:
skuRefType
-skuRefs
-location
-contextInfo
-- Returns:
-
readAll
Stream<I> readAll(@Nullable Optional<cz.jirutka.rsql.parser.ast.Node> filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Generally used for batch export, this allows a caller to query, filter, and stream paged results.- Parameters:
filters
-context
-- Returns:
-