cancel
Showing results for 
Search instead for 
Did you mean: 

Problem deleting node with rules

guiguik
Champ in-the-making
Champ in-the-making
Hi guys,

I have a new question. I passed most of my day on this problem and I'm out of solution. It's a little bit complexe but I will try to explain simply.

So I had a node with rules. Rules are create programmaticaly when a specific association is create by a custom behavior. Those rules are not add on the folder associated but on a parent folder and are use to move content in the subfolder depending on a property. It's like a dispatch, we say if subfolder has this association then move all content from parent folder in this subfolder.

On the other hand I equally had my behavior whose delate my rules if association is deleted.

This behaviour and rule work correctly (or I think so) and are not the problem.

My problem is when I want to delete the parent folder (the one with the rule) then I have a error and nothing append:

Exception from executeScript - redirecting to status template error: Node does not exist: workspace://SpacesStore/94261b21-70d7-4dc6-9e18-4cb5672876a0(Status[id=98929changeTxnId=383e90d6-0cdb-4568-ade1-2eb6040e30f8, dbTxnId=3819, deleted=true])
org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: workspace://SpacesStore/94261b21-70d7-4dc6-9e18-4cb5672876a0(Status[id=98929changeTxnId=383e90d6-0cdb-4568-ade1-2eb6040e30f8, dbTxnId=3819, deleted=true])

If I delete rules or if I delete the subfolder, then I could delete my parent folder.

I absolutely not understand where this error come from. Can anybody help me please?

Regards


4 REPLIES 4

kaynezhang
World-Class Innovator
World-Class Innovator
Which webscript api are you using?

org/alfresco/cmis/descendants.delete //this one will just delete the node and it's descendant without any check operations
org/alfresco/cmis/tree.delete  // this one will do some check before deleting folder an its descendant, it may cause your error(I guess you are using this one).
org/alfresco/cmis/item.delete   //this one just delete empty folder  if it has  more than one child,it cann't be deleted.

guiguik
Champ in-the-making
Champ in-the-making
I'm using none of them, it's through share interface. I don't customize the delete action. And I add my rule and my behaviour on alfresco side with java api. But it's the same if I use the NodeService.delete() .

kaynezhang
World-Class Innovator
World-Class Innovator
In share delete a node(file and folder) will call one of following webscript api

DELETE /alfresco/service/slingshot/doclib/action/file/site/{site}/{container}/{path}
DELETE /alfresco/service/slingshot/doclib/action/folder/site/{site}/{container}/{path}
DELETE /alfresco/service/slingshot/doclib/action/file/node/{store_type}/{store_id}/{id}
DELETE /alfresco/service/slingshot/doclib/action/folder/node/{store_type}/{store_id}/{id}

which will call ScriptNode.remove() method and eventually call  NodeService.delete() .So techinally delete the folder through share interface and NodeService.delete() will give you same result.

In NodeService.delete(),the specified node's all descendants,associations will be deleted in same transaction.Since rules applied to a folder are saved as it's descendants,and you may create associations between node and other nodes. I guess it may cause a close loop or someting that make it impossible to delete all descendants,associations in one transaction.

guiguik
Champ in-the-making
Champ in-the-making
Thanks a lot kaynezhang for your help.

Yesterday I come to the same conclusion that it's a transaction problem and I think it come from my behavior.
I have absolutely no idea how to correct that problem. I think I have to manage transaction in my behavior.

Could you help me?