Interface AssetService<P extends Asset>
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
- All Known Implementing Classes:
DefaultAssetService
public interface AssetService<P extends Asset>
extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Base service API for
Asset. Backed by a AssetRepository.- Author:
- Nathan Moore (nathanmoore)., Samarth Dhruva (samarthd)
-
Method Summary
Modifier and TypeMethodDescriptionbooleanexistsByFolderId(String folderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether or not there are any assets withfolderIdas theirAsset.folderId.org.springframework.data.domain.Page<Asset>readAllAssetsInFolder(String folderId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageInfo, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all of the assets in the given folder.org.springframework.data.domain.Page<P>readAllByContextIds(List<String> assetIds, org.springframework.data.domain.Pageable pageInfo, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds all asset with IDs in the supplied list.readByUrlAndStorageType(String url, String storageType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds the asset whose url and storage type (optional) match the provided values.readByUrlStartsWithAndStorageType(String prefix, String storageType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds all of the assets whose URL begins with a given string and whose storage type matches the given value.org.springframework.data.domain.Page<P>searchAll(String searchString, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageInfo, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) IfsearchStringis provided, then this method will search for assets whoseAsset.url,Asset.title,Asset.altText, orAsset.tagscontain it.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
-
searchAll
org.springframework.data.domain.Page<P> searchAll(@Nullable String searchString, cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageInfo, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) IfsearchStringis provided, then this method will search for assets whoseAsset.url,Asset.title,Asset.altText, orAsset.tagscontain it.If no
searchStringis provided, then this method will simply return all assets.This method also supports RSQL filtration via
filters.- Parameters:
searchString- (optional) a string which should be found inAsset.url,Asset.title,Asset.altText, orAsset.tagsfilters- additional filters to apply in the query. Should beEmptyNodeif no additional filters should be applied.pageInfo- information about which page of results to return from the databasecontextInfo- context information surrounding sandboxing/multitenant state- Returns:
- the assets matching the given search/filter arguments if provided, otherwise all assets
-
readByUrlAndStorageType
Optional<P> readByUrlAndStorageType(String url, @Nullable String storageType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds the asset whose url and storage type (optional) match the provided values.- Parameters:
url- the url which should match withAsset.urlstorageType- (optional) the storage type which should match withAsset.storageType. If left null, results will not be filtered by storage type.contextInfo- context information around sandboxing and multitenant state- Returns:
- an optional containing the asset whose url and storage type (optional) match the provided values, empty otherwise
-
readByUrlStartsWithAndStorageType
List<P> readByUrlStartsWithAndStorageType(String prefix, String storageType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds all of the assets whose URL begins with a given string and whose storage type matches the given value.- Parameters:
prefix- the string which eachAsset.urlshould start withstorageType- the storage type which should match withAsset.storageTypecontextInfo- context information around sandbox and multitenant state- Returns:
- a list of
Assetswhoseurlsstart with the given prefix and whosestorage typeshave the given value
-
readAllByContextIds
org.springframework.data.domain.Page<P> readAllByContextIds(List<String> assetIds, @Nullable org.springframework.data.domain.Pageable pageInfo, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds all asset with IDs in the supplied list.- Parameters:
assetIds- the asset context IDs to search forpageInfo- pagination informationcontextInfo- the context to perform the operation in- Returns:
- the asset that matched with the IDs in the given list
-
readAllAssetsInFolder
org.springframework.data.domain.Page<Asset> readAllAssetsInFolder(@Nullable String folderId, cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageInfo, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads all of the assets in the given folder.- Parameters:
folderId- the context ID of the folder whose children asset should be returned. If null, this will return all assets that are not in a folder.filters- additional filters to apply in the query. Should beEmptyNodeif no additional filters should be applied.pageInfo- pagination informationcontextInfo- the context to perform the operation in- Returns:
- all of the assets in the given folder. Throws
EntityMissingExceptionif no folder was found with the given folderId.
-
existsByFolderId
boolean existsByFolderId(String folderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Returns whether or not there are any assets withfolderIdas theirAsset.folderId. Essentially, this determines if there are any child assets directly in the given folder.- Parameters:
folderId- the context ID of the folder whose assets should be foundcontextInfo- the context surrounding sandboxing and mulitenant state- Returns:
- whether or not there are any assets with
folderIdas theirAsset.folderId
-