Interface ProductService<P extends Product>
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>
,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
- All Known Implementing Classes:
DefaultProductService
public interface ProductService<P extends Product>
extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
- Author:
- Jeff Fischer, Samarth Dhruva (samarthd)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
existsById
(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether there is a product with the given context ID in the data store.org.springframework.data.domain.Page<P>
readAllByCategoryContextId
(String categoryContextId, 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 products in a given category.readAllByContextIds
(Collection<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Return all of the products with IDs in the supplied collection.org.springframework.data.domain.Page<P>
readAllByContextIds
(Collection<String> productIds, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Return all of the products with IDs in the supplied list.readAllByExternalIds
(Collection<String> externalIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetches products based on the provided external IDs.readAllByFiltersExcluding
(cz.jirutka.rsql.parser.ast.Node filters, List<String> exclusions, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns all of the products matching the given filters, excluding any products whose IDs match any of the values inexclusions
.org.springframework.data.domain.Page<P>
readAllByName
(String name, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) readAllByUris
(Iterable<String> uris, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds the product matching theuris
.readAllSkusByProduct
(P product, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads all the SKUs for the the specified product.readAllSkusByProductId
(String productId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads all the SKUs for the the specified product ID.readAllSkusByProductIdAndQuery
(String productId, String sku, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads all the SKUs for the the specified product ID and SKU identifier.readAllUniqueIds
(int page, cz.jirutka.rsql.parser.ast.Node filters) Return all of the unique product IDs.readAllUniqueIdsPerContext
(int page, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieves a narrowed list of unique product context IDs narrowed on aContextInfo
readAllUniqueIdsPerContextWithOptionalStipulations
(cz.jirutka.rsql.parser.ast.Node filters, ProductStipulations stipulations, int pageSize, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieves a list of unique product context IDs narrowed on aContextInfo
Read a product by a given URIMethods 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 product 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 product exists matching the given ID, false otherwise
-
readAllByName
-
readAllByContextIds
org.springframework.data.domain.Page<P> readAllByContextIds(@NonNull Collection<String> productIds, @NonNull org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Return all of the products with IDs in the supplied list.- Parameters:
productIds
- the product context IDs to search forpage
- the requested page of results from the databasecontext
- the context to perform the operation in- Returns:
- the products that matched with the IDs in the given list
-
readAllByFiltersExcluding
Stream<P> readAllByFiltersExcluding(@NonNull cz.jirutka.rsql.parser.ast.Node filters, @Nullable List<String> exclusions, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns all of the products matching the given filters, excluding any products whose IDs match any of the values inexclusions
.- Parameters:
filters
- the RSQLNode
used to restrict results, must not be nullexclusions
- a list of product IDs that should be excluded from the resultscontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- all of the products matching the given filters, excluding any products whose IDs
match any of the values in
exclusions
-
readAllByContextIds
List<P> readAllByContextIds(@NonNull Collection<String> productIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Return all of the products with IDs in the supplied collection.- Parameters:
productIds
- the product context IDs to search forcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the products that matched with the IDs in the given collection
-
readByUri
Optional<P> readByUri(String uri, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read a product by a given URI- Parameters:
uri
- the URI to search for- Returns:
- an Optional representing a found Product or an empty optional if none found
-
readAllUniqueIds
Return all of the unique product IDs.- Parameters:
page
- the requested amount of results from the database. -1 indicates no limit.filters
- additional filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.- Returns:
- unique product IDs
-
readAllUniqueIdsPerContext
List<String> readAllUniqueIdsPerContext(int page, @NonNull cz.jirutka.rsql.parser.ast.Node filters, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieves a narrowed list of unique product context IDs narrowed on aContextInfo
- Parameters:
page
- the requested amount of results from the database. -1 indicates no limit.filters
- additional filters to apply in the query. Should beEmptyNode
if no additional filters should be applied.context
- The context used to help narrowing. For example, narrowing results to a particular catalog.- Returns:
- The narrowed list of unique product context IDs
-
readAllUniqueIdsPerContextWithOptionalStipulations
List<String> readAllUniqueIdsPerContextWithOptionalStipulations(@Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable ProductStipulations stipulations, int pageSize, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieves a list of unique product context IDs narrowed on aContextInfo
- Parameters:
filters
- additional filters to apply in the query.stipulations
- Additional filtering context to be applied during product fetch. Optional.pageSize
- the requested amount of results from the database. -1 indicates no limit.context
- The context used to help narrowing. For example, narrowing results to a particular catalog.- Returns:
- The narrowed list of unique product context IDs
-
readAllSkusByProductId
List<SKUContainer> readAllSkusByProductId(@NonNull String productId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads all the SKUs for the the specified product ID.- Parameters:
productId
- the product IDcontext
- the information surrounding sandboxing and multitenant state- Returns:
- the list of
SKUContainer
for the specified product ID - See Also:
-
readAllSkusByProduct
List<SKUContainer> readAllSkusByProduct(@NonNull P product, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads all the SKUs for the the specified product. This method is the same asreadAllSkusByProductId(String, ContextInfo)
except it does not perform any query forProduct
and directly uses the POJO's id and sku for producing the result.- Parameters:
product
- theProduct
context
- the information surrounding sandboxing and multitenant state- Returns:
- the list of
SKUContainer
for the specified product ID
-
readAllSkusByProductIdAndQuery
List<SKUContainer> readAllSkusByProductIdAndQuery(@NonNull String productId, @NonNull String sku, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads all the SKUs for the the specified product ID and SKU identifier.- Parameters:
productId
- the product IDsku
- the SKU identifier to searchfilters
- the RSQLNode
used to restrict resultpage
- the requested page of results from the databasecontext
- the information surrounding sandboxing and multitenant state- Returns:
- the list of
SKUContainer
for the specified Product id
-
getRepositoryDomain
-
readAllByUris
List<P> readAllByUris(@NonNull Iterable<String> uris, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds the product matching theuris
.- Parameters:
uris
- URIs to matchcontextInfo
- the information surrounding sandboxing and multitenant state- Returns:
- The product matching the
uris
-
readAllByExternalIds
List<P> readAllByExternalIds(@NonNull Collection<String> externalIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Fetches products based on the provided external IDs.- Parameters:
externalIds
- a collection of external IDscontextInfo
- the information surrounding sandboxing and multitenant state- Returns:
- Products matching the provided external IDs
-
readAllByCategoryContextId
org.springframework.data.domain.Page<P> readAllByCategoryContextId(@NonNull String categoryContextId, @Nullable Boolean isSorted, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @NonNull org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds all products in a given category.- Parameters:
categoryContextId
- the context id of the category.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 amount of results from the database. -1 indicates no limit.contextInfo
- Request context information around sandbox and multitenant state- Returns:
- All the products in the given category
-