Interface StaticAssetStorageService
- All Known Implementing Classes:
StaticAssetStorageServiceImpl
public interface StaticAssetStorageService
- Author:
- Jeff Fischer
-
Method Summary
Modifier and TypeMethodDescriptioncreate()
Deprecated.Use createStaticAssetStorageFromFile instead.createBlob
(InputStream uploadedFileInputStream, long fileSize) Creates a blob from an input stream with a given filesize.createBlob
(org.springframework.web.multipart.MultipartFile uploadedFile) Deprecated.Use createStaticAssetStorageFromFile instead.void
createStaticAssetStorage
(InputStream fileInputStream, StaticAsset staticAsset) Similar tocreateStaticAssetStorageFromFile(MultipartFile, StaticAsset)
except that this does not depend on an uploaded file and can support more generic use casesvoid
createStaticAssetStorageFromFile
(org.springframework.web.multipart.MultipartFile file, StaticAsset staticAsset) Persists the file to the DB or FileSystem according to the staticAsset's StorageType.void
delete
(StaticAssetStorage assetStorage) Removes a static asset from the database.Returns a StaticAssetStorage object.getCacheFileModel
(String fullUrl, Map<String, String> parameterMap) Returns a StaticAssetStorage object using the id of a related StaticAsset.save
(StaticAssetStorage assetStorage) Persists a static asset to the database.void
validateFileSize
(org.springframework.web.multipart.MultipartFile file) Validates given file with the maximum upload file size value
-
Method Details
-
findStaticAssetStorageById
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
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
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
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 controllerstaticAsset
- theStaticAsset
entity to obtain storage information from like file size and the file name, usually created fromStaticAssetService.createStaticAssetFromFile(MultipartFile, Map)
- Throws:
IOException
-
createStaticAssetStorage
void createStaticAssetStorage(InputStream fileInputStream, StaticAsset staticAsset) throws IOException Similar tocreateStaticAssetStorageFromFile(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 filestaticAsset
- theStaticAsset
entity to obtain storage information from like file size and the file name, usually created fromStaticAssetService.createStaticAsset(InputStream, String, long, Map)
- Throws:
IOException
-
validateFileSize
Validates given file with the maximum upload file size value- Parameters:
file
-- Throws:
IOException
-