Hi guys,
When I tried to activate the page with referenced assets (e.g. Image component) through workflow Activate page step, only the page is activated but not assets. Does somebody knows if it is expected behaviour or bug?
Thanks.
Solved! Go to Solution.
When we update our AEM community pages with assets stored in the DAM -- we activate the assets in the DAM before using them in the page, as shown here:
[img]DAMAct.png[/img]
So - its expected behaviour to activate assets in the DAM - we do it within Adobe.
Views
Replies
Total Likes
Hi,
try this
Node n = adminSession.getNode(pagePath+"/jcr:content");
AssetReferenceSearch ref = new AssetReferenceSearch(n,DamConstants.MOUNTPOINT_ASSETS,resourceResolver);
Map<String,Asset> allref = new HashMap<String,Asset>();
allref.putAll(ref.search());
for (Map.Entry<String, Asset> entry : allref.entrySet()) {
String assetPath = entry.getKey();
log.info(assetPath+"<br>"); // Path of all Asset ref in page
log.info(assetPath +" ASSET ACTIVATION STARTED");
replicator.replicate(adminSession, ReplicationActionType.ACTIVATE, assetPath);
log.info(assetPath +" ASSET ACTIVATION ENDED");
}
log.info("PAGE ACTIVATION STARTED");
replicator.replicate(adminSession, ReplicationActionType.ACTIVATE, pagePath);
log.info("ACTIVATION ENDED");
When we update our AEM community pages with assets stored in the DAM -- we activate the assets in the DAM before using them in the page, as shown here:
[img]DAMAct.png[/img]
So - its expected behaviour to activate assets in the DAM - we do it within Adobe.
Views
Replies
Total Likes
Hi vikramca06
Can you let me know on how can we relate assets programatically(Via API).
I want to write a custom workflow to add relation between assets.(source,derived and others)
Which API needs to be used ? If possible can I get a sample code?
Regards
Susmitha Sama
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi Arun,
have written the following code to relate assets.
if(assetMgr.assetExists(nodePath))
{
asset = assetMgr.getAsset("nodePath");
asset.addRelation("derived",path);
}
nodepath has the parent asset
and path has the child asset which need to be related to mode path asset.
Getting null exception.
I'm not sure if this the correct syntax to add relation between assets.
Can you please guide me on the correct syntax.
Views
Replies
Total Likes
I tried below in servlet.
AssetManager assetMgr = request.getResourceResolver().adaptTo(AssetManager.class);
String parentAsset = "/content/dam/AEM64App/asset.jpg";
String childAsset = "/content/dam/arch17/asset.jpg";
if (assetMgr.assetExists(parentAsset) && assetMgr.assetExists(childAsset)) {
Asset asset = assetMgr.getAsset(parentAsset);
asset.addRelation("derived", childAsset);
}
Thank u Arun. it worked
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies