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:
  • 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 unique SkuInventory record based on the InventoryLocation.getId() and any one of SkuRef field values. Note that for any SkuInventory record, there can be only one unique SKU identifier, which includes any number of unique fields, per InventoryLocation.
      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-serialized SkuInventory record based on the InventoryLocation.getId() and any one of SkuRef field values. Note that for any SkuInventory record, there can be only one unique SKU identifier, which includes any number of unique fields, per InventoryLocation.
    • 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)
      Retrieves SkuInventory records, filtering on SkuRef, based on the skuReferenceFieldType parameter, and InventoryLocation.getId().
      Parameters:
      skuReferences -
      minQuantity - - (optional) the expected minimum quantity available
      locationId - - the inventory location in which to find inventory
      skuReferenceFieldType - - the type of SKU reference (identifies what SkuRef field should be filtered by the skuReferences argument
      context -
      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 (see Trackable.getContextId()). If a NarrowExecutor implementation was specified via Narrow, the result should be narrowed based on sandbox and catalog state. This overrides the method TrackableRepository.findByContextId(String, ContextInfo). The mixin implementation will provide an exclusive write lock, if applicable, to prevent concurrent modification of SkuInventory records.
      Parameters:
      contextId - An identifying id
      contextInfo - 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 (see Trackable.getContextId()). If a NarrowExecutor implementation was specified via Narrow, the result should be narrowed based on sandbox and catalog state. This overrides the method TrackableRepository.findAllByContextId(Iterable, ContextInfo). The mixin implementation will provide an exclusive write lock, if applicable, to prevent concurrent modification of SkuInventory records.
      Parameters:
      contextIds - A list of identifying ids
      contextInfo - 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 the SkuInventory, identified by skuReference, is available for the specified quantity across one or more InventoryLocations, identified by their allowed fulfillment types. SkuRef is determined by the skuReference argument and the
      Parameters:
      skuReference -
      quantity - - requested quantity
      skuReferenceFieldType - - the type of skuReference being passed in
      shippingLocation - - 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 available SkuInventory 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)
      Finds SkuInventory 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)
      Finds SkuInventory 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 id
      filters - additional filters to apply in the query, can be null
      context - 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 the SkuInventory for the specified inventory location id
      Parameters:
      inventoryLocationId - the inventory location id
      contextInfo - 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.skuCode
      shippingLocation - Indicates if we want to include availability at shipping locations
      pickupLocation - - Indicates if we want to include availability at pickup locations
      storeLocation - - Indicates if we want to include availability at store locations
      context - 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 a Map of 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 inventory
      shippingLocation - whether the inventory can come from a shipping location
      pickupLocation - whether the inventory can come from a pickup location
      storeLocation - whether the inventory can come from a store or shopping location
      context - the context for which this query should be applied
      Returns: