Interface VariantService<P extends Variant>

All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
All Known Implementing Classes:
DefaultVariantService

public interface VariantService<P extends Variant> extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
The main service dealing with accessing Variants from a backing store
Author:
Phillip Verheyden (phillipuniverse)
  • Method Summary

    Modifier and Type
    Method
    Description
     
    readAllByContextIds(Collection<String> variantIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Return all of the variants with IDs in the supplied collection.
    readAllByExternalIds(Collection<String> externalIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns a List of Variant objects, filtered by a collection of external IDs.
    readAllByIdOrProductId(Collection<String> variantIds, Collection<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Retrieves all Variants with the given variantIds or whose parent Products are in productIds.
    org.springframework.data.domain.Page<P>
    readAllByProductId(String productId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, Class<P> returnType, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    org.springframework.data.domain.Page<P>
    readAllByProductIdAndSkuQuery(String productId, String query, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, Class<P> returnType)
     
    readAllByProductIdIn(Collection<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads all of the variants which are associated with any of the given productIds.
    readAllBySkus(Collection<String> skus, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns a List of Variant objects, filtered by a collection of external IDs.
    readByContextIdOpt(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Read a single instance of an entity in the form of a business domain.
    readByProductIdAndSku(String productId, String sku, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads a specific variant for a given product by its sku code.

    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

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService

    readAll, readAll, readAll, readAll
  • Method Details

    • readByContextIdOpt

      Optional<P> readByContextIdOpt(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Read a single instance of an entity in the form of a business domain.
      Parameters:
      id - The context id for the entity. This is the id by which the business recognizes the item.
      context - Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.
      Returns:
      an Optional containing the narrowed entity instance in the form of a business instance if found, Optional.empty() otherwise
    • readAllByContextIds

      Stream<P> readAllByContextIds(@NonNull Collection<String> variantIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Return all of the variants with IDs in the supplied collection.
      Parameters:
      variantIds - the variant context IDs to search for
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      the variants that matched with the IDs in the given collection
    • readAllByProductId

      org.springframework.data.domain.Page<P> readAllByProductId(@Nullable String productId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @NonNull Class<P> returnType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • readAllByProductIdIn

      Stream<P> readAllByProductIdIn(Collection<String> productIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Reads all of the variants which are associated with any of the given productIds.
      Parameters:
      productIds - a collection of product IDs which the results must be associated with
      context - context information surrounding sandboxing and multitenant state
      Returns:
      all of the variants which are associated with any of the given productIds
    • readAllByProductIdAndSkuQuery

      org.springframework.data.domain.Page<P> readAllByProductIdAndSkuQuery(@Nullable String productId, @NonNull String query, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @NonNull Class<P> returnType)
    • readByProductIdAndSku

      Optional<P> readByProductIdAndSku(@Nullable String productId, @NonNull String sku, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Reads a specific variant for a given product by its sku code.
      Parameters:
      productId - the product ID which the result must be associated with
      sku - the sku code to match agains
      context - context information surrounding sandboxing and multitenant state
      Returns:
      the variant with the associated product and sku code
    • readAllByIdOrProductId

      List<P> readAllByIdOrProductId(@NonNull Collection<String> variantIds, @NonNull Collection<String> productIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Retrieves all Variants with the given variantIds or whose parent Products are in productIds.
      Parameters:
      variantIds - Variant IDs to match against
      productIds - IDs of parent Products to match against
      context - Request context information around sandbox and multitenant state
      Returns:
      All Variants with the given variantIds or whose parent Products are in productIds.
    • readAllByExternalIds

      List<P> readAllByExternalIds(@NonNull Collection<String> externalIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Returns a List of Variant objects, filtered by a collection of external IDs.
      Parameters:
      externalIds - a list of external IDs
      context - context information around sandbox and multitenant state
      Returns:
      a List of variants with the corresponding external IDs provided
    • readAllBySkus

      List<P> readAllBySkus(@NonNull Collection<String> skus, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Returns a List of Variant objects, filtered by a collection of external IDs.
      Parameters:
      skus - a list of SKUs
      context - context information around sandbox and multitenant state
      Returns:
      a List of variants with the corresponding SKUs provided
    • getRepositoryDomain

      @NonNull String getRepositoryDomain()