I have parent asset node inside the AEM CRXDE (/content/dam/parent). inside the parent node folder multiple child nodes are there .
Using Asset API how can i iterate the child nodes.?
After that i have to read/write properties.!
Solved! Go to Solution.
Refer to https://helpx.adobe.com/experience-manager/using/graniteAPI.html and https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/diff-previ...
or do something like this
final Iterator<Resource> assets = findAssets(resourceResolver, "YOUR CUSTOM DAM PATH");
while (assets.hasNext()) {
final Asset asset = assets.next().adaptTo(Asset.class);
}
Refer to https://helpx.adobe.com/experience-manager/using/graniteAPI.html and https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/diff-previ...
or do something like this
final Iterator<Resource> assets = findAssets(resourceResolver, "YOUR CUSTOM DAM PATH");
while (assets.hasNext()) {
final Asset asset = assets.next().adaptTo(Asset.class);
}
Thanks :-) It is working but how to read/write the properties from asset.?
Views
Replies
Total Likes
Asset asset = resource.adaptTo(Asset.class);
String fileName = asset.getMetadataValue("dc:title");
if (fileName instanceof Object[]) {
Object[] titleArray = (Object[]) asset.getMetadata("dc:title");
fileName = (titleArray.length > 0) ? titleArray[0].toString() : "";
} else {
fileName = asset.getName();
}
Property property = asset.adaptTo(Node.class).getNode(JcrConstants.JCR_CONTENT + "/renditions/original/" + JcrConstants.JCR_CONTENT).getProperty(JcrConstants.JCR_DATA);
fileSize = property.getBinary().getSize();
String thumbnailPath = asset.adaptTo(Node.class).getNode(JcrConstants.JCR_CONTENT + "/renditions/" + "you/rendition/to/use").getPath();