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 TypeMethodDescriptionboolean
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 theCategories
that match thecontextIds
.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 IDreadByExternalIdIn
(Collection<String> externalIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find a list of categories by the supplied external IDsorg.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 IDsFinds 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 forcontextInfo
- 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 forpage
- the requested page of results from the databasecontext
- 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 forcontextInfo
- 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. IfrootsOnly
is true, then results are also filtered to only include categories that have no specifiedparent category
.- Parameters:
rootsOnly
- if true, restricts results to only include categories that have not specified aparent category
name
- the category name to filter byfilters
- additional filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.page
- the requested page of results from the databasecontext
- 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. IfrootsOnly
is true, then results are also filtered to only include categories that have no specifiedparent category
.- Parameters:
names
- the category names to filter bycontext
- 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 foundfilters
- additional filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.page
- the requested page of results from the databasecontextInfo
- 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 foundcontextInfo
- 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 isCategoryProductMembershipType.EXPLICIT
, will check if there is aCategoryProduct
between the supplied category and product. If the category isCategoryProductMembershipType.RULE_BASED
, will evaluate thecategory'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 withproductId
- the context ID of the product to checkcontextInfo
- 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
, orOptional.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 theCategories
that match thecontextIds
.- Parameters:
ids
- IDs to match againstcontext
- the current context to look in- Returns:
- All the
Categories
that match thecontextIds
.
-
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 forcontextInfo
- 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 forfilters
- additional filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.page
- the requested page of results from the databasecontextInfo
- 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 IDcontextInfo
- the context around sandboxing and multitenant state
-
getRepositoryDomain
-