I want to get usage information of any DAM asset. That means suppose an Image is used in different content. I want that information or the location where the image has been used.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @AsifChowdhury ,
You can get the reference information from properties as suggest by @milind_bachani .
Also there is ReferenceSearch API to get reference in java as below.
You can pass asset or page path from servlet parameter and import ReferenceSearch.
import com.day.cq.wcm.commons.ReferenceSearch;
resourceResolver = request.getResourceResolver();
//Asset or Page Path
String pagePath = request.getParameter("pagePath");
/* Reference Search of Page
* Provide list of all pages where current page are being Used */
ReferenceSearch referenceSearch = new ReferenceSearch();
referenceSearch.setExact(true);
referenceSearch.setHollow(true);
referenceSearch.setMaxReferencesPerPage(-1);
Collection<ReferenceSearch.Info> resultSet = referenceSearch.search(resourceResolver, pagePath).values();
for (ReferenceSearch.Info info : resultSet) {
String currentPage = info.getPagePath();
//Custom code using reference page path
}
Regards
Shiv
@milind_bachani , Can I get that information programmatically in JAVA? Do you know any way to do it or can you give me any reference?
Hi @AsifChowdhury ,
You can get the reference information from properties as suggest by @milind_bachani .
Also there is ReferenceSearch API to get reference in java as below.
You can pass asset or page path from servlet parameter and import ReferenceSearch.
import com.day.cq.wcm.commons.ReferenceSearch;
resourceResolver = request.getResourceResolver();
//Asset or Page Path
String pagePath = request.getParameter("pagePath");
/* Reference Search of Page
* Provide list of all pages where current page are being Used */
ReferenceSearch referenceSearch = new ReferenceSearch();
referenceSearch.setExact(true);
referenceSearch.setHollow(true);
referenceSearch.setMaxReferencesPerPage(-1);
Collection<ReferenceSearch.Info> resultSet = referenceSearch.search(resourceResolver, pagePath).values();
for (ReferenceSearch.Info info : resultSet) {
String currentPage = info.getPagePath();
//Custom code using reference page path
}
Regards
Shiv
Thanks a lot @Shiv_Prakash_Patel , it's working.
Views
Likes
Replies