Need to get the asset that has no reference | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Jun 19, 2018 1:06 PM UTC

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

Arun Patidar

1 reply

arunpatidar
arunpatidarAccepted solution
New Participant
Jun 19, 2018 1:06 PM UTC

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

Translate
Arun Patidar