Package com.day.cq.dam.commons.util
Class DamUtil
- java.lang.Object
 - 
- com.day.cq.dam.commons.util.DamUtil
 
 
- 
public class DamUtil extends java.lang.ObjectThis class provides various utility methods pertaining to DAM.- Since:
 - CQ 5.4.0
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLIVEFYRE_IDstatic java.lang.StringLIVEFYRE_THUMBNAIL 
- 
Constructor Summary
Constructors Constructor Description DamUtil() 
- 
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.StringassetToBinaryPath(java.lang.String path)Translates the path of an asset to its congruent DAM binary path, by replacing the /content/dam path prefix with /var/dam.static java.lang.StringbinaryToAssetPath(java.lang.String path)Translates the path of a DAM binary to its congruent asset path, by replacing the /var/dam path prefix with /content/dam.static java.util.Map<java.lang.String,Pair<java.lang.String,java.lang.Integer>>buildBPEntryDepthMap(SlingScriptHelper sling)This method creates a Map containing list of asset paths pending in brandportal agent queuesstatic java.util.Map<java.lang.String,Pair<java.lang.String,java.lang.Integer>>buildEntryDepthMap(SlingScriptHelper sling)This method creates a Map containing list of asset paths pending in non-brandportal agent queuesstatic booleancheckforAIFile(Asset asset)static javax.jcr.NodecreateEmptyArchiveNode(Resource configResource, java.lang.String name, javax.jcr.Session serviceSession)Deprecated.static booleanexpiryStatus(Asset asset)static java.util.List<java.lang.String>findExpiringAssets(javax.jcr.Session session, java.util.Calendar lowerBound, java.util.Calendar upperBound)Find all dam assets which are getting expired between lowerBound and upperBound.static java.lang.StringfindRelativePathOfAssetNode(javax.jcr.Node assetNode, java.lang.String assetsRoot)Obtain Asset's path relative to specified Asset's rootstatic javax.jcr.NodegetApplicableProfile(Asset asset, java.lang.String profileType, javax.jcr.Session session)Get a specific Processing profile which may be applied to an assetstatic javax.jcr.NodegetApplicableProfile(Resource resource, java.lang.String profileType, javax.jcr.Session session)Get a specific Processing profile which may be applied to an assetstatic java.lang.StringgetAppliedProcessingProfilePath(Asset asset)Deprecated.static AssetCachegetAssetCache()Get an instance ofAssetCachefor access to cached rendition contents and aggregatedInputStreamand temporaryFilecleanups.static AssetgetAssetFromID(ResourceResolver resolver, java.lang.String id)ObtainAssetprovided thejcr:uuidstatic AssetgetAssetFromMetaRes(Resource resource)ReturnsAssetfor the dam:asset/jcr:content/metadata resource else returns null.static java.util.Iterator<Asset>getAssets(Resource res)Returns an iterator to all the assets contained in or represented by the resource.static RenditiongetBestFitFPORendition(Asset asset, java.lang.String[] renditionPreferenceList)static RenditiongetBestFitRendition(int width, java.util.List<Rendition> renditions)It iterates all renditions available and find the closest (preferably higher side) rendition and return the same.static java.util.CalendargetExpiryTime(Asset asset)static java.awt.DimensiongetImageDimension(Rendition rendition)getImageDimension : NUI To get actual width and height of the rendition or image for proper UI rendering of thumbnails , earlier new Layer () API was being used which was inefficient.static java.awt.DimensiongetImageDimension(java.io.InputStream is, java.lang.String filename)getImageDimension : To get actual width and height of the rendition or image for proper UI rendering of thumbnails , earlier new Layer () API was being used which was inefficient.static <T> TgetInheritedProperty(java.lang.String property, Resource resource, T defaultValue)This method searches for the property in the provided contentPath resource.static AssetgetParentAsset(Resource resource)static java.util.List<ResourceCollection>getReferencedCollections(Resource resource)static java.util.List<Asset>getReferencedSubAssets(Resource resource)static java.util.Collection<Asset>getRefererAssets(ResourceResolver resolver, java.lang.String path)static java.util.Collection<Asset>getSubAssets(Resource resource)static java.lang.StringgetTenantAssetsRoot(Resource resource)Obtain Tenant Asset's root for specified Sling resourcestatic java.lang.StringgetTenantAssetsRoot(ResourceResolver resolver)Obtain Tenant Asset's root for specified ResourceResolverstatic java.lang.StringgetTenantAssetsRoot(ResourceResolver resolver, java.lang.String assetPath)Obtain Tenant Asset's root for specified asset path and ResourceResolver This returns the tenant for the session associated with the resource resolver, not the tenant associated with the asset if providedassetPathcan't be resolved to an Assetstatic java.lang.StringgetThumbnailName(int width, int height)Returns the name of a thumbnail in the DAM thumbnail name format, respecting the given dimensions of the thumbnail.static java.lang.StringgetThumbnailName(int width, int height, java.lang.String[] selectors)Behaves likegetThumbnailName(int, int).static java.lang.StringgetThumbnailName(ThumbnailConfig config)Returns the expected rendition/thumbnail name based on the given thumbnail configuration.static java.lang.StringgetTitle(Resource resource)This method returns the title for a given resource based on type.static java.lang.StringgetUserCollectionsPath(ResourceResolver resolver)Obtain collection path for specified tenant and user.static java.lang.StringgetValidFileName(java.lang.String name)This method determines whether the file name contains special characters and replaces them with underscore ("_")static java.lang.StringgetValidFolderName(java.lang.String name)This method determines whether the folder name contains special characters and replaces them with underscore ("_")static java.lang.StringgetValue(javax.jcr.Node n, java.lang.String name, java.lang.String defaultValue)Returns the single property value from the given nodenwithname.static booleanisAsset(Resource resource)static booleanisAudio(Asset asset)static booleanisCollection(Resource resource)Checks if given resource represents a collection.static booleanisExpiredAsset(Asset asset)Returns whether the asset has expired.static booleanisExpiredAsset(Resource resource)Returns whether the resource has expired.static booleanisExpiredSubAsset(Resource resource)Returns whether the resource has any subasset which has expired.static booleanisFrozenNode(Resource resource)Checks whether the giveResourcerepresents a frozen node.static booleanisImage(Asset asset)To check weather asset falls under Image category.static booleanisImage(java.lang.String mimeType)To check whether given mime type is an image mime type.static booleanisInRunningWorkflow(Resource resource)This function determines if an asset has itsDamConstants.DAM_ASSET_STATEproperty is set toDamConstants.DAM_ASSET_STATE_PROCESSING.static booleanisLivefyreFragment(Resource resource)This function determines if an asset is livefyre asset.static booleanisMetadataRes(Resource resource)Returns true ifAssetcan be adapted from dam:asset/jcr:content/metadata resource else returns false.static booleanisPublic(Resource resource)Checks if a given resource is readable by the tenant specific group.static booleanisRendition(Resource resource)static booleanisSmartCollection(Resource resource)Checks if given resource represent a smart collectionstatic booleanisSubAsset(Resource resource)Indicates whether the givenresourceis anAsset's sub-asset.static booleanisThreeD(Asset asset)To check weather asset falls under ThreeD category (Dimensional 3D asset).static booleanisThumbnail(javax.jcr.Node file)This method determines whether the givenNoderepresents a thumbnail of an asset.static booleanisValid(Asset asset)Checks if the asset is valid.static booleanisVideo(Asset asset)To check weather asset falls under Video category.static booleanisVideoSubAsset(Asset asset)static booleanisVtt(Asset asset)static booleanisZipTypeAsset(Asset asset)This method determines whether the provided asset is actually a zip asset or notstatic AssetresolveToAsset(Resource resource)Checks whether the givenresourceis an asset, and if not, travels upwards the resource hierarchy until a resource is an asset.static voidsetModified(Asset asset, java.lang.String user, java.util.Calendar date)This method updates the "last modified" information of the givenAsset.static voidskipBOM(java.io.InputStream stream, java.lang.String encodingFormat)this skips the number of bytes that represents the BOM from the inputstream, so that BOM does not appear as invalid characters in the output rendition.static javax.jcr.NodevalidateFolderNode(java.lang.String path, javax.jcr.Session serviceSession) 
 - 
 
