Hi,
I am using the Replicator API to replicate the asset like below.
replicator.replicate(session, ReplicationActionType.ACTIVATE, asset.getPath());
but somehow subassets are not replicated. Please confirm is there we can replicate all the subassets when the asset has been activated.
I am using the below code and achieving it now. Is there any better way the API or AEM provides. please help.
Resource resource = resolver.resolve(assetPath);
if(resource != null){
Asset parentAsset = resource.adaptTo(Asset.class);
if(parentAsset != null){
Collection<Asset> subAssetCollection = parentAsset.getSubAssets();
for(Asset subAsset : subAssetCollection){
replicator.replicate(session, ReplicationActionType.ACTIVATE, subAsset.getPath());
}
}
}