Interface StaticAssetStorageService

All Known Implementing Classes:
StaticAssetStorageServiceImpl

public interface StaticAssetStorageService
Author:
Jeff Fischer
  • Method Details

    • findStaticAssetStorageById

      StaticAssetStorage findStaticAssetStorageById(Long id)
      Returns a StaticAssetStorage object. Assumes that the asset is stored in the Database.

      Storing Assets in the DB is not the preferred mechanism for Broadleaf as of 3.0 so in most cases, this method would not be used by Broadleaf implementations.

      Parameters:
      id -
      Returns:
    • create

      Deprecated.
      Use createStaticAssetStorageFromFile instead.
      Returns:
    • readStaticAssetStorageByStaticAssetId

      StaticAssetStorage readStaticAssetStorageByStaticAssetId(Long id)
      Returns a StaticAssetStorage object using the id of a related StaticAsset. Assumes that the asset is stored in the Database.

      Storing Assets in the DB is not the preferred mechanism for Broadleaf as of 3.0 so in most cases, this method would not be used by Broadleaf implementations.

      Parameters:
      id -
      Returns:
    • save

      Persists a static asset to the database. Not typically used since Broadleaf 3.0 as the preferred method for storing assets is on a shared-filesystem.
      Parameters:
      assetStorage -
      Returns:
    • delete

      void delete(StaticAssetStorage assetStorage)
      Removes a static asset from the database. Not typically used since Broadleaf 3.0 as the preferred method for storing assets is on a shared-filesystem.
      Parameters:
      assetStorage -
    • createBlob

      @Deprecated Blob createBlob(org.springframework.web.multipart.MultipartFile uploadedFile) throws IOException
      Deprecated.
      Use createStaticAssetStorageFromFile instead.
      Parameters:
      uploadedFile -
      Returns:
      Throws:
      IOException
    • createBlob

      Blob createBlob(InputStream uploadedFileInputStream, long fileSize) throws IOException
      Creates a blob from an input stream with a given filesize. This method wraps the call in a transactional tag.
      Parameters:
      uploadedFileInputStream -
      fileSize -
      Returns:
      Throws:
      IOException
    • getCacheFileModel

      Map<String,String> getCacheFileModel(String fullUrl, Map<String,String> parameterMap) throws Exception
      Parameters:
      fullUrl -
      parameterMap -
      Returns:
      Throws:
      Exception
    • createStaticAssetStorageFromFile

      void createStaticAssetStorageFromFile(org.springframework.web.multipart.MultipartFile file, StaticAsset staticAsset) throws IOException
      Persists the file to the DB or FileSystem according to the staticAsset's StorageType. Typically, the MultipartFile is passed in from a Controller like the AdminAssetUploadController
      Parameters:
      file - the uploaded file from the Spring controller
      staticAsset - the StaticAsset entity to obtain storage information from like file size and the file name, usually created from StaticAssetService.createStaticAssetFromFile(MultipartFile, Map)
      Throws:
      IOException
    • createStaticAssetStorage

      void createStaticAssetStorage(InputStream fileInputStream, StaticAsset staticAsset) throws IOException
      Similar to createStaticAssetStorageFromFile(MultipartFile, StaticAsset) except that this does not depend on an uploaded file and can support more generic use cases
      Parameters:
      fileInputStream - the input stream of the uploaded file
      staticAsset - the StaticAsset entity to obtain storage information from like file size and the file name, usually created from StaticAssetService.createStaticAsset(InputStream, String, long, Map)
      Throws:
      IOException
    • validateFileSize

      void validateFileSize(org.springframework.web.multipart.MultipartFile file) throws IOException
      Validates given file with the maximum upload file size value
      Parameters:
      file -
      Throws:
      IOException