Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Extracting the Page resources(Sling resource type, name, template, title, description)

Ronnie09
Level 3
Level 3

I am creating the workflow to update the previously used components (Aem 6.0), to latest version so I want to write workflow to update its sling resource type, description for 15+ pages.

 

I am confused how to get the resource name, template name, title and description of new and old component update it accordingly used Java workflows. 

 

If possible help me in writing the workflow to extract Sling resource type, name, template, title and description of new component that would also help a lot .

Thanks in advance

1 Accepted Solution
asutosh_jena
Correct answer by
Community Advisor
Community Advisor

You can build a logic in Java which will iterate through all the pages that you want and will try to retrieve the JSON value. Now convert the JSON to Java Objects and then retrieve whatever information is required from the JSON.

 

Thanks!

View solution in original post

6 Replies
asutosh_jena
Community Advisor
Community Advisor

Hi @Ronnie09 

 

If you access any of the page with .infinity.json as the extension, you can see the complete page information.

 

Here is a sample:

http://localhost:4502/content/we-retail/ca/en/experience.infinity.json

 

Thanks!

Ronnie09
Level 3
Level 3

Can you help me extracting the same (Sling resource type, name, template, title, description) using the Java code or provide some other link

 

asutosh_jena
Correct answer by
Community Advisor
Community Advisor

You can build a logic in Java which will iterate through all the pages that you want and will try to retrieve the JSON value. Now convert the JSON to Java Objects and then retrieve whatever information is required from the JSON.

 

Thanks!

View solution in original post

KiranVedantam1992
Community Advisor
Community Advisor

Hi @Ronnie09,

 

You can extract the properties of any node via java using sling models as explained by me here. If you are not interested in doing it via models, you can do it by adapting it to other classes which I have mentioned in the same post. 

 

Hope this helps!

 

Thanks,

Kiran Vedantam.