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()?
Solved! Go to Solution.
Views
Replies
Total Likes
"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/
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
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:
Should i get node data via resourceResolver.getResource() instead of JCR Queries? Is that the meaning of "navigational access" specified in the guide ?
Views
Replies
Total Likes
"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/
Views
Replies
Total Likes
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 systemsuppose to display content data from a specific node?Eg :
creating a "top 10 latest news items" overview
Should
get node data via i resourceResolver . getResource ) instead of JCR Queries? Is that the meaning of "navigational access" specified in the guide ( ?
Views
Replies
Total Likes
Views
Likes
Replies