Hello Team,
Solved! Go to Solution.
Views
Replies
Total Likes
In that case you can try using
@Self
private Resource resource;
resource.getPath();
Hi Mahesh,
Is there a particular reason why you would adapt it to a POJO class?
Instead you can adapt it to Page class and get all the fields required.
Page page = resource.adaptTo(Page.class);
if (page != null) {
String title = page.getTitle();
String path = page.getPath();
}
I have 15 to 20 custom properties under each page. So, if I adapt to Page.class, then I need to write several lines of code to get each properties.
String title = page.getTitle();
String path = page.getPath();
ValueMap values = page.getProperties();
then, get each property values from ValueMap object.
Also, Need to iterate through SearchResult object using while or for loop.
In that case you can try using
@Self
private Resource resource;
resource.getPath();
Thanks a lot @SwetaB
Your solution works like a charm. Here is my code snippet.
Views
Likes
Replies
Views
Likes
Replies