Expand my Community achievements bar.

SOLVED

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

Avatar

Level 7

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

Avatar

Correct answer by
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

Avatar

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!

Avatar

Level 7

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

 

Avatar

Correct answer by
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!

Avatar

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.