cancel
Showing results for 
Search instead for 
Did you mean: 

get Parent

ruizja
Champ in-the-making
Champ in-the-making
Hi,

I'm working in a custom action and I need to get the parent node (folder/space) that receives the action (document). I could tell someone how to access it? I don't find it!  Smiley Surprisedops:

I have a nodeService instance and a NodeRef of my document (actionedUponNodeRef).

Thanks,
Javier
1 REPLY 1

ruizja
Champ in-the-making
Champ in-the-making
I found myself solution:

ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(actionedUponNodeRef);
if (parentAssoc == null || parentAssoc.getParentRef() == null)
{
// TODO: Distinguish between ItemNotFound and AccessDenied
}
NodeRef parentRef = parentAssoc.getParentRef();