@Service(value="blStaticAssetService") public class StaticAssetServiceImpl extends AbstractContentService implements StaticAssetService
Modifier and Type | Field and Description |
---|---|
protected boolean |
automaticallyApproveAndPromoteStaticAssets |
protected ImageArtifactProcessor |
imageArtifactProcessor |
protected SandBoxItemDao |
sandBoxItemDao |
protected StaticAssetDao |
staticAssetDao |
protected String |
staticAssetEnvironmentSecureUrlPrefix |
protected String |
staticAssetEnvironmentUrlPrefix |
protected StaticAssetStorageService |
staticAssetStorageService |
protected String |
staticAssetUrlPrefix |
protected boolean |
storeAssetsOnFileSystem |
Constructor and Description |
---|
StaticAssetServiceImpl() |
Modifier and Type | Method and Description |
---|---|
StaticAsset |
addStaticAsset(StaticAsset staticAsset,
SandBox destinationSandbox)
This method is intended to be called from within the CMS
admin only.
|
protected String |
buildAssetURL(Map<String,String> assetProperties,
String originalFilename)
Will assemble the url from the passed in properties as
/{entityType}/{fileName}
/product/7001-ab12
If the properties above are not set, it will generate the fileName randomly.
|
String |
convertAssetPath(String assetPath,
String contextPath,
boolean secureRequest)
This method will take in an assetPath (think image url) and prepend the
staticAssetUrlPrefix if one exists.
|
Long |
countAssets(SandBox sandbox,
org.hibernate.Criteria c) |
StaticAsset |
createStaticAssetFromFile(org.springframework.web.multipart.MultipartFile file,
Map<String,String> properties)
Used when uploading a file to Broadleaf.
|
void |
deleteStaticAsset(StaticAsset staticAsset,
SandBox destinationSandbox)
If deleting and item where page.originalPageId != null
then the item is deleted from the database.
|
List<StaticAsset> |
findAssets(SandBox sandbox,
org.hibernate.Criteria c) |
StaticAsset |
findStaticAssetByFullUrl(String fullUrl,
SandBox targetSandBox) |
StaticAsset |
findStaticAssetById(Long id) |
protected String |
generateFileName(int size)
Generates a filename as a set of Hex digits.
|
boolean |
getAutomaticallyApproveAndPromoteStaticAssets()
If set to true, then this service will not use the SandBox concept
and will instead automatically promote images to production
as they are entered into the system.
|
protected String |
getCountUrl(String fullUrl,
int count,
boolean legacyFormat)
Gets the count URL based on the original fullUrl.
|
protected String |
getFileExtension(String fileName) |
protected void |
getMimeType(org.springframework.web.multipart.MultipartFile file,
StaticAsset newAsset) |
String |
getStaticAssetEnvironmentSecureUrlPrefix()
Returns the secure value of the environment url prefix (e.g.
|
String |
getStaticAssetEnvironmentUrlPrefix()
Returns the value configured for the current environment
for the static asset url prefix.
|
String |
getStaticAssetUrlPrefix()
Returns the value configured to mark an item as a static URL.
|
void |
itemPromoted(SandBoxItem sandBoxItem,
SandBox destinationSandBox) |
void |
itemRejected(SandBoxItem sandBoxItem,
SandBox destinationSandBox) |
void |
itemReverted(SandBoxItem sandBoxItem) |
List<StaticAsset> |
readAllStaticAssets() |
void |
setAutomaticallyApproveAndPromoteStaticAssets(boolean automaticallyApproveAndPromoteStaticAssets)
If set to true, then this service will not use the SandBox concept
and will instead automatically promote images to production
as they are entered into the system.
|
void |
setStaticAssetEnvironmentSecureUrlPrefix(String staticAssetEnvironmentSecureUrlPrefix) |
void |
setStaticAssetEnvironmentUrlPrefix(String staticAssetEnvironmentUrlPrefix)
Sets the environment url prefix.
|
void |
setStaticAssetUrlPrefix(String staticAssetUrlPrefix) |
StaticAsset |
updateStaticAsset(StaticAsset staticAsset,
SandBox destSandbox)
This method is intended to be called from within the CMS
admin only.
|
countItems, findItems
@Value(value="${asset.server.url.prefix.internal}") protected String staticAssetUrlPrefix
@Value(value="${asset.server.url.prefix}") protected String staticAssetEnvironmentUrlPrefix
protected ImageArtifactProcessor imageArtifactProcessor
@Value(value="${asset.use.filesystem.storage}") protected boolean storeAssetsOnFileSystem
@Value(value="${asset.server.url.prefix.secure}") protected String staticAssetEnvironmentSecureUrlPrefix
@Value(value="${automatically.approve.static.assets}") protected boolean automaticallyApproveAndPromoteStaticAssets
protected StaticAssetDao staticAssetDao
protected SandBoxItemDao sandBoxItemDao
protected StaticAssetStorageService staticAssetStorageService
public StaticAsset findStaticAssetById(Long id)
findStaticAssetById
in interface StaticAssetService
public List<StaticAsset> readAllStaticAssets()
readAllStaticAssets
in interface StaticAssetService
protected String generateFileName(int size)
size
- protected String buildAssetURL(Map<String,String> assetProperties, String originalFilename)
url
- asset
- assetProperties
- @Transactional(value="blTransactionManager") public StaticAsset createStaticAssetFromFile(org.springframework.web.multipart.MultipartFile file, Map<String,String> properties)
StaticAssetService
StaticAssetServiceImpl
has a
environment properties that determine this behavior asset.use.filesystem.storage
, and
asset.server.file.system.path
.
The properties allows for implementors to update other Asset properties at the
same time they are uploading a file. The default implementation uses this for an optional URL to
be specified.createStaticAssetFromFile
in interface StaticAssetService
file
- - the file being uploadedproperties
- - additional meta-data propertiesStaticAssetServiceImpl
protected String getCountUrl(String fullUrl, int count, boolean legacyFormat)
protected void getMimeType(org.springframework.web.multipart.MultipartFile file, StaticAsset newAsset)
public StaticAsset findStaticAssetByFullUrl(String fullUrl, SandBox targetSandBox)
findStaticAssetByFullUrl
in interface StaticAssetService
@Transactional(value="blTransactionManager") public StaticAsset addStaticAsset(StaticAsset staticAsset, SandBox destinationSandbox)
StaticAssetService
addStaticAsset
in interface StaticAssetService
@Transactional(value="blTransactionManager") public StaticAsset updateStaticAsset(StaticAsset staticAsset, SandBox destSandbox)
StaticAssetService
updateStaticAsset
in interface StaticAssetService
@Transactional(value="blTransactionManager") public void deleteStaticAsset(StaticAsset staticAsset, SandBox destinationSandbox)
StaticAssetService
deleteStaticAsset
in interface StaticAssetService
public List<StaticAsset> findAssets(SandBox sandbox, org.hibernate.Criteria c)
findAssets
in interface StaticAssetService
public Long countAssets(SandBox sandbox, org.hibernate.Criteria c)
countAssets
in interface StaticAssetService
public void itemPromoted(SandBoxItem sandBoxItem, SandBox destinationSandBox)
itemPromoted
in interface SandBoxItemListener
public void itemRejected(SandBoxItem sandBoxItem, SandBox destinationSandBox)
itemRejected
in interface SandBoxItemListener
public void itemReverted(SandBoxItem sandBoxItem)
itemReverted
in interface SandBoxItemListener
public String getStaticAssetUrlPrefix()
StaticAssetService
getStaticAssetUrlPrefix
in interface StaticAssetService
public void setStaticAssetUrlPrefix(String staticAssetUrlPrefix)
setStaticAssetUrlPrefix
in interface StaticAssetService
public String getStaticAssetEnvironmentUrlPrefix()
StaticAssetService
getStaticAssetEnvironmentUrlPrefix
in interface StaticAssetService
public void setStaticAssetEnvironmentUrlPrefix(String staticAssetEnvironmentUrlPrefix)
StaticAssetService
setStaticAssetEnvironmentUrlPrefix
in interface StaticAssetService
public String getStaticAssetEnvironmentSecureUrlPrefix()
StaticAssetService
getStaticAssetEnvironmentSecureUrlPrefix
in interface StaticAssetService
public void setStaticAssetEnvironmentSecureUrlPrefix(String staticAssetEnvironmentSecureUrlPrefix)
public boolean getAutomaticallyApproveAndPromoteStaticAssets()
StaticAssetService
getAutomaticallyApproveAndPromoteStaticAssets
in interface StaticAssetService
public void setAutomaticallyApproveAndPromoteStaticAssets(boolean automaticallyApproveAndPromoteStaticAssets)
StaticAssetService
setAutomaticallyApproveAndPromoteStaticAssets
in interface StaticAssetService
public String convertAssetPath(String assetPath, String contextPath, boolean secureRequest)
convertAssetPath
in interface StaticAssetService
assetPath
- - The path to rewrite if it is a cms managed assetcontextPath
- - The context path of the web application (if applicable)secureRequest
- - True if the request is being served over httpsStaticAssetService.getStaticAssetUrlPrefix()
,
StaticAssetService.getStaticAssetEnvironmentUrlPrefix()
Copyright © 2014. All rights reserved.