Need to get the asset that has no reference
Can anyone please give me a query to get all the non-reference asset in DAM? Or is there any other way to get it?
Can anyone please give me a query to get all the non-reference asset in DAM? Or is there any other way to get it?
Hi,
In classic UI Digital Assets, select any image ( Tools --> Reference) you can see all the references of an image. You can use same functionality to create utility(Servlet) which takes root path and execute below method to find out references for all the images inside root and return assets for which below method returns map size 0.

import com.day.cq.wcm.commons.ReferenceSearch;
ReferenceSearch rr = new ReferenceSearch();
Map map = rr.search(request.getResourceResolver(),"/content/dam/AEM63App/abcd.jpg");
logger.info("Map Size is {}", map.size());
You can check the size of map if it is 0 then no reference.
Thanks
Arun
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.