navigational access | Community
Skip to main content
Level 2
February 8, 2016
Solved

navigational access

  • February 8, 2016
  • 4 replies
  • 1327 views

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()?

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 smacdonald2008

"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/

4 replies

Kunal_Gaba_
February 9, 2016

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. 

Level 2
February 9, 2016

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 ?

smacdonald2008
smacdonald2008Accepted solution
Level 10
February 9, 2016

"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/

Jitendra_S_Toma
Level 10
February 9, 2016

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 ?