info.magnolia.dam
Class DefaultDamManager

java.lang.Object
  extended by info.magnolia.dam.DefaultDamManager
All Implemented Interfaces:
DamManager

@Singleton
public class DefaultDamManager
extends Object
implements DamManager

This is the entry point for accessing Asset for third party.
The DamManager uses the AssetProviderRegistry to retrieve the appropriate AssetProvider in order to Access Asset.
Assets and Assets folder are identified based on an Id.

      id: concatenation of informations 'providerId:assetId' (for an internal asset: jcr:assetNodeIdentifier).
 


Constructor Summary
DefaultDamManager(AssetProviderRegistry providerRegistry)
           
 
Method Summary
 Asset getAssetForId(String assetIdentifier)
          Retrieve an Asset based on an assetIdentifier.
Deleted/Hidden Assets will not be returned.
 Asset getAssetForPath(String assetPath)
          Retrieve an Asset based on an Asset path.
 AssetMap getAssetMap(Asset asset)
          Return the AssetMap representation of the Asset.
 AssetProvider getAssetProvider(String providerId)
          Return the AssetProvider related to the specified providerId.
 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

DefaultDamManager

@Inject
public DefaultDamManager(AssetProviderRegistry providerRegistry)
Method Detail

getAssetForId

public Asset getAssetForId(String assetIdentifier)
Description copied from interface: DamManager
Retrieve an Asset based on an assetIdentifier.
Deleted/Hidden Assets will not be returned.

Specified by:
getAssetForId in interface DamManager
Returns:
The referred Asset if found. Null if nothing found or in case of exception.

getAssetForPath

public Asset getAssetForPath(String assetPath)
Description copied from interface: DamManager
Retrieve an Asset based on an Asset path.
Deleted/Hidden Assets will not be returned.
  Iterate the registered provider.
   For every active provider call AssetProvider.getAssetIdentifierForPath(String assetPath) and keep the result if not null.
  If one and only one result found, return the related Asset.
  In no results or more than one result found, log and return null.
 

Specified by:
getAssetForPath in interface DamManager
Returns:
Found Asset. Null otherwise

getAssetsFromFolderId

public List<Asset> getAssetsFromFolderId(String folderIdentifier)
Description copied from interface: DamManager
Retrieve an Asset List based on a folder identifier.
Like the AssetIdentifier, the folder identifier is a composite key. 'providerId':'folderId'
Deleted/Hidden Asset will not be returned.

Specified by:
getAssetsFromFolderId in interface DamManager
Returns:
The related Asset List. An empty Asset List if nothing found or in case of exception.

getAssetsForFilter

public List<Asset> getAssetsForFilter(AssetFilter assetFilter)
Description copied from interface: DamManager
Retrieve an Asset List based on an AssetFilter. This implementation supports multi-asset type (asset linked to different providers).
  Iterate the registered provider.
   For every active provider call AssetProvider.getAssetsFromFilter(AssetFilter assetFilter).
   Concatenate the results.
 

Specified by:
getAssetsForFilter in interface DamManager
Returns:
The related Asset List. An empty Asset List if nothing found or in case of exception.

getAssetProvider

public AssetProvider getAssetProvider(String providerId)
                               throws AssetProviderNotFoundException
Description copied from interface: DamManager
Return the AssetProvider related to the specified providerId.

Specified by:
getAssetProvider in interface DamManager
Returns:
The related AssetProvider. If not found, throws an AssetProviderNotFoundException.
Throws:
AssetProviderNotFoundException

getAssetMap

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

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


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