Need to get the asset that has no reference | Community
Skip to main content
ranadyutis95334
Level 3
June 19, 2018
Solved

Need to get the asset that has no reference

  • June 19, 2018
  • 1 reply
  • 1285 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
June 19, 2018

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