Magnolia 5.3 reached end of life on June 30, 2017. This branch is no longer supported, see End-of-life policy.
Migrating From DAM 1.x from DAM 2.x requires code changes and migration tasks are not provided. Many of the 1.x class names have been retained, but the meaning and behavior has changed.
The new DAM documents provide details of how the new DAM works. Please read them carefully before starting to modify your code:
This document highlights the major changes and potential code challenges you may face.
AssetProviderRegistry replaces DamManager .
AssetProviderRegistry
does not give direct access to the Asset
like DamManager
did. It provides access to the AssetProvider
. See Architecture.AssetProvider
, Item
, Folder
or Asset.
AssetProvider has the same name in 2.x and 1.x but behaviors are different.
ItemKey
as the input parameter.AssetProvider
implementation, do not forget to re-configure and re-register your components once you have migrated your code. See Asset providers and renderers in the DAM Core module documentation.Here are a few code examples that you can adapt to suit your needs.
public Asset getAsset(String providerId, String assetPath, String assetJcrIdentifier, ItemKey itemKey) { AssetProvider provider; // Get AssetProviderRegistry AssetProviderRegistry registry = Components.getComponent(AssetProviderRegistry.class); // Get AssetProvider if(itemKey != null) { provider = registry.getProviderFor(itemKey); } else if(StringUtils.isNotBlank(providerId)) { provider = registry.getProviderById(providerId); }else { provider = registry.getProviderById(DamConstants.DEFAULT_JCR_PROVIDER_ID); } // Create the ItemKey if(itemKey == null) { itemKey = new ItemKey(provider.getIdentifier(), assetJcrIdentifier); } // Get the Asset Asset assetFromPath = ((PathAwareAssetProvider)provider).getAsset(assetPath); Asset assetFromItemKey = provider.getAsset(itemKey); ...
DamTemplatingFunctions
has the same name in 2.x and 1.x, but the behaviors are different. To retain minimal templating compatibility, certain 1.0 templating methods are still exposed in DamTemplatingFunctions
2.x, but are marked as deprecated. See DAM templating for a list:
AssetMap
in 1.x was removed and replaced in 2.x with a normal Map
. Once you get the new map using (DamTemplatingFunctions.getAssetMapForAssetId(String assetKey)
), the syntax on the template side remains the same. See Main methods in 2.x for code examples.
The 1.x
MediaType
class no longer exists in 2.x. It is replaced by com.google.common.net.MediaType
. See MediaType.
Unlike, the other DAM modules, the DAM App module provides two migration tasks:
/modules/dam-app
configuration