- 
- 
Field Detail
- 
LIVEFYRE_ID
public static final java.lang.String LIVEFYRE_ID
- See Also:
 - Constant Field Values
 
 
- 
LIVEFYRE_THUMBNAIL
public static final java.lang.String LIVEFYRE_THUMBNAIL
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
assetToBinaryPath
public static java.lang.String assetToBinaryPath(java.lang.String path)
Translates the path of an asset to its congruent DAM binary path, by replacing the /content/dam path prefix with /var/dam. If the given path does not start with DAM's asset mountpoint,nullis returned.DamUtil.assetToBinaryPath("/content/dam/myfolder/test.jpg") = "/var/dam/myfolder/test.jpg" DamUtil.assetToBinaryPath(null) = null- Parameters:
 path- The path to translate.- Returns:
 - The binary equivalent path or 
nullif the given path is not a DAM asset path. - See Also:
 DamConstants.MOUNTPOINT_BINARIES,DamConstants.MOUNTPOINT_ASSETS
 
- 
binaryToAssetPath
public static java.lang.String binaryToAssetPath(java.lang.String path)
Translates the path of a DAM binary to its congruent asset path, by replacing the /var/dam path prefix with /content/dam. If the given path does not start with DAM's binary mountpoint,nullis returned.DamUtil.binaryToAssetPath("/var/dam/myfolder/test.jpg") = "/content/dam/myfolder/test.jpg" DamUtil.binaryToAssetPath(null) = null- Parameters:
 path- The path to translate.- Returns:
 - The metadata equivalent path or 
