cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] Obtaining Node from NodeRef

bluearth
Champ in-the-making
Champ in-the-making
Hi all,

How do I obtain a Node given its NodeRef?

My real problam is actually this:

I need to generate clickable URL link to my newly created node.

I have just created a node using the FileFolderService create() method which returns a FileInfo.
From the FileInfo, I can obtain the NodeRef to the created node.

I plan to use this utility method to create the URL: Utils.generateURL(FacesContext, Node, Mode) from org.alfresco.web.ui.common.Utils
as we can see the method takes a Node, instead of NodeRef.

Or is there an easy way to do this?
4 REPLIES 4

pedrosaraiva
Champ in-the-making
Champ in-the-making
Hello,

I'm new to Alfresco but I think you can create a Node passing the NodeRef as a parameter of the constructor, like this:


Node node = new Node( nodeRef );

Hope it helps,

Pedro Saraiva

bluearth
Champ in-the-making
Champ in-the-making
Hello,
I'm new to Alfresco but I think you can create a Node passing the NodeRef as a parameter of the constructor, like this:

But Node is an Interface. You can't 'create' an instance out of an Interface.

I think there has got to be a a method somewhere among the repository Service to do this… still searching.

mrogers
Star Contributor
Star Contributor
org.alfresco.web.bean.repository.Node is a class not an interface.

And as Pedro says above there is a constructor.

public Node(NodeRef nodeRef)

bluearth
Champ in-the-making
Champ in-the-making
org.alfresco.web.bean.repository.Node is a class not an interface.

And as Pedro says above there is a constructor.

public Node(NodeRef nodeRef)


Turns out this is a trivial thing. Mea Culpa.

Thanks everyone