AnsweredAssumed Answered

Policy method 'beforeDeleteNode' gives an invalid NodeRef

Question asked by nicolasraoul on Apr 20, 2010
Latest reply on Apr 23, 2010 by nicolasraoul
I want to perform something just before a node is deleted, so I implemented the "beforeNodeDelete" policy:

public void beforeDeleteNode(NodeRef node) {
   if ( nodeService.hasAspect(node, MYASPECT) )
      doSomething();
}

As expected, this method is called when I click on "delete" in the Web Client.
But when I use NodeService on the node (the "hasAspect" line above), I get an exception saying the node does not exist:

InvalidNodeRefException: Node does not exist: workspace://SpacesStore/6ea81fbd-f911-4884-a2a7-dea408a86c04

Why offer the NodeRef in the prototype of beforeDeleteNode(NodeRef node) if this NodeRef is invalid ?!
Can someone enlighten me?

Note: However, I can access this workspace://SpacesStore/6ea81fbd-f911-4884-a2a7-dea408a86c04 node using the node browser.

Outcomes