nullif the given path is not a DAM binary path. - See Also:
 DamConstants.MOUNTPOINT_BINARIES,DamConstants.MOUNTPOINT_ASSETS
 
- 
isThumbnail
public static boolean isThumbnail(javax.jcr.Node file)
This method determines whether the givenNoderepresents a thumbnail of an asset.- Parameters:
 file- The node to check.- Returns:
 trueif the node represent's an asset's thumbnail,falseotherwise.
 
- 
buildEntryDepthMap
public static java.util.Map<java.lang.String,Pair<java.lang.String,java.lang.Integer>> buildEntryDepthMap(SlingScriptHelper sling)
This method creates a Map containing list of asset paths pending in non-brandportal agent queues- Parameters:
 sling-- Returns:
 - Map will contains asset path, queue position in agent queue and action type
 
 
- 
buildBPEntryDepthMap
public static java.util.Map<java.lang.String,Pair<java.lang.String,java.lang.Integer>> buildBPEntryDepthMap(SlingScriptHelper sling)
This method creates a Map containing list of asset paths pending in brandportal agent queues- Parameters:
 sling-- Returns:
 - Map will contains asset path, queue position in brandportal agent queue and action type
 
 
- 
getValidFolderName
public static java.lang.String getValidFolderName(java.lang.String name)
This method determines whether the folder name contains special characters and replaces them with underscore ("_") 
- 
getValidFileName
public static java.lang.String getValidFileName(java.lang.String name)
This method determines whether the file name contains special characters and replaces them with underscore ("_") 
- 
isZipTypeAsset
public static boolean isZipTypeAsset(Asset asset)
This method determines whether the provided asset is actually a zip asset or not- Parameters:
 asset- the asset to check- Returns:
 - returns true if asset is a zip file or else false
 
 
