info.magnolia.dam.asset.functions
Class DamTemplatingFunctions

java.lang.Object
  extended by info.magnolia.dam.asset.functions.DamTemplatingFunctions

@Singleton
public class DamTemplatingFunctions
extends Object

Dam templating function exposed in FTL's as "damfn". This class exposed useful methods for FTL's and Model Class.

 In order to use this template function, create a new contextAttributes in your renderers configuration.
 For example stk add the following configuration in order to expose damfn in FTL's:
 under
      config/modules/standard-temlating-kit/renderers/stk/contextAttributes
 add a configuration Node
      damfn
 with the following Node properties:
      componentClass=info.magnolia.dam.asset.functions.DamTemplatingFunctions
      name=damfn
 


Constructor Summary
DamTemplatingFunctions(DamManager damManager)
           
 
Method Summary
 Asset getAssetForId(String assetIdentifier)
          Retrieve an Asset based on an Asset identifier.
 Asset getAssetForPath(String assetPath)
          Retrieve an Asset based on an Asset path.
 String getAssetLinkForId(String assetIdentifier)
          Return the Link to the specified Asset for a given assetIdentifier.
 String getAssetLinkForId(String assetIdentifier, String renditionName)
          Return the Link to the specified Asset rendition for a given assetIdentifier.
 AssetMap getAssetMap(Asset asset)
          Return the AssetMap representation of the Asset.
 AssetMap getAssetMapForAssetId(String assetIdentifier)
          Return the AssetMap representation of the Asset defined by the assetIdentifier.
 Asset getAssetRendition(Asset asset, String renditionName)
          Return the specified Asset Rendition.
 Asset getAssetRenditionForAssetId(String assetIdentifier, String renditionName)
          Return the specified Asset Rendition based on the assetIdentifier.
 List<Asset> getAssetsForFilter(AssetFilter assetFilter)
          Retrieve an Asset List based on an AssetFilter.
 List<Asset> getAssetsFromFolderId(String folderIdentifier)
          Retrieve an Asset List based on a folder identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DamTemplatingFunctions

@Inject
public DamTemplatingFunctions(DamManager damManager)
Method Detail

getAssetsFromFolderId

public List<Asset> getAssetsFromFolderId(String folderIdentifier)
Retrieve an Asset List based on a folder identifier.

Returns:
The Assets List found for this folder identifier, or an Empty List if nothing found or in case of Exception.
See Also:
DamManager.getAssetsFromFolderId(String)

getAssetMap

public AssetMap getAssetMap(Asset asset)
Return the AssetMap representation of the Asset.

Returns:
Related AssetMap or null in case of exception.
See Also:
DamManager.getAssetMap(Asset)

getAssetMapForAssetId

public AssetMap getAssetMapForAssetId(String assetIdentifier)
Return the AssetMap representation of the Asset defined by the assetIdentifier.

Returns:
Related AssetMap or null in case of exception.
See Also:
DamManager.getAssetMap(Asset)

getAssetForPath

public Asset getAssetForPath(String assetPath)
Retrieve an Asset based on an Asset path.

Returns:
Found Asset. Null otherwise
See Also:
DamManager.getAssetForPath(String)

getAssetForId

public Asset getAssetForId(String assetIdentifier)
Retrieve an Asset based on an Asset identifier.

Returns:
Found Asset. Null otherwise
See Also:
DamManager.getAssetForId(String)

getAssetRendition

public Asset getAssetRendition(Asset asset,
                               String renditionName)
Return the specified Asset Rendition.

Returns:
The specified Asset based on the rendition Name.
In case of no rendition found, return the same Asset.
Return null in case of exception.

getAssetRenditionForAssetId

public Asset getAssetRenditionForAssetId(String assetIdentifier,
                                         String renditionName)
Return the specified Asset Rendition based on the assetIdentifier.

Returns:
The specified Asset based on the rendition Name.
In case of no rendition found, return the same Asset.
Return null in case of exception or if assetIdentifier is null or blank.
See Also:
getAssetRendition(Asset, String)

getAssetLinkForId

public String getAssetLinkForId(String assetIdentifier)
Return the Link to the specified Asset for a given assetIdentifier.

Returns:
The Asset link or null
in case of exception or
if Asset was not found.

getAssetLinkForId

public String getAssetLinkForId(String assetIdentifier,
                                String renditionName)
Return the Link to the specified Asset rendition for a given assetIdentifier.

Returns:
The Asset link or null
in case of exception or
if Asset was not found.

getAssetsForFilter

public List<Asset> getAssetsForFilter(AssetFilter assetFilter)
Retrieve an Asset List based on an AssetFilter.

Returns:
The Assets List found for this asset filter, or an empty list if nothing found or in case of Exception.
See Also:
DamManager.getAssetsForFilter(AssetFilter assetFilter), AssetFilter


Copyright © 2014 Magnolia International Ltd.. All Rights Reserved.