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 Type
    Method
    Description
    boolean
    existsByFolderId(String folderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns whether or not there are any assets with folderId as their Asset.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)
    If searchString is provided, then this method will search for assets whose Asset.url, Asset.title, Asset.altText, or Asset.tags contain 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, updateSort

    Methods 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)
      If searchString is provided, then this method will search for assets whose Asset.url, Asset.title, Asset.altText, or Asset.tags contain it.

      If no searchString is 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 in Asset.url, Asset.title, Asset.altText, or Asset.tags
      filters - additional filters to apply in the query. Should be EmptyNode if no additional filters should be applied.
      pageInfo - information about which page of results to return from the database
      contextInfo - 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 with Asset.url
      storageType - (optional) the storage type which should match with Asset.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 each Asset.url should start with
      storageType - the storage type which should match with Asset.storageType
      contextInfo - context information around sandbox and multitenant state
      Returns:
      a list of Assets whose urls start with the given prefix and whose storage types have 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 for
      pageInfo - pagination information
      contextInfo - 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 be EmptyNode if no additional filters should be applied.
      pageInfo - pagination information
      contextInfo - the context to perform the operation in
      Returns:
      all of the assets in the given folder. Throws EntityMissingException if 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 with folderId as their Asset.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 found
      contextInfo - the context surrounding sandboxing and mulitenant state
      Returns:
      whether or not there are any assets with folderId as their Asset.folderId