Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

navigational access

Avatar

Level 2

The dev guidelines specifies that:

"For rendering content, use navigational access to the content tree instead of performing a JCR Query."

What is the meaning of "navigational access"? Access node data via resourceResolver.getResource()?

1 Accepted Solution

Avatar

Correct answer by
Level 10

"Should i get node data via resourceResolver.getResource() instead of JCR Queries? Is that the meaning of "navigational access" specified in the guide ?"

Not necessarily -- you can retrieve data from the JCR using 1 of three ways:

1 - Use of JCR SQL/2 API

2 - use of QUery Builder API

3- use of SLing API.

The JCR API is the lowest level API and a lot of developers are using JCR SQL2 to retrieve data. QUeryBuilder API is built upon JCR SQL. Sling API is about retrieving resources instead of searching nodes and properties. 

Read this blog for more information:

https://cqdump.wordpress.com/2012/11/06/cq5-coding-patterns-sling-vs-jcr-part-1/

View solution in original post

4 Replies

Avatar

Employee Advisor

I guess what they mean is to render links of the pages in the navigation which are required for navigation. A content tree can have multiple nodes at level 1, 2 and 3 but you may not want to show all of them in your site navigation. May be it would be desired to show only top 5 level 1,2 and 3 links. 

Example -There is a special property in every page called as "Hide in Nav". If it is set to true then you should not show up that page in the navigation. https://docs.adobe.com/docs/en/cq/5-4/wcm/page_create_edit.html#Setting Page Properties

There could be more examples like this based on business requirements. 

Avatar

Level 2

Thanks for your reply kunal23.

You are talking about rendering a navigation component. My question aim a more generic scenario; What about the business scenario where the system suppose to display content data from a specific node? Eg:

  • creating a "top 10 latest news items" overview

Should i get node data via resourceResolver.getResource() instead of JCR Queries? Is that the meaning of "navigational access" specified in the guide ?

Avatar

Correct answer by
Level 10

"Should i get node data via resourceResolver.getResource() instead of JCR Queries? Is that the meaning of "navigational access" specified in the guide ?"

Not necessarily -- you can retrieve data from the JCR using 1 of three ways:

1 - Use of JCR SQL/2 API

2 - use of QUery Builder API

3- use of SLing API.

The JCR API is the lowest level API and a lot of developers are using JCR SQL2 to retrieve data. QUeryBuilder API is built upon JCR SQL. Sling API is about retrieving resources instead of searching nodes and properties. 

Read this blog for more information:

https://cqdump.wordpress.com/2012/11/06/cq5-coding-patterns-sling-vs-jcr-part-1/

Avatar

Level 9

Should i get node data via resourceResolver.getResource() instead of JCR Queries?

It depends on your need. For instance, If you just want the list of 10 latest news and news pages are not in order, you may have to iterate all the nodes to find 10 latest news. So, searching would good option. However, if news pages are in order. You don't need to search.  

Jitendra

gustavof46708500 wrote...

Thanks for your reply kunal23.

You are talking about rendering a navigation component. My question aim a more generic scenario; What about the business scenario where the system suppose to display content data from a specific node? Eg:

  • creating a "top 10 latest news items" overview

Should i get node data via resourceResolver.getResource() instead of JCR Queries? Is that the meaning of "navigational access" specified in the guide ?