Interface CategoryService<P extends Category>

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

public interface CategoryService<P extends Category> extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Service API for Categories. Supported by CategoryRepository.
Author:
Jeff Fischer, Samarth Dhruva (samarthd)
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    checkRelatedProductMembershipInCategory(String categoryId, String productId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Checks whether a product is a member of the given category.
    boolean
    existsById(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns whether there is a category with the given context ID in the data store.
     
    readAllByContextIds(Collection<String> categoryIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Return all of the categories with IDs in the supplied collection.
    org.springframework.data.domain.Page<P>
    readAllByContextIds(Collection<String> categoryIds, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Return all of the categories with IDs in the supplied list.
    readAllById(Iterable<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Retrieves of all the Categories that match the contextIds.
    org.springframework.data.domain.Page<P>
    readAllByName(boolean rootsOnly, String name, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Read all categories, filtered by name.
    readAllByNamesIn(Collection<String> names, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Read all categories, filtered by name.
    org.springframework.data.domain.Page<P>
    readAllByParentCategoryId(String parentCategoryId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Read all categories in the database that have the given category context ID set as their parent category.
    org.springframework.data.domain.Page<P>
    readAllByParentCategoryIdIn(List<String> parentCategoryIds, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    readAllByUrls(Iterable<String> urls, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Finds a categories by the given urls.
    readByExternalId(String externalId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Find a category by its external ID
    readByExternalIdIn(Collection<String> externalIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Find a list of categories by the supplied external IDs
    org.springframework.data.domain.Page<P>
    readByExternalIdIn(Collection<String> externalIds, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Find categories by their external IDs
    readByUrl(String url, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Finds a category by the given url.
    streamByParentCategoryId(String parentCategoryId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Read all categories in the database that have the given category context ID set as their parent category.

    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

    • existsById

      boolean existsById(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Returns whether there is a category with the given context ID in the data store.
      Parameters:
      id - the ID to search for
      contextInfo - context information around sandboxing and multitenant state
      Returns:
      true if a category exists matching the given ID, false otherwise
    • readAllByContextIds

      org.springframework.data.domain.Page<P> readAllByContextIds(@NonNull Collection<String> categoryIds, @NonNull org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Return all of the categories with IDs in the supplied list.
      Parameters:
      categoryIds - the category context IDs to search for
      page - the requested page of results from the database
      context - the context to perform the operation in
      Returns:
      the categories that matched with the IDs in the given list
    • readAllByContextIds

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

      org.springframework.data.domain.Page<P> readAllByName(boolean rootsOnly, @Nullable String name, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Read all categories, filtered by name. If rootsOnly is true, then results are also filtered to only include categories that have no specified parent category.
      Parameters:
      rootsOnly - if true, restricts results to only include categories that have not specified a parent category
      name - the category name to filter by
      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
      context - context information surrounding sandboxing and multitenant state
      Returns:
      all categories, filtered by name and whether they have specified a parent category
    • readAllByNamesIn

      List<P> readAllByNamesIn(@NonNull Collection<String> names, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Read all categories, filtered by name. If rootsOnly is true, then results are also filtered to only include categories that have no specified parent category.
      Parameters:
      names - the category names to filter by
      context - context context information surrounding sandboxing and multitenant state
      Returns:
      all categories, filtered by name and whether they have specified a parent category
    • readAllByParentCategoryId

      org.springframework.data.domain.Page<P> readAllByParentCategoryId(@NonNull String parentCategoryId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read all categories in the database that have the given category context ID set as their parent category.
      Parameters:
      parentCategoryId - the category context ID whose children should be found
      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 - context surrounding sandboxing and multitenant state
      Returns:
      the children categories of the category identified by the given context ID
    • readAllByParentCategoryIdIn

      org.springframework.data.domain.Page<P> readAllByParentCategoryIdIn(@NonNull List<String> parentCategoryIds, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • streamByParentCategoryId

      Stream<P> streamByParentCategoryId(String parentCategoryId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read all categories in the database that have the given category context ID set as their parent category.
      Parameters:
      parentCategoryId - the category context ID whose children should be found
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      the stream of children categories of the category identified by the given context ID
    • checkRelatedProductMembershipInCategory

      boolean checkRelatedProductMembershipInCategory(@NonNull String categoryId, @NonNull String productId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Checks whether a product is a member of the given category. If the category is CategoryProductMembershipType.EXPLICIT, will check if there is a CategoryProduct between the supplied category and product. If the category is CategoryProductMembershipType.RULE_BASED, will evaluate the category's rule string against the product to see if the product satisfies the rule string.
      Parameters:
      categoryId - the context ID of the category to check membership with
      productId - the context ID of the product to check
      contextInfo - context surrounding sandboxing and multitenant state
      Returns:
      true if the product is a member of the category, false otherwise
    • readByUrl

      @NonNull Optional<P> readByUrl(@NonNull String url, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Finds a category by the given url.
      Parameters:
      url - The url to search by
      Returns:
      The Category matching the url, or Optional.empty() if none found
    • readAllByUrls

      @NonNull List<P> readAllByUrls(@NonNull Iterable<String> urls, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Finds a categories by the given urls.
      Parameters:
      urls - The urls to search by
      Returns:
      The Category matching the urls
    • readAllById

      List<P> readAllById(@NonNull Iterable<String> ids, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Retrieves of all the Categories that match the contextIds.
      Parameters:
      ids - IDs to match against
      context - the current context to look in
      Returns:
      All the Categories that match the contextIds.
    • readByExternalIdIn

      List<P> readByExternalIdIn(@NonNull Collection<String> externalIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find a list of categories by the supplied external IDs
      Parameters:
      externalIds - The external IDs to query for
      contextInfo - the context around sandboxing and multitenant state
      Returns:
      A list of categories
    • readByExternalIdIn

      org.springframework.data.domain.Page<P> readByExternalIdIn(Collection<String> externalIds, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find categories by their external IDs
      Parameters:
      externalIds - The external IDs to query 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 around sandboxing and multitenant state
      Returns:
      A page of categories
    • readByExternalId

      P readByExternalId(String externalId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find a category by its external ID
      Parameters:
      externalId - The external ID
      contextInfo - the context around sandboxing and multitenant state
    • getRepositoryDomain

      @NonNull String getRepositoryDomain()