public interface AssetManager
AssetManager
provides utility methods for assets.
The asset manager can be retrieved as follows:
... AssetManager manager = resourceResolver.adaptTo(AssetManager.class); ...
Modifier and Type | Method and Description |
---|---|
Asset |
createAsset(String path,
InputStream is,
String mimeType,
boolean doSave)
Creates a new
Asset at the given path . |
Asset |
createAssetForBinary(String binaryPath,
boolean doSave)
This method creates the complete asset structure in /content/dam.
|
Revision |
createRevision(Asset asset,
String label,
String comment)
Create a new
Revision of the asset. |
Asset |
getAssetForBinary(String binaryPath)
|
Collection<Revision> |
getRevisions(String path,
Calendar cal)
Lists all available
Revision s. |
boolean |
removeAssetForBinary(String binaryPath)
|
Asset |
restore(String revisionId)
Restores an
Asset |
Collection<Revision> getRevisions(String path, Calendar cal) throws Exception
Revision
s.Asset createAssetForBinary(String binaryPath, boolean doSave)
binaryPath
is translated into the final asset location (see DamUtil.binaryToAssetPath(String)
).
binaryPath
- The path of the asset's binary in /var/dam.doSave
- Whether the repository changes are saved or not.javax.jcr.Node
representing the created asset.Asset getAssetForBinary(String binaryPath)
Resource
of the Asset
corresponding to the binary given with the path
parameter.
DamUtil.getAssetNode("/var/dam/myfolder/test.jpg", session) = Resource("/content/dam/myfolder/test.jpg")
binaryPath
- The path of the binary.null
if it couldn't be found.boolean removeAssetForBinary(String binaryPath)
javax.jcr.Node
of the Asset
corresponding to the binary given with the
path
parameter.
DamUtil.removeAssetNode("/var/dam/myfolder/test.jpg", session) => Delete Node("/content/dam/myfolder/test.jpg")
binaryPath
- The path of the binary.true
if the asset was successfully removed.Asset createAsset(String path, InputStream is, String mimeType, boolean doSave)
Asset
at the given path
. If an asset already exists at the given
path
, its original rendition is updated instead of creating a new asset.path
- The path of the asset to be created.is
- The input stream of the new asset's original binary.mimeType
- The mime type of the new asset's original binary.doSave
- Whether the repository changes are saved or not.Revision createRevision(Asset asset, String label, String comment) throws Exception
Revision
of the asset. The revision will be created as a standard JCR version of the
underlying asset node.asset
- The asset to versionlabel
- version labelcomment
- version commentException
- Thrown when an error during version creation occurred."Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"