@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 ConcurrentFileOutputStream |
concurrentFileOutputStream |
protected static String |
DEFAULT_ADMIN_IMAGE_EXTENSIONS |
static long |
DEFAULT_ASSET_UPLOAD_SIZE |
protected static int |
DEFAULT_BUFFER_SIZE |
protected org.springframework.boot.autoconfigure.web.servlet.MultipartProperties |
defaultMultipartSettings |
protected org.springframework.core.env.Environment |
env |
protected StaticAssetServiceExtensionManager |
extensionManager |
protected NamedOperationManager |
namedOperationManager |
protected String |
recompressFormats |
protected StaticAssetService |
staticAssetService |
protected StaticAssetStorageDao |
staticAssetStorageDao |
protected StreamingTransactionCapableUtil |
transUtil |
| 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(InputStream uploadedFileInputStream,
long fileSize)
Creates a blob from an input stream with a given filesize.
|
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.
|
protected List<String> |
getAdminImageFileExtensions() |
Map<String,String> |
getCacheFileModel(String fullUrl,
Map<String,String> parameterMap) |
protected int |
getFileBufferSize() |
protected String |
getFileExtension(String assetPath) |
protected File |
getFileFromLocalRepository(String cachedFileName) |
protected long |
getMaxUploadableFileSize() |
protected long |
getMaxUploadableImageSize() |
protected long |
getMaxUploadSizeForFile(String fileName) |
protected boolean |
isImageFile(String fileName) |
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 |
shouldRecompress(String mimeType) |
protected boolean |
shouldUseSharedFile(InputStream is) |
protected static final String DEFAULT_ADMIN_IMAGE_EXTENSIONS
public static final long DEFAULT_ASSET_UPLOAD_SIZE
protected static final int DEFAULT_BUFFER_SIZE
protected String cacheDirectory
@Autowired protected org.springframework.core.env.Environment env
protected StaticAssetService staticAssetService
protected BroadleafFileService broadleafFileService
protected ArtifactService artifactService
protected StaticAssetStorageDao staticAssetStorageDao
protected NamedOperationManager namedOperationManager
protected StaticAssetServiceExtensionManager extensionManager
protected StreamingTransactionCapableUtil transUtil
@Value(value="${image.artifact.recompress.formats:png}")
protected String recompressFormats
@Autowired(required=false) protected org.springframework.boot.autoconfigure.web.servlet.MultipartProperties defaultMultipartSettings
protected ConcurrentFileOutputStream concurrentFileOutputStream
protected StaticAsset findStaticAsset(String fullUrl)
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
IOExceptionpublic Map<String,String> getCacheFileModel(String fullUrl, Map<String,String> parameterMap) throws Exception
getCacheFileModel in interface StaticAssetStorageServiceExceptionprotected boolean shouldRecompress(String mimeType)
public StaticAssetStorage findStaticAssetStorageById(Long id)
StaticAssetStorageServicefindStaticAssetStorageById in interface StaticAssetStorageServicepublic StaticAssetStorage create()
create in interface StaticAssetStorageServicepublic StaticAssetStorage readStaticAssetStorageByStaticAssetId(Long id)
StaticAssetStorageServicereadStaticAssetStorageByStaticAssetId in interface StaticAssetStorageServicepublic StaticAssetStorage save(StaticAssetStorage assetStorage)
StaticAssetStorageServicesave in interface StaticAssetStorageServicepublic void delete(StaticAssetStorage assetStorage)
StaticAssetStorageServicedelete in interface StaticAssetStorageServicepublic Blob createBlob(org.springframework.web.multipart.MultipartFile uploadedFile) throws IOException
createBlob in interface StaticAssetStorageServiceIOExceptionpublic Blob createBlob(InputStream uploadedFileInputStream, long fileSize) throws IOException
StaticAssetStorageServicecreateBlob 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 StaticAssetStorageServicefile - 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)IOExceptionStaticAssetService#createStaticAssetFromFile(MultipartFile, Map)}@Transactional(value="blTransactionManagerAssetStorageInfo") public void createStaticAssetStorage(InputStream fileInputStream, StaticAsset staticAsset) throws IOException
StaticAssetStorageServiceStaticAssetStorageService.createStaticAssetStorageFromFile(MultipartFile, StaticAsset) except that this does not depend on
an uploaded file and can support more generic use casescreateStaticAssetStorage in interface StaticAssetStorageServicefileInputStream - 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)IOExceptionStaticAssetService#createStaticAsset(InputStream, String, long, Map)}protected long getMaxUploadSizeForFile(String fileName)
protected boolean isImageFile(String fileName)
protected long getMaxUploadableFileSize()
protected long getMaxUploadableImageSize()
protected int getFileBufferSize()
Copyright © 2019. All rights reserved.