HI Friends,
Can you pls explain the difference between the below
getProperties.get("propertyName").toString(); and node.getProperty("propertyName");
Thanks in advance
Akbar
Solved! Go to Solution.
Dear @akbareee, you must first understand the technology stack that AEM relies on, which is:
You can access content stored in the repository by using APIs from any of the technologies; this would be the first big difference you asked for:
node.getProperty("propertyName"); --> Provided by JCR technology
getProperties.get("propertyName").toString(); ---> Provided by Apache Sling Technology
in case of "getProperties" your basically accessing a "globally available Sling object" whereas "node" must be an instance of Node class.
Regards,
"getProperties" seems odd as variable name ... :-)
But the difference between these is the type of API; one is using the lowlevel JCR API, while the other one uses the Sling Resource API.
I wrote a blog post about some years ago, which I consider as still relevant: CQ5 coding patterns: Sling vs JCR (part 1) | Things on a content management system
Jörg
Dear @akbareee, you must first understand the technology stack that AEM relies on, which is:
You can access content stored in the repository by using APIs from any of the technologies; this would be the first big difference you asked for:
node.getProperty("propertyName"); --> Provided by JCR technology
getProperties.get("propertyName").toString(); ---> Provided by Apache Sling Technology
in case of "getProperties" your basically accessing a "globally available Sling object" whereas "node" must be an instance of Node class.
Regards,
Nice response!
Views
Replies
Total Likes
Thanks Julio Tobar, it's really helpful
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies