@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 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 String |
appendTrailingSlash(String path)
Removes trailing "/" and ensures that there is a beginning "/"
|
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 |
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.
|
protected String |
removeLeadingSlash(String path)
Removes trailing "/" and ensures that there is a beginning "/"
|
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 StaticAsset findStaticAsset(String fullUrl)
protected String appendTrailingSlash(String path)
path - protected String removeLeadingSlash(String path)
path - protected boolean shouldUseSharedFile(InputStream is)
protected File lookupAssetAndCreateLocalFile(StaticAsset staticAsset, File baseLocalFile) throws IOException, SQLException
IOExceptionSQLExceptionprotected void createLocalFileFromClassPathResource(StaticAsset staticAsset, File baseLocalFile) throws IOException
IOExceptionprotected 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 StaticAssetStorageServiceException@Transactional(value="blTransactionManagerAssetStorageInfo") public StaticAssetStorage findStaticAssetStorageById(Long id)
StaticAssetStorageServicefindStaticAssetStorageById in interface StaticAssetStorageService@Transactional(value="blTransactionManagerAssetStorageInfo") public StaticAssetStorage create()
create in interface StaticAssetStorageService@Transactional(value="blTransactionManagerAssetStorageInfo") public StaticAssetStorage readStaticAssetStorageByStaticAssetId(Long id)
StaticAssetStorageServicereadStaticAssetStorageByStaticAssetId in interface StaticAssetStorageService@Transactional(value="blTransactionManagerAssetStorageInfo") public StaticAssetStorage save(StaticAssetStorage assetStorage)
StaticAssetStorageServicesave in interface StaticAssetStorageService@Transactional(value="blTransactionManagerAssetStorageInfo") public void delete(StaticAssetStorage assetStorage)
StaticAssetStorageServicedelete in interface StaticAssetStorageService@Transactional(value="blTransactionManagerAssetStorageInfo") public Blob createBlob(org.springframework.web.multipart.MultipartFile uploadedFile) throws IOException
createBlob in interface StaticAssetStorageServiceIOExceptionprotected 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
StaticAssetStorageServicecreateStaticAssetStorageFromFile in interface StaticAssetStorageServiceIOExceptionCopyright © 2014. All Rights Reserved.