- 
getThumbnailName
public static java.lang.String getThumbnailName(int width, int height)Returns the name of a thumbnail in the DAM thumbnail name format, respecting the given dimensions of the thumbnail. E.g. providing awidthof 100 and aheightof 100 would return the thumbnail name cq5dam.thumbnail.100.100.png. As a thumbnail represents a rendition of anAsset, the name can be used for easy retrieval of the thumbnail:... final String thumbnailName = DamUtil.getThumbnailName(100, 100); final Resource thumbnail = asset.getRendition(thumbnailName); ...
- Parameters:
 width- The width of the thumbnail.height- The height of the thumbnail.- Returns:
 - The rendition name of the thumbnail.
 
 
- 
getThumbnailName
public static java.lang.String getThumbnailName(ThumbnailConfig config)
Returns the expected rendition/thumbnail name based on the given thumbnail configuration.- Parameters:
 config- TheThumbnailConfig- Returns:
 - The 
Renditionname. 
 
- 
validateFolderNode
public static javax.jcr.Node validateFolderNode(java.lang.String path, javax.jcr.Session serviceSession) throws javax.jcr.RepositoryException- Throws:
 javax.jcr.RepositoryException
 
- 
createEmptyArchiveNode
@Deprecated public static javax.jcr.Node createEmptyArchiveNode(Resource configResource, java.lang.String name, javax.jcr.Session serviceSession) throws javax.jcr.RepositoryException
Deprecated.- Throws:
 javax.jcr.RepositoryException
 
- 
getThumbnailName
public static java.lang.String getThumbnailName(int width, int height, java.lang.String[] selectors)Behaves likegetThumbnailName(int, int). Additionally and optionally a string array of selectors to be added to the thumbnail name can be specified. E.g. providingwidth= 100,height= 100 andselectors= {"a", "b", "c"} would return the thumbnail name cq5dam.thumbnail.100.100.a.b.c.png. Example:... final String[] selectors = {"a", "b", "c"}; final String thumbnailName = DamUtil.getThumbnailName(100, 100, selectors); final Resource thumbnail = asset.getRendition(thumbnailName); ...- Parameters:
 width- The width of the thumbnail.height- The height of the thumbnail.selectors- An array of selectors to be added. May be null (ignored).- Returns:
 - The rendition name of the thumbnail.
 
 
- 
isRendition
public static boolean isRendition(Resource resource)
Checks whether the givenResourcerepresents aRenditionof anAsset. The requirements are that givenresourceis stored within the renditions folder of an asset and that it's node type is nt:file.- Parameters:
 resource- The resource to check.- Returns:
 trueif the resource is a rendition.
 
- 
isMetadataRes
public static boolean isMetadataRes(Resource resource)
Returns true ifAssetcan be adapted from dam:asset/jcr:content/metadata resource else returns false. 
- 
getAssetFromMetaRes
public static Asset getAssetFromMetaRes(Resource resource)
ReturnsAssetfor the dam:asset/jcr:content/metadata resource else returns null. 
- 
isAsset
public static boolean isAsset(Resource resource)
Checks whether the givenResourcerepresents aAsset. The requirements are that the givenresourceis of node type dam:Asset.- Parameters:
 resource- The resource to check.- Returns:
 trueif the resource is an asset.
 
- 
isFrozenNode
public static boolean isFrozenNode(Resource resource)
Checks whether the giveResourcerepresents a frozen node. The requirements are that the givenresourceis of node type nt:frozenNode.- Parameters:
 resource- The resource to check- Returns:
 trueif the resource is an asset.
 
- 
isSubAsset
public static boolean isSubAsset(Resource resource)
Indicates whether the givenresourceis anAsset's sub-asset.- Parameters:
 resource- TheResourceto check.- Returns:
 trueif this asset is a sub-asset.
 
