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 TypeMethodDescriptionlongcountNonProductionRecordsByProductIdsInTenant(Collection<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Returns the count of non-production records that match the givenproductContextIdsand 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 givenproductIds.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 givenproductIds.readAllLowestSortValueByProductIds(List<String> productContextIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds theProductAssetwith the lowestSortable.getSorting()value for each of the products provided inproductContextIds, and returns its sort value.readAllPrimaryAssetsByProductIds(Iterable<String> productIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all of the primaryProductAssetsfor the given product IDs.readAllPrimaryAssetsByProductIdsExcludeAssetIds(Iterable<String> productIds, Iterable<String> assetIdsToExclude, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all the primaryProductAssetsfor the given product IDs excluding given asset IDs.readByProductIdAndPrimaryTrue(String productId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds the primaryProductAssetfor the givenProductAsset.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 allProductAssetsfor 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, updateSortMethods 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 allProductAssetsfor the given product ID, optionally filtering by additional search/filter arguments.If
searchStringis provided, then this method will search for assets whoseEntityAsset.url,EntityAsset.title,EntityAsset.altText, orEntityAsset.tagscontain it.If no
searchStringis 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 againstisSorted- (optional) if not-null, will restrict results to only includeProductAssetswhereProductAsset.sortedhas the given valuesearchString- (optional) a string which should be found inEntityAsset.url,EntityAsset.title,EntityAsset.altText, orEntityAsset.tagsfilters- additional filters to apply in the query. Should beEmptyNodeif no additional filters should be applied.page- the requested page of results from the databasecontextInfo- 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 givenproductIds.- Parameters:
productIds- a collection of product IDs which the results must be associated withcontext- 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 givenproductIds.- Parameters:
productIds- a collection of product IDs which the results must be associated withfilters- additional filters to apply in the query. Should beEmptyNodeif 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 primaryProductAssetfor the givenProductAsset.productId.- Parameters:
productId- the value to match againstProductAsset.productIdcontextInfo- 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 primaryProductAssetsfor the given product IDs.- Parameters:
productIds- IDs of the products for which to read primary assetscontextInfo- context information around sandboxing and multitenant state- Returns:
- all of the primary
ProductAssetsfor 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 primaryProductAssetsfor the given product IDs excluding given asset IDs.- Parameters:
productIds- IDs of the products for which to find primary assetsassetIdsToExclude- IDs of the assets to excludecontextInfo- context information around sandboxing and multitenant state- Returns:
- the primary
ProductAssetsfor 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 givenproductContextIdsand the given tenant context.- Parameters:
productIds- IDs of parent Products to match againstcontext- Request context information around sandbox and multitenant state- Returns:
- the count of non-production records that match the given
productContextIdsand the given tenant context
-
readAllLowestSortValueByProductIds
Map<String,String> readAllLowestSortValueByProductIds(List<String> productContextIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds theProductAssetwith the lowestSortable.getSorting()value for each of the products provided inproductContextIds, and returns its sort value.- Parameters:
productContextIds- IDs of parent Products to match againstcontextInfo- Request context information around sandbox and multitenant state- Returns:
- pairings of product IDs to the lowest sort value found for the specified ID
-
getRepositoryDomain
-