If you are working with Alfresco you defiantly come across term NodeRef. In this post we will go through details of this NodeRef, what exactly NodeRef is? Where does it resides? How to see NodeRef? All those kind of questions answer you will get from this post.
What is NodeRef?
The NodeRef object is a unique reference to a Node, the object that represents locations and resources within an Alfresco repository. So, each and every resource (user, content, folders, rules) in Alfresco is Node and each Node is associated with one address which is nothing but NodeRef. To access given Node we need to have nodeRef of that resource.
For Developers if we go into more depth NodeRef is nothing but a java class
How to Access NodeRef?
If you have NodeRef in form of String or id of node you can simply create new object of NodeRef using constructor
Following two parameters can be used to create NodeRef object.
Construct a Node Reference from a Store Reference and Node Id
storeRef – store reference
id – the manually assigned identifier of the node
public NodeRef(String nodeRef)
Construct a Node Reference from a string representation of a Node Reference.
The string representation of a Node Reference is as follows:
Parameters: nodeRef – the string representation of a node ref
Once you have nodeRef of particular asset within Alfresco you can get all the details related to that Asset by using Alfresco services.
Where to find NodeRef?
If you are looking for NodeRef of particular content you have multiple option to find associated nodeRef.
- Go to document detail page of content there you will be able to see nodeRef as a part of URL. Check out the tail part of URL where you could see nodeRef in the end.
- Edit Properties, Upload New Version, Edit Offline all those links of content also have nodeRef in the tail part of URL
- Through NodeBrowser you can navigate to given content and see nodeRef associate with content.
These is a brief overview about NodeRef in Alfresco I hope your idea about NodeRef is much clearer after reading this blog. Keep posting your queries and suggestions.