cancel
Showing results for 
Search instead for 
Did you mean: 

OnDeleteNodePolicy fails

shmoula
Champ in-the-making
Champ in-the-making
Hi,
  I have onDeleteNode set, like this:
public class TxtImport implements NodeServicePolicies.OnDeleteNodePolicy, NodeServicePolicies.OnCreateNodePolicy {

   
   public void init() {
      onDeleteNode = new JavaBehaviour(this, "onDeleteNode", notificationFrequency.TRANSACTION_COMMIT);
      
      policyComponent.bindClassBehaviour(
            QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"),
            TxtModel.txtDeployable, onDeleteNode);
   }
   
   
   @Override
   public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived) {
      if(nodeService.hasAspect(childAssocRef.getChildRef(), TxtModel.txtDeployable)){
      }
   }
. . .

But 'nodeService.hasAspect() fails with
Unable to delete File due to system error: Node does not exist: workspace://SpacesStore/571ecf94-73ae-4674-b977-1fc8645a3b6b(Status[changeTxnId=a88b7a08-40c4-4a22-aa6b-9f23a8510174, dbTxnId=144, deleted=true])

I can't figure out - why? That node still exists, noderef equals and nothing is deleted also. Is that code inside transaction and I'm unable to get properties from touched node?

Thanks in advance!
2 REPLIES 2

bchevallereau
Champ in-the-making
Champ in-the-making
Hi,

This policy is called after a node is deleted. The reference given is for an association which has been deleted and cannot be used to retrieve node or associaton information from any of the services.

But you can use this one if you want : BeforeDeleteNodePolicy

Ben

shmoula
Champ in-the-making
Champ in-the-making
Thank you, Ben, I'll try it. Weird thing is that after that exception node is still there :-).