Interface CategoryProductService<P extends CategoryProduct>

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

public interface CategoryProductService<P extends CategoryProduct> extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Service API for CategoryProducts. Supported by CategoryProductRepository.
Author:
Samarth Dhruva (samarthd)
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    existsByJoinedIds(String productId, String categoryId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns whether there is a category-product relationship for the given product and category in the data store.
    org.springframework.data.domain.Page<P>
    readAllByCategoryIdAndIsSorted(String categoryId, boolean isSorted, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Finds all CategoryProducts for the given Category.id and CategoryProduct.sorted values.
    org.springframework.data.domain.Page<P>
    readAllByCategoryIdAndProductIdsAndIsSorted(String categoryId, List<String> productIds, boolean isSorted, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Finds all CategoryProducts for the given Category.id, Product.id, and CategoryProduct.sorted values.
    readAllByCategoryIdIn(@NonNull Collection<String> categoryIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads a list of CategoryProducts by ID.
    readAllByProductIdIn(Collection<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads all of the category products which are associated with any of the given productIds.
    org.springframework.data.domain.Page<P>
    readByCategoryContextId(String categoryContextId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all of the CategoryProduct relationships in the database associated with the given category context ID.
    org.springframework.data.domain.Page<P>
    readByCategoryContextIdAndProductIds(String categoryContextId, List<String> productIds, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all CategoryProduct relationships in the database associated with the given category context ID and Product IDs.
    org.springframework.data.domain.Page<P>
    readByCategoryIdIn(Collection<String> categoryIds, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads a page of CategoryProducts by ID.
    readByIdAndCategoryId(String id, String categoryId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Finds the CategoryProduct which has the given ID and parent category ID.
    readByJoinedIds(String productId, String categoryId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Query for a CategoryProduct that joins a given product and category.
    org.springframework.data.domain.Page<P>
    readByProductContextId(String productContextId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all of the CategoryProduct relationships in the database associated with the given product context ID.
    org.springframework.data.domain.Page<P>
    readPageForCategory(Category category, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters, Boolean isSorted, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Finds a page of CategoryProducts for the given Category and additional inputs.
    readPrimaryByProductIdIn(Collection<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all CategoryProducts whose product ID is in one of the given values and whose CategoryProduct.primary is true.

    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

    • existsByJoinedIds

      boolean existsByJoinedIds(String productId, String categoryId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Returns whether there is a category-product relationship for the given product and category in the data store.
      Parameters:
      productId - the product context ID
      categoryId - the category context ID
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      true if a relationship was found between the product and category, false otherwise
    • readByCategoryContextId

      @NonNull org.springframework.data.domain.Page<P> readByCategoryContextId(@NonNull String categoryContextId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all of the CategoryProduct relationships in the database associated with the given category context ID.
      Parameters:
      categoryContextId - the category context ID to find the relationships for
      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 CategoryProduct relationships in the database that match the given category context ID
    • readByCategoryContextIdAndProductIds

      @NonNull org.springframework.data.domain.Page<P> readByCategoryContextIdAndProductIds(@NonNull String categoryContextId, List<String> productIds, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all CategoryProduct relationships in the database associated with the given category context ID and Product IDs.
      Parameters:
      categoryContextId - the category context ID to find the relationships for
      productIds - the list of Product.ids to retrieve
      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 CategoryProduct relationships in the database that match the given category context ID
    • readByProductContextId

      @NonNull org.springframework.data.domain.Page<P> readByProductContextId(@NonNull String productContextId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all of the CategoryProduct relationships in the database associated with the given product context ID.
      Parameters:
      productContextId - the product context ID to find the relationships for
      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 CategoryProduct relationships in the database that match the given category context ID
    • readAllByProductIdIn

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

      @NonNull org.springframework.data.domain.Page<P> readAllByCategoryIdAndIsSorted(@NonNull String categoryId, boolean isSorted, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Finds all CategoryProducts for the given Category.id and CategoryProduct.sorted values.
      Parameters:
      categoryId - parent Category.id
      isSorted - Whether to return CategoryProducts where CategoryProduct.sorted is true, else false.
      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 CategoryProducts with the given categoryId and sorting values
    • readAllByCategoryIdAndProductIdsAndIsSorted

      @NonNull org.springframework.data.domain.Page<P> readAllByCategoryIdAndProductIdsAndIsSorted(@NonNull String categoryId, List<String> productIds, boolean isSorted, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Finds all CategoryProducts for the given Category.id, Product.id, and CategoryProduct.sorted values.
      Parameters:
      categoryId - parent Category.id
      productIds - the list of Product.ids to retrieve
      isSorted - Whether to return CategoryProducts where CategoryProduct.sorted is true, else false.
      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 CategoryProducts with the given categoryId and sorting values
    • readByJoinedIds

      @NonNull Optional<P> readByJoinedIds(@NonNull String productId, @NonNull String categoryId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Query for a CategoryProduct that joins a given product and category.
      Parameters:
      productId - the product context ID
      categoryId - the category context ID
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      an Optional that is either empty or contains the CategoryProduct that was found
    • readByIdAndCategoryId

      @NonNull P readByIdAndCategoryId(@NonNull String id, @NonNull String categoryId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Finds the CategoryProduct which has the given ID and parent category ID.
      Parameters:
      id - the context ID of the CategoryProduct
      categoryId - the context ID of the parent Category
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      the category product that has the given ID and parent category ID
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if no such CategoryProduct was found
    • readByCategoryIdIn

      @NonNull org.springframework.data.domain.Page<P> readByCategoryIdIn(@NonNull Collection<String> categoryIds, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads a page of CategoryProducts by ID.
      Parameters:
      categoryIds - Category IDs to match against
      page - Pagination info
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      A page of CategoryProducts by ID.
    • readAllByCategoryIdIn

      @NonNull List<P> readAllByCategoryIdIn(@NonNull @NonNull Collection<String> categoryIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads a list of CategoryProducts by ID.
      Parameters:
      categoryIds - Category IDs to match against
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      A list of CategoryProducts by ID.
    • readPrimaryByProductIdIn

      @NonNull Map<String,P> readPrimaryByProductIdIn(@NonNull Collection<String> productIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all CategoryProducts whose product ID is in one of the given values and whose CategoryProduct.primary is true.

      This essentially finds the relationships between the given products and their primary categories.

      For any given product ID, there should only be one primary category, but in the event more than one result is found, only the first will be used.

      Parameters:
      productIds - the ids of the products for which to find primary category-product relationships
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      a map from product ID to the category-product found for it. If no category-product was found for a product id, it will not have an entry in the resulting map.
    • readPageForCategory

      org.springframework.data.domain.Page<P> readPageForCategory(@NonNull Category category, @Nullable org.springframework.data.domain.Pageable page, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable Boolean isSorted, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Finds a page of CategoryProducts for the given Category and additional inputs.
      Parameters:
      category - The parent category
      page - Pagination info
      filters - RSQL filters
      isSorted - Whether to read only CategoryProducts that have a sort value.
      contextInfo - Additional multitenant and sandbox info
      Returns:
      Page of CategoryProducts for the given Category.