I am trying to get all assets inside a collection how to do that .
Solved! Go to Solution.
Resource Collection API will be used to retrieve the assets in a Collection. For reference
Resource resource = resourceResolver
.getResource("yourpath");
if (null != resource) {
log.debug("resource path is {}", resource.getPath());
ResourceCollection resourceCollection = resource.adaptTo(ResourceCollection.class);
if (null != resourceCollection) {
Iterator<Resource> resourceIterator = resourceCollection.getResources();
while (resourceIterator.hasNext()) {
Resource damResource = resourceIterator.next();
log.debug("damResource path is {}", damResource.getPath());
imagePaths.add(damResource.getPath());
}
}
}
Hi Scott!
Please go through adobe helpx documentations.
Here is the link which expalins adding assets to a collection.
Best,
Cal
Resource Collection API will be used to retrieve the assets in a Collection. For reference
Resource resource = resourceResolver
.getResource("yourpath");
if (null != resource) {
log.debug("resource path is {}", resource.getPath());
ResourceCollection resourceCollection = resource.adaptTo(ResourceCollection.class);
if (null != resourceCollection) {
Iterator<Resource> resourceIterator = resourceCollection.getResources();
while (resourceIterator.hasNext()) {
Resource damResource = resourceIterator.next();
log.debug("damResource path is {}", damResource.getPath());
imagePaths.add(damResource.getPath());
}
}
}