Interface CustomizableSkuInventoryRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
-
- Type Parameters:
D
-
- All Known Subinterfaces:
JpaSkuInventoryRepository<D>
,SkuInventoryRepository<D>
- All Known Implementing Classes:
DefaultJpaCustomizableSkuInventoryRepository
public interface CustomizableSkuInventoryRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
Interface that allows a Spring Repository Fragment to override default behavior inTrackableRepository
, including the application of explicit database locks, as needed and if applicable.- Author:
- Kelly Tisdell (ktisdell)
- See Also:
SkuInventoryRepository
,TrackableRepository
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Stream<D>
findAll(Optional<cz.jirutka.rsql.parser.ast.Node> filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Generally used for batch export, this allows a caller to query, filter, and stream paged results.Iterable<D>
findAllByContextId(Iterable<String> contextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Retrieve all domain instances based on a list of context ids (seeTrackable.getContextId()
).List<D>
findAvailableBySkuReferenceForQuantity(Map<String,Integer> skuReferenceQuantities, SkuReferenceFieldType skuReferenceFieldType, String inventoryLocationId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
FindsSkuInventory
records with at least the mapped available quantities for a given inventory location.List<D>
findAvailableBySkuReferenceForQuantity(Map<String,Integer> skuReferenceQuantities, SkuReferenceFieldType skuReferenceFieldType, Optional<Boolean> shippingLocation, Optional<Boolean> pickupLocation, Optional<Boolean> storeLocation, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
FindsSkuInventory
records with the mapped available quantities for given fulfillment types.List<D>
findAvailableBySkuReferenceForQuantity(Set<String> skuReferences, int minQuantityAvailable, SkuReferenceFieldType skuReferenceFieldType, Optional<Boolean> shippingLocation, Optional<Boolean> pickupLocation, Optional<Boolean> storeLocation, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Finds availableSkuInventory
records for the provided skuReferences where each have at least the minQuantityAvailable.Optional<D>
findByContextId(String contextId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Retrieve a domain instance based on the context id (seeTrackable.getContextId()
).Optional<D>
findByInventoryLocationAndSkuRefFieldValues(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)
Tries to find a uniqueSkuInventory
record based on theInventoryLocation.getId()
and any one ofSkuRef
field values.List<D>
findBySkuReferencesAndLocationId(Set<String> skuReferences, Integer minQuantity, String locationId, SkuReferenceFieldType skuReferenceFieldType, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
RetrievesSkuInventory
records, filtering onSkuRef
, based on the skuReferenceFieldType parameter, andInventoryLocation.getId()
.boolean
isAvailableBySkuReferenceForQuantity(String skuReference, int quantity, SkuReferenceFieldType skuReferenceFieldType, Optional<Boolean> shippingLocation, Optional<Boolean> pickupLocation, Optional<Boolean> storeLocation, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Determines if theSkuInventory
, identified by skuReference, is available for the specified quantity across one or moreInventoryLocation
s, identified by their allowed fulfillment types.Stream<D>
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.Object[][]
readSummaryAvailability(SkuReferenceFieldType skuReferenceFieldType, Set<String> skuReferences, int minQuantity, Optional<Boolean> shippingLocation, Optional<Boolean> pickupLocation, Optional<Boolean> storeLocation, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Queries for applications and tenant IDs associated with the requested availability.
-
-
-
Method Detail
-
findByInventoryLocationAndSkuRefFieldValues
Optional<D> findByInventoryLocationAndSkuRefFieldValues(@NonNull String inventoryLocationId, @NonNull Optional<String> externalId, @NonNull Optional<String> skuCode, @NonNull Optional<String> upc, @NonNull Optional<String> ean, @NonNull Optional<String> gtin, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Tries to find a uniqueSkuInventory
record based on theInventoryLocation.getId()
and any one ofSkuRef
field values. Note that for anySkuInventory
record, there can be only one unique SKU identifier, which includes any number of unique fields, perInventoryLocation
.- Parameters:
inventoryLocationId
-externalId
-skuCode
-upc
-ean
-gtin
-context
-- Returns:
-
findBySkuReferencesAndLocationId
@Policy(operationTypes=READ) @NonNull List<D> findBySkuReferencesAndLocationId(@NonNull Set<String> skuReferences, @Nullable Integer minQuantity, @NonNull String locationId, @NonNull SkuReferenceFieldType skuReferenceFieldType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
RetrievesSkuInventory
records, filtering onSkuRef
, based on the skuReferenceFieldType parameter, andInventoryLocation.getId()
.- Parameters:
skuReferences
-minQuantity
- - (optional) the expected minimum quantity availablelocationId
- - the inventory location in which to find inventoryskuReferenceFieldType
- - the type of SKU reference (identifies whatSkuRef
field should be filtered by the skuReferences argumentcontext
-- Returns:
-
findByContextId
@Policy(operationTypes=READ) @NonNull Optional<D> findByContextId(@NonNull String contextId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Retrieve a domain instance based on the context id (seeTrackable.getContextId()
). If aNarrowExecutor
implementation was specified viaNarrow
, the result should be narrowed based on sandbox and catalog state. This overrides the methodTrackableRepository.findByContextId(String, ContextInfo)
. The mixin implementation will provide an exclusive write lock, if applicable, to prevent concurrent modification ofSkuInventory
records.- Parameters:
contextId
- An identifying idcontextInfo
- Request context information around sandbox and multitenant state- Returns:
- If nothing found, an empty Optional. Otherwise, an Optional containing the narrowed entity.
-
findAllByContextId
@Policy(operationTypes=READ) @NonNull Iterable<D> findAllByContextId(@NonNull Iterable<String> contextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Retrieve all domain instances based on a list of context ids (seeTrackable.getContextId()
). If aNarrowExecutor
implementation was specified viaNarrow
, the result should be narrowed based on sandbox and catalog state. This overrides the methodTrackableRepository.findAllByContextId(Iterable, ContextInfo)
. The mixin implementation will provide an exclusive write lock, if applicable, to prevent concurrent modification ofSkuInventory
records.- Parameters:
contextIds
- A list of identifying idscontextInfo
- Request context information around sandbox and multitenant state- Returns:
- The list of narrowed entities
-
isAvailableBySkuReferenceForQuantity
@Policy(operationTypes=READ) boolean isAvailableBySkuReferenceForQuantity(@NonNull String skuReference, int quantity, @NonNull SkuReferenceFieldType skuReferenceFieldType, @NonNull Optional<Boolean> shippingLocation, @NonNull Optional<Boolean> pickupLocation, @NonNull Optional<Boolean> storeLocation, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Determines if theSkuInventory
, identified by skuReference, is available for the specified quantity across one or moreInventoryLocation
s, identified by their allowed fulfillment types. SkuRef is determined by the skuReference argument and the- Parameters:
skuReference
-quantity
- - requested quantityskuReferenceFieldType
- - the type of skuReference being passed inshippingLocation
- -Optional
value represents whether we should query shipping locations. If not present, no filtering will be applied.pickupLocation
- -Optional
value represents whether we should query pickup locations. If not present, no filtering will be applied.storeLocation
- -Optional
value represents whether we should query store locations. If not present, no filtering will be applied.context
-- Returns:
-
findAvailableBySkuReferenceForQuantity
@Policy(operationTypes=READ) List<D> findAvailableBySkuReferenceForQuantity(@NonNull Set<String> skuReferences, int minQuantityAvailable, @NonNull SkuReferenceFieldType skuReferenceFieldType, @NonNull Optional<Boolean> shippingLocation, @NonNull Optional<Boolean> pickupLocation, @NonNull Optional<Boolean> storeLocation, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Finds availableSkuInventory
records for the provided skuReferences where each have at least the minQuantityAvailable.- Parameters:
skuReferences
-minQuantityAvailable
-skuReferenceFieldType
-shippingLocation
-pickupLocation
-storeLocation
-context
-- Returns:
-
findAll
@Policy(operationTypes=READ) Stream<D> findAll(@NonNull Optional<cz.jirutka.rsql.parser.ast.Node> filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Generally used for batch export, this allows a caller to query, filter, and stream paged results.- Parameters:
filters
-contextInfo
-- Returns:
-
findAvailableBySkuReferenceForQuantity
@Policy(operationTypes=READ) List<D> findAvailableBySkuReferenceForQuantity(@NonNull Map<String,Integer> skuReferenceQuantities, @NonNull SkuReferenceFieldType skuReferenceFieldType, @NonNull Optional<Boolean> shippingLocation, @NonNull Optional<Boolean> pickupLocation, @NonNull Optional<Boolean> storeLocation, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
FindsSkuInventory
records with the mapped available quantities for given fulfillment types.- Parameters:
skuReferenceQuantities
-skuReferenceFieldType
-shippingLocation
-pickupLocation
-storeLocation
-context
-- Returns:
-
findAvailableBySkuReferenceForQuantity
@Policy(operationTypes=READ) List<D> findAvailableBySkuReferenceForQuantity(@NonNull Map<String,Integer> skuReferenceQuantities, @NonNull SkuReferenceFieldType skuReferenceFieldType, @NonNull String inventoryLocationId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
FindsSkuInventory
records with at least the mapped available quantities for a given inventory location.- Parameters:
skuReferenceQuantities
-skuReferenceFieldType
-inventoryLocationId
-context
-- Returns:
-
readAllByInventoryLocationId
@Policy(operationTypes=READ) Stream<D> 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
-
readSummaryAvailability
Object[][] readSummaryAvailability(SkuReferenceFieldType skuReferenceFieldType, Set<String> skuReferences, int minQuantity, @NonNull Optional<Boolean> shippingLocation, @NonNull Optional<Boolean> pickupLocation, @NonNull Optional<Boolean> storeLocation, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Queries for applications and tenant IDs associated with the requested availability. The response is a an Object array that contains: - skuReference (i.e. typically skuCode, but depends on what is requested by skuReferenceFieldType) - tenantId - applicationId (nullable) This method is pretty specific as it allows the Search Services, for example, to determine, for which SKUs have general availability across tenants and applications, not specific to inventory locations.- Parameters:
skuReferenceFieldType
- The type of fields for which we are search (e.g. SKU_CODE)skuReferences
- The SKU reference number or code e.g.SkuRef.skuCode
shippingLocation
- Indicates if we want to include availability at shipping locationspickupLocation
- - Indicates if we want to include availability at pickup locationsstoreLocation
- - Indicates if we want to include availability at store locationscontext
- the ContextInfo for this request- Returns:
- An object array, representing the rows and columns from the query
-
-