- 
resolveToAsset
public static Asset resolveToAsset(Resource resource)
Checks whether the givenresourceis an asset, and if not, travels upwards the resource hierarchy until a resource is an asset.- Parameters:
 resource- The resource to check.- Returns:
 - The 
Assetornullif no asset was found. 
 
- 
setModified
public static void setModified(Asset asset, java.lang.String user, java.util.Calendar date)
This method updates the "last modified" information of the givenAsset.- Parameters:
 asset- The asset to update.user- The username of who updated the asset.date- The date/time the updated happened.
 
- 
findExpiringAssets
public static java.util.List<java.lang.String> findExpiringAssets(javax.jcr.Session session, java.util.Calendar lowerBound, java.util.Calendar upperBound) throws javax.jcr.RepositoryExceptionFind all dam assets which are getting expired between lowerBound and upperBound.- Parameters:
 session-lowerBound- the lower bound of date where asset expiration is computed. If null it is not considered as query criterionupperBound- the upper bound of date where asset expiration is computed. If null it is not considered as query criterion- Throws:
 javax.jcr.RepositoryException
 
- 
isExpiredAsset
public static boolean isExpiredAsset(Asset asset)
Returns whether the asset has expired.- Parameters:
 asset-- Returns:
 - true, if the asset has expired
 
 
- 
isExpiredAsset
public static boolean isExpiredAsset(Resource resource)
Returns whether the resource has expired.- Parameters:
 resource-- Returns:
 - true, if the resource has expired
 
 
- 
isExpiredSubAsset
public static boolean isExpiredSubAsset(Resource resource)
Returns whether the resource has any subasset which has expired.- Parameters:
 resource-- Returns:
 - true, if any of the subasset of the asset has expired
 
 
- 
getValue
public static java.lang.String getValue(javax.jcr.Node n, java.lang.String name, java.lang.String defaultValue) throws javax.jcr.RepositoryExceptionReturns the single property value from the given nodenwithname. If there is no single-valued property for the givenname, then thedefaultValueis returned.- Parameters:
 n- a node.name- a property name.defaultValue- the default value.- Returns:
 - the value for the given property name or the default value.
 - Throws:
 javax.jcr.RepositoryException- if value cannot be retrieved
 
- 
isImage
public static boolean isImage(Asset asset)
To check weather asset falls under Image category.- Parameters:
 asset-- Returns:
 - True if asset is of type Image.
 
 
- 
isImage
public static boolean isImage(java.lang.String mimeType)
To check whether given mime type is an image mime type.- Parameters:
 mimeType-- Returns:
 - True if mimeType is an Image mime type.
 
 
- 
isThreeD
public static boolean isThreeD(Asset asset)
To check weather asset falls under ThreeD category (Dimensional 3D asset).- Parameters:
 asset-- Returns:
 - True if asset is of type ThreeD.
 
 
- 
isVideo
public static boolean isVideo(Asset asset)
To check weather asset falls under Video category.- Parameters:
 asset-- Returns:
 - True if asset is of type video.
 
 
- 
isSmartCollection
public static boolean isSmartCollection(Resource resource)
Checks if given resource represent a smart collection- Parameters:
 resource- an instance ofResource- Returns:
 trueifresourcerepresents a smart collectionfalseifresourcedoes not represents a smart collection
 
- 
isCollection
public static boolean isCollection(Resource resource)
Checks if given resource represents a collection.- Parameters:
 resource- an instance ofResource- Returns:
 - true if resource represents any collection type
 
 
- 
isPublic
public static boolean isPublic(Resource resource) throws javax.jcr.RepositoryException
Checks if a given resource is readable by the tenant specific group. If not defined checks for the dam-users group.- Parameters:
 resource- DAM resource like collection, snippet- Returns:
 - True if readable by tenant default group
 - Throws:
 javax.jcr.RepositoryException- Error reading permissions
 
