Expand my Community achievements bar.

SOLVED

Need to get the asset that has no reference

Avatar

Level 4

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?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.

Screen Shot 2018-06-19 at 2.50.15 PM.png

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



Arun Patidar

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

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.

Screen Shot 2018-06-19 at 2.50.15 PM.png

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



Arun Patidar