info.magnolia.dam.providers.jcr
Class JcrAssetProvider

java.lang.Object
  extended by info.magnolia.dam.providers.jcr.JcrAssetProvider
All Implemented Interfaces:
AssetProvider

public class JcrAssetProvider
extends Object
implements AssetProvider

AssetProvider that delivers assets for the "dam" workspace.


Field Summary
protected static String ASSET_JOIN_STATEMENT
           
protected static String ASSET_SELECT_STATEMENT
           
static String PROVIDER_ID
           
 
Constructor Summary
JcrAssetProvider(JcrNodeAssetBuilder internalAssetBuilder)
           
 
Method Summary
 Asset getAsset(String assetIdentifier)
          Retrieve an Asset based on an assetIdentifier.
 String getAssetIdentifierForPath(String assetPath)
          Return the Asset Identifier referenced by this path.
 AssetMap getAssetMap(Asset asset)
          Return the AssetMap representation of the Asset.
 List<Asset> getAssetsByQuery(String whereClause, boolean includeDeleted)
          Return an asset based on a JCR query (format Query.SQL).
 List<Asset> getAssetsForFilter(AssetFilter assetFilter)
          Retrieve an Asset List based on an AssetFilter .
 List<Asset> getAssetsFromFolderId(String folderIdentifier)
          Retrieve an Asset List based on an asset Identifier.
 List<Asset> getAssetsFromFolderPath(String folderPath)
          Retrieve an Asset List based on an asset Folder.
 String getIdentifier()
          Return the AssetProvider identifier.
protected  String getQueryStringFromFilter(AssetFilter assetFilter)
          Returns a JCR_SQL2 query string according to the asset filter.
 Rendition getRendition(Asset asset, String renditionName)
          Return the specified Asset Rendition.
 String getURI(Asset asset, String uriPrefix)
          Get URI link to the Asset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASSET_SELECT_STATEMENT

protected static final String ASSET_SELECT_STATEMENT
See Also:
Constant Field Values

ASSET_JOIN_STATEMENT

protected static final String ASSET_JOIN_STATEMENT
See Also:
Constant Field Values

PROVIDER_ID

public static String PROVIDER_ID
Constructor Detail

JcrAssetProvider

@Inject
public JcrAssetProvider(JcrNodeAssetBuilder internalAssetBuilder)
Method Detail

getIdentifier

public String getIdentifier()
Description copied from interface: AssetProvider
Return the AssetProvider identifier.

Specified by:
getIdentifier in interface AssetProvider
Returns:
: AssetProvider identifier or null if not defined.

getAsset

public Asset getAsset(String assetIdentifier)
Description copied from interface: AssetProvider
Retrieve an Asset based on an assetIdentifier.
In Case of JCR, this identifier will be the Node.getIdentifier()

Specified by:
getAsset in interface AssetProvider
Returns:
the related Asset or null if exception or not found.

getAssetIdentifierForPath

public String getAssetIdentifierForPath(String assetPath)
Description copied from interface: AssetProvider
Return the Asset Identifier referenced by this path.

Specified by:
getAssetIdentifierForPath in interface AssetProvider
Returns:
The Asset.getIdentifier() value if found. Otherwise return null.

getAssetsFromFolderPath

public List<Asset> getAssetsFromFolderPath(String folderPath)
Description copied from interface: AssetProvider
Retrieve an Asset List based on an asset Folder.
Returns direct children of the Folder.

Specified by:
getAssetsFromFolderPath in interface AssetProvider
Returns:
the related Asset List or an empty List if exception or no Assets found.

getAssetsFromFolderId

public List<Asset> getAssetsFromFolderId(String folderIdentifier)
Description copied from interface: AssetProvider
Retrieve an Asset List based on an asset Identifier.
Returns direct children of the Folder. For example in case of JCR, this identifier will be the Node.getIdentifier()

Specified by:
getAssetsFromFolderId in interface AssetProvider
Returns:
the related Asset List or an empty List if exception or no Assets found.

getQueryStringFromFilter

protected String getQueryStringFromFilter(AssetFilter assetFilter)
Returns a JCR_SQL2 query string according to the asset filter.


getAssetsForFilter

public List<Asset> getAssetsForFilter(AssetFilter assetFilter)
Description copied from interface: AssetProvider
Retrieve an Asset List based on an AssetFilter .

Specified by:
getAssetsForFilter in interface AssetProvider
Returns:
the related Asset List or an empty List if exception or no Assets found.

getURI

public String getURI(Asset asset,
                     String uriPrefix)
Description copied from interface: AssetProvider
Get URI link to the Asset.

Specified by:
getURI in interface AssetProvider
Returns:
the URI to the real Asset or null if exception or none found.

getRendition

public Rendition getRendition(Asset asset,
                              String renditionName)
                       throws NoSuchRenditionException,
                              DamException
Description copied from interface: AssetProvider
Return the specified Asset Rendition.

Specified by:
getRendition in interface AssetProvider
Returns:
null if no rendition found.
Throws:
NoSuchRenditionException
DamException

getAssetsByQuery

public List<Asset> getAssetsByQuery(String whereClause,
                                    boolean includeDeleted)
Return an asset based on a JCR query (format Query.SQL).
 Query example:
  jcr:path like '/demo-project/img/bk/Opener/%' and extension = 'jpg'
 

Parameters:
whereClause - whereClause to be used for querying
Returns:
The Query Result List. Return an Empty List in case of exception.

getAssetMap

public AssetMap getAssetMap(Asset asset)
Description copied from interface: AssetProvider
Return the AssetMap representation of the Asset. AssetMap is mainly used in Templates to simplify data access.

Specified by:
getAssetMap in interface AssetProvider
Returns:
Related AssetMap or null in case of exception.


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