Interface ProductAssetService<P extends ProductAsset>

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

public interface ProductAssetService<P extends ProductAsset> extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Service API for ProductAssets. Supported by ProductAssetRepository.
Author:
Samarth Dhruva (samarthd)
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    countNonProductionRecordsByProductIdsInTenant(Collection<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns the count of non-production records that match the given productContextIds and the given tenant context.
     
    readAllByProductIdIn(Collection<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads all of the product assets which are associated with any of the given productIds.
    readAllByProductIdIn(Collection<String> productIds, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads all of the product assets which are associated with any of the given productIds.
    readAllPrimaryAssetsByProductIds(Iterable<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all of the primary ProductAssets for the given product IDs.
    readAllPrimaryAssetsByProductIdsExcludeAssetIds(Iterable<String> productIds, Iterable<String> assetIdsToExclude, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all the primary ProductAssets for the given product IDs excluding given asset IDs.
    readByProductIdAndPrimaryTrue(String productId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Finds the primary ProductAsset for the given ProductAsset.productId.
    org.springframework.data.domain.Page<P>
    searchAllWithProductId(String productId, Boolean isSorted, String searchString, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Finds all ProductAssets for the given product ID, optionally filtering by additional search/filter arguments.

    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

    • searchAllWithProductId

      org.springframework.data.domain.Page<P> searchAllWithProductId(String productId, @Nullable Boolean isSorted, @Nullable String searchString, cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Finds all ProductAssets for the given product ID, optionally filtering by additional search/filter arguments.

      If searchString is provided, then this method will search for assets whose EntityAsset.url, EntityAsset.title, EntityAsset.altText, or EntityAsset.tags contain it.

      If no searchString is provided, then this method will simply return all assets for the given product.

      This method also supports RSQL filtration via filters.

      Parameters:
      productId - the value which the product ID should match against
      isSorted - (optional) if not-null, will restrict results to only include ProductAssets where ProductAsset.sorted has the given value
      searchString - (optional) a string which should be found in EntityAsset.url, EntityAsset.title, EntityAsset.altText, or EntityAsset.tags
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      page - the requested page of results from the database
      contextInfo - the context to query within
      Returns:
      the assets in the database with the given product ID, optionally filtered by the given search/filter arguments (if provided)
    • readAllByProductIdIn

      List<P> readAllByProductIdIn(Collection<String> productIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Reads all of the product assets 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 product assets which are associated with any of the given productIds
    • readAllByProductIdIn

      List<P> readAllByProductIdIn(Collection<String> productIds, cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Reads all of the product assets which are associated with any of the given productIds.
      Parameters:
      productIds - a collection of product IDs which the results must be associated with
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      context - context information surrounding sandboxing and multitenant state
      Returns:
      all of the product assets which are associated with any of the given productIds
    • readByProductIdAndPrimaryTrue

      Optional<P> readByProductIdAndPrimaryTrue(String productId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Finds the primary ProductAsset for the given ProductAsset.productId.
      Parameters:
      productId - the value to match against ProductAsset.productId
      contextInfo - context information around sandboxing and multitenant state
      Returns:
      an optional containing the primary asset for a product, empty otherwise
    • readAllPrimaryAssetsByProductIds

      List<P> readAllPrimaryAssetsByProductIds(Iterable<String> productIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all of the primary ProductAssets for the given product IDs.
      Parameters:
      productIds - IDs of the products for which to read primary assets
      contextInfo - context information around sandboxing and multitenant state
      Returns:
      all of the primary ProductAssets for the given product IDs.
    • readAllPrimaryAssetsByProductIdsExcludeAssetIds

      List<P> readAllPrimaryAssetsByProductIdsExcludeAssetIds(Iterable<String> productIds, Iterable<String> assetIdsToExclude, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all the primary ProductAssets for the given product IDs excluding given asset IDs.
      Parameters:
      productIds - IDs of the products for which to find primary assets
      assetIdsToExclude - IDs of the assets to exclude
      contextInfo - context information around sandboxing and multitenant state
      Returns:
      the primary ProductAssets for the given product IDs excluding given asset IDs.
    • countNonProductionRecordsByProductIdsInTenant

      long countNonProductionRecordsByProductIdsInTenant(@NonNull Collection<String> productIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Returns the count of non-production records that match the given productContextIds and the given tenant context.
      Parameters:
      productIds - IDs of parent Products to match against
      context - Request context information around sandbox and multitenant state
      Returns:
      the count of non-production records that match the given productContextIds and the given tenant context
    • getRepositoryDomain

      @NonNull String getRepositoryDomain()