@Service(value="blStaticAssetStorageService") public class StaticAssetStorageServiceImpl extends Object implements StaticAssetStorageService
Modifier and Type | Field and Description |
---|---|
protected ArtifactService |
artifactService |
protected BroadleafFileService |
broadleafFileService |
protected String |
cacheDirectory |
protected StaticAssetServiceExtensionManager |
extensionManager |
protected int |
fileBufferSize |
protected long |
maxUploadableFileSize |
protected NamedOperationManager |
namedOperationManager |
protected StaticAssetService |
staticAssetService |
protected StaticAssetStorageDao |
staticAssetStorageDao |
Constructor and Description |
---|
StaticAssetStorageServiceImpl() |
Modifier and Type | Method and Description |
---|---|
protected Map<String,String> |
buildModel(String returnFilePath,
String mimeType) |
protected String |
constructCacheFileName(StaticAsset staticAsset,
Map<String,String> parameterMap)
Builds a file system path for the passed in static asset and paramaterMap.
|
StaticAssetStorage |
create() |
Blob |
createBlob(org.springframework.web.multipart.MultipartFile uploadedFile) |
protected void |
createLocalFileFromClassPathResource(StaticAsset staticAsset,
File baseLocalFile) |
protected void |
createLocalFileFromInputStream(InputStream is,
File baseLocalFile) |
void |
createStaticAssetStorage(InputStream fileInputStream,
StaticAsset staticAsset)
Similar to
StaticAssetStorageService.createStaticAssetStorageFromFile(MultipartFile, StaticAsset) except that this does not depend on
an uploaded file and can support more generic use cases |
void |
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.
|
protected StaticAsset |
findStaticAsset(String fullUrl) |
StaticAssetStorage |
findStaticAssetStorageById(Long id)
Returns a StaticAssetStorage object.
|
Map<String,String> |
getCacheFileModel(String fullUrl,
Map<String,String> parameterMap) |
protected File |
getFileFromLocalRepository(String cachedFileName) |
protected File |
lookupAssetAndCreateLocalFile(StaticAsset staticAsset,
File baseLocalFile) |
protected String |
pad(String s,
int length,
char pad) |
StaticAssetStorage |
readStaticAssetStorageByStaticAssetId(Long id)
Returns a StaticAssetStorage object using the id of a related StaticAsset.
|
StaticAssetStorage |
save(StaticAssetStorage assetStorage)
Persists a static asset to the database.
|
protected boolean |
shouldUseSharedFile(InputStream is) |
@Value(value="${asset.server.max.uploadable.file.size}") protected long maxUploadableFileSize
@Value(value="${asset.server.file.buffer.size}") protected int fileBufferSize
protected String cacheDirectory
protected StaticAssetService staticAssetService
protected BroadleafFileService broadleafFileService
protected ArtifactService artifactService
protected StaticAssetStorageDao staticAssetStorageDao
protected NamedOperationManager namedOperationManager
protected StaticAssetServiceExtensionManager extensionManager
protected StaticAsset findStaticAsset(String fullUrl)
protected boolean shouldUseSharedFile(InputStream is)
protected File lookupAssetAndCreateLocalFile(StaticAsset staticAsset, File baseLocalFile) throws IOException, SQLException
IOException
SQLException
protected void createLocalFileFromClassPathResource(StaticAsset staticAsset, File baseLocalFile) throws IOException
IOException
protected void createLocalFileFromInputStream(InputStream is, File baseLocalFile) throws IOException
IOException
@Transactional(value="blTransactionManagerAssetStorageInfo") public Map<String,String> getCacheFileModel(String fullUrl, Map<String,String> parameterMap) throws Exception
getCacheFileModel
in interface StaticAssetStorageService
Exception
@Transactional(value="blTransactionManagerAssetStorageInfo") public StaticAssetStorage findStaticAssetStorageById(Long id)
StaticAssetStorageService
findStaticAssetStorageById
in interface StaticAssetStorageService
@Transactional(value="blTransactionManagerAssetStorageInfo") public StaticAssetStorage create()
create
in interface StaticAssetStorageService
@Transactional(value="blTransactionManagerAssetStorageInfo") public StaticAssetStorage readStaticAssetStorageByStaticAssetId(Long id)
StaticAssetStorageService
readStaticAssetStorageByStaticAssetId
in interface StaticAssetStorageService
@Transactional(value="blTransactionManagerAssetStorageInfo") public StaticAssetStorage save(StaticAssetStorage assetStorage)
StaticAssetStorageService
save
in interface StaticAssetStorageService
@Transactional(value="blTransactionManagerAssetStorageInfo") public void delete(StaticAssetStorage assetStorage)
StaticAssetStorageService
delete
in interface StaticAssetStorageService
@Transactional(value="blTransactionManagerAssetStorageInfo") public Blob createBlob(org.springframework.web.multipart.MultipartFile uploadedFile) throws IOException
createBlob
in interface StaticAssetStorageService
IOException
protected String constructCacheFileName(StaticAsset staticAsset, Map<String,String> parameterMap)
staticAsset
- parameterMap
- useSharedFile
- @Transactional(value="blTransactionManagerAssetStorageInfo") public void createStaticAssetStorageFromFile(org.springframework.web.multipart.MultipartFile file, StaticAsset staticAsset) throws IOException
StaticAssetStorageService
createStaticAssetStorageFromFile
in interface StaticAssetStorageService
file
- the uploaded file from the Spring controllerstaticAsset
- the StaticAsset
entity to obtain storage information from like file size and the file name,
usually created from StaticAssetService.createStaticAssetFromFile(MultipartFile, Map)
IOException
StaticAssetService#createStaticAssetFromFile(MultipartFile, Map)}
@Transactional(value="blTransactionManagerAssetStorageInfo") public void createStaticAssetStorage(InputStream fileInputStream, StaticAsset staticAsset) throws IOException
StaticAssetStorageService
StaticAssetStorageService.createStaticAssetStorageFromFile(MultipartFile, StaticAsset)
except that this does not depend on
an uploaded file and can support more generic use casescreateStaticAssetStorage
in interface StaticAssetStorageService
fileInputStream
- the input stream of the uploaded filestaticAsset
- the StaticAsset
entity to obtain storage information from like file size and the file name,
usually created from StaticAssetService.createStaticAsset(InputStream, String, long, Map)
IOException
StaticAssetService#createStaticAsset(InputStream, String, long, Map)}
Copyright © 2017. All rights reserved.