Extracting the Page resources(Sling resource type, name, template, title, description) | Community
Skip to main content
Level 6
September 8, 2021
Solved

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

  • September 8, 2021
  • 2 replies
  • 2386 views

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

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 Asutosh_Jena_

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!

2 replies

Asutosh_Jena_
Community Advisor
Community Advisor
September 8, 2021

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!

Ronnie09Author
Level 6
September 8, 2021

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_
Community Advisor
Asutosh_Jena_Community AdvisorAccepted solution
Community Advisor
September 8, 2021

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!

Kiran_Vedantam
Community Advisor
Community Advisor
September 8, 2021

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.

Ronnie09Author
Level 6
September 8, 2021

Will give a try.