- 
getApplicableProfile
public static javax.jcr.Node getApplicableProfile(Asset asset, java.lang.String profileType, javax.jcr.Session session)
Get a specific Processing profile which may be applied to an asset- Parameters:
 asset- The asset we get from payload of DamUpdateAsset WorkflowprofileType- The type of profile to get (metadata/video/image)session- To retrieve nodes from JCR- Returns:
 - {Node} the Processing Profile, null if not found
 
 
- 
getApplicableProfile
public static javax.jcr.Node getApplicableProfile(Resource resource, java.lang.String profileType, javax.jcr.Session session)
Get a specific Processing profile which may be applied to an asset- Parameters:
 resource- The resource we get from payload of DamUpdateAsset WorkflowprofileType- The type of profile to get (metadata/video/image)session- To retrieve nodes from JCR- Returns:
 - {Node} the Processing Profile, null if not found
 
 
- 
getAppliedProcessingProfilePath
@Deprecated public static java.lang.String getAppliedProcessingProfilePath(Asset asset)
Deprecated.Processing Profile overview has been removed. Now individual PPs are applied to folders. return null use @getApplicableProfile 
- 
getAssets
public static java.util.Iterator<Asset> getAssets(Resource res)
Returns an iterator to all the assets contained in or represented by the resource. If resource is a folder, then all its folders are navigated recursively and assets are listed If a resource isResourceCollection, then all its member resources are consulted and navigated recursively if any of the member represent folder orResourceCollection. If the resource represents an asset itself, an iterator of single item i.e. Collections.singletonList(res.adaptTo(Asset.class)).iterator(); 
- 
checkforAIFile
public static boolean checkforAIFile(Asset asset)
 
- 
getBestFitRendition
public static Rendition getBestFitRendition(int width, java.util.List<Rendition> renditions)
It iterates all renditions available and find the closest (preferably higher side) rendition and return the same.- Parameters:
 width-renditions-- Returns:
 - rendition
 
 
- 
getBestFitFPORendition
public static Rendition getBestFitFPORendition(Asset asset, java.lang.String[] renditionPreferenceList)
- Parameters:
 asset- The asset whose best fit fpo rendition is soughtrenditionPreferenceList- The list of renditions in order of preference- Returns:
 - The best fit rendition if found per the specified preference list else null
 
 
- 
getImageDimension
public static java.awt.Dimension getImageDimension(java.io.InputStream is, java.lang.String filename)getImageDimension : To get actual width and height of the rendition or image for proper UI rendering of thumbnails , earlier new Layer () API was being used which was inefficient. 
- 
getImageDimension
public static java.awt.Dimension getImageDimension(Rendition rendition)
getImageDimension : NUI To get actual width and height of the rendition or image for proper UI rendering of thumbnails , earlier new Layer () API was being used which was inefficient. 
- 
expiryStatus
public static boolean expiryStatus(Asset asset)
 
- 
getReferencedSubAssets
public static java.util.List<Asset> getReferencedSubAssets(Resource resource)
 
- 
getReferencedCollections
public static java.util.List<ResourceCollection> getReferencedCollections(Resource resource)
 
- 
getRefererAssets
public static java.util.Collection<Asset> getRefererAssets(ResourceResolver resolver, java.lang.String path)
 
- 
getExpiryTime
public static java.util.Calendar getExpiryTime(Asset asset)
 
- 
isValid
public static boolean isValid(Asset asset) throws javax.jcr.RepositoryException
Checks if the asset is valid. It is valid if it has content and if the on-/off time range spans the current time.- Returns:
 trueif the page is valid;falseotherwise.- Throws:
 javax.jcr.RepositoryException
 
- 
getTenantAssetsRoot
public static java.lang.String getTenantAssetsRoot(ResourceResolver resolver)
Obtain Tenant Asset's root for specified ResourceResolver- Returns:
 - the tenant root-path
 
 
- 
getTenantAssetsRoot
public static java.lang.String getTenantAssetsRoot(ResourceResolver resolver, java.lang.String assetPath)
Obtain Tenant Asset's root for specified asset path and ResourceResolver This returns the tenant for the session associated with the resource resolver, not the tenant associated with the asset if providedassetPathcan't be resolved to an Asset- Returns:
 - the tenant root-path
 
 
- 
getTenantAssetsRoot
public static java.lang.String getTenantAssetsRoot(Resource resource)
Obtain Tenant Asset's root for specified Sling resource- Returns:
 - the tenant root-path
 
 
- 
getUserCollectionsPath
public static java.lang.String getUserCollectionsPath(ResourceResolver resolver)
Obtain collection path for specified tenant and user.- Parameters:
 resolver- Adaptable for tenant and user- Returns:
 - path for user collections
 
 
- 
getAssetFromID
public static Asset getAssetFromID(ResourceResolver resolver, java.lang.String id) throws javax.jcr.RepositoryException
ObtainAssetprovided thejcr:uuid- Returns:
 - the 
Asset, or null if asset with specified ID wasn't found - Throws:
 javax.jcr.RepositoryException
 
- 
findRelativePathOfAssetNode
public static java.lang.String findRelativePathOfAssetNode(javax.jcr.Node assetNode, java.lang.String assetsRoot) throws javax.jcr.RepositoryExceptionObtain Asset's path relative to specified Asset's root- Returns:
 - Asset's Relative Path (see 
DamConstants.DAM_ASSET_RELATIVE_PATH - Throws:
 javax.jcr.RepositoryException
 
- 
getInheritedProperty
public static <T> T getInheritedProperty(java.lang.String property, Resource resource, T defaultValue)This method searches for the property in the provided contentPath resource. Moves up the repository path until finds the property on the node. Tries to convert the found value to type of default value. If can't, returns the defaultValue- Parameters:
 property- the property user is looking for.resource- the resource representing the path where the property has to be searcheddefaultValue-- Returns:
 - the value configured on the node hierarchy converted to type of default value. defaultValue if property not found on the path hierarchy
 
 
- 
isInRunningWorkflow
public static boolean isInRunningWorkflow(Resource resource)
This function determines if an asset has itsDamConstants.DAM_ASSET_STATEproperty is set toDamConstants.DAM_ASSET_STATE_PROCESSING. Presently this returns true only if in DAM update asset workflow.- Parameters:
 resource- the resource to check- Returns:
 - true if 
DamConstants.DAM_ASSET_STATEproperty is set toDamConstants.DAM_ASSET_STATE_PROCESSINGfalse otherwise 
 
- 
getAssetCache
public static AssetCache getAssetCache()
Get an instance ofAssetCachefor access to cached rendition contents and aggregatedInputStreamand temporaryFilecleanups.- Returns:
 - a suitable asset cache
 
 
- 
isLivefyreFragment
public static boolean isLivefyreFragment(Resource resource)
This function determines if an asset is livefyre asset.- Parameters:
 resource- the resource to check- Returns:
 - true if 
LIVEFYRE_IDproperty is avaliable, false otherwise 
 
- 
getTitle
public static java.lang.String getTitle(@Nonnull Resource resource)This method returns the title for a given resource based on type. If resource is of type asset, it returns jcr:content/metadata/dc:title. and jcr:title for other types. 
- 
isAudio
public static boolean isAudio(Asset asset)
 
- 
isVtt
public static boolean isVtt(Asset asset)
 
- 
isVideoSubAsset
public static boolean isVideoSubAsset(Asset asset)
 
- 
skipBOM
public static void skipBOM(java.io.InputStream stream, java.lang.String encodingFormat) throws java.io.IOExceptionthis skips the number of bytes that represents the BOM from the inputstream, so that BOM does not appear as invalid characters in the output rendition. Otherwise Layer will try to render BOM also as a character and eventually ends up in showing a invalid character as the first character in the rendition.- Throws:
 java.io.IOException
 
 - 
 
 -