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 in
TrackableRepository, including the application of explicit database locks, as needed and
if applicable.- Author:
- Kelly Tisdell (ktisdell)
- See Also:
-
SkuInventoryRepositoryTrackableRepository
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteAllByInventoryLocationId(String inventoryLocationId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Softly deletes all theSkuInventoryfor the specified inventory location idfindAll(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.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()).findAvailableBySkuReferenceForQuantity(Map<String, Integer> skuReferenceQuantities, SkuReferenceFieldType skuReferenceFieldType, String inventoryLocationId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) FindsSkuInventoryrecords with at least the mapped available quantities for a given inventory location.findAvailableBySkuReferenceForQuantity(Map<String, Integer> skuReferenceQuantities, SkuReferenceFieldType skuReferenceFieldType, Optional<Boolean> shippingLocation, Optional<Boolean> pickupLocation, Optional<Boolean> storeLocation, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) FindsSkuInventoryrecords with the mapped available quantities for given fulfillment types.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 availableSkuInventoryrecords for the provided skuReferences where each have at least the minQuantityAvailable.findByContextId(String contextId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve a domain instance based on the context id (seeTrackable.getContextId()).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 uniqueSkuInventoryrecord based on theInventoryLocation.getId()and any one ofSkuReffield values.findByInventoryLocationAndSkuRefFieldValuesAndNotSerialized(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 unique non-serializedSkuInventoryrecord based on theInventoryLocation.getId()and any one ofSkuReffield values.findBySkuReferencesAndLocationId(Set<String> skuReferences, Integer minQuantity, String locationId, SkuReferenceFieldType skuReferenceFieldType, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) RetrievesSkuInventoryrecords, filtering onSkuRef, based on the skuReferenceFieldType parameter, andInventoryLocation.getId().booleanisAvailableBySkuReferenceForQuantity(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 moreInventoryLocations, identified by their allowed fulfillment types.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.readConsolidatedInventoryQuantities(Set<String> skus, Optional<Boolean> shippingLocation, Optional<Boolean> pickupLocation, Optional<Boolean> storeLocation, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) This reads a sum of inventory quantities available for a particular SKU.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 Details
-
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 uniqueSkuInventoryrecord based on theInventoryLocation.getId()and any one ofSkuReffield values. Note that for anySkuInventoryrecord, 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:
-
findByInventoryLocationAndSkuRefFieldValuesAndNotSerialized
Optional<D> findByInventoryLocationAndSkuRefFieldValuesAndNotSerialized(@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 unique non-serializedSkuInventoryrecord based on theInventoryLocation.getId()and any one ofSkuReffield values. Note that for anySkuInventoryrecord, there can be only one unique SKU identifier, which includes any number of unique fields, perInventoryLocation. -
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) RetrievesSkuInventoryrecords, 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 whatSkuReffield 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 aNarrowExecutorimplementation 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 ofSkuInventoryrecords.- 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 aNarrowExecutorimplementation 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 ofSkuInventoryrecords.- 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 moreInventoryLocations, 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- -Optionalvalue represents whether we should query shipping locations. If not present, no filtering will be applied.pickupLocation- -Optionalvalue represents whether we should query pickup locations. If not present, no filtering will be applied.storeLocation- -Optionalvalue 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 availableSkuInventoryrecords 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) FindsSkuInventoryrecords 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) FindsSkuInventoryrecords 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
-
deleteAllByInventoryLocationId
@Policy(operationTypes=DELETE) void deleteAllByInventoryLocationId(String inventoryLocationId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Softly deletes all theSkuInventoryfor the specified inventory location id- Parameters:
inventoryLocationId- the inventory location idcontextInfo- context information surrounding sandboxing and multitenant state
-
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.skuCodeshippingLocation- 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
-
readConsolidatedInventoryQuantities
Map<String,Long> readConsolidatedInventoryQuantities(@NonNull Set<String> skus, @NonNull Optional<Boolean> shippingLocation, @NonNull Optional<Boolean> pickupLocation, @NonNull Optional<Boolean> storeLocation, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) This reads a sum of inventory quantities available for a particular SKU. This returns aMapof quantities available. The Map has a key that represents the SKU with a value that represents the quantity available for that SKU.- Parameters:
skus- the skus for which we are requesting inventoryshippingLocation- whether the inventory can come from a shipping locationpickupLocation- whether the inventory can come from a pickup locationstoreLocation- whether the inventory can come from a store or shopping locationcontext- the context for which this query should be applied- Returns:
-