cancel
Showing results for 
Search instead for 
Did you mean: 

Zombie association after deleting nodeRef

alex_chew
Champ in-the-making
Champ in-the-making
Hi,

I am now working on a local project based on Alfresco 4.0.c community version. Everything goes well except deleting function.  And the error can be reproduced like below steps:
1)I defined one to many association between type A and type B.
2)I created an A and create many B:s (B1,B2…B10)
3)I associated A with all B:s
4)I could query all associated B:s by using nodeSerivce.getTargetAssocs.
5)I removed B7 and B6
6)I could not get the remaining 8 B:s by using nodeService.getTargetAssocs. An Access Denied exception was thrown.

I know the deleted data will be marked as DELETED but not be removed physically. But what about the associations that hooked to the deleted node?

In above case,the size of returning List<AssociationRef> was 10 instead of 8! But when I tried to get properties of targetNodeRef an Access Denied exception was thrown. I had to add try{}catch{} lines to make sure all remaining LIVE association can be fetched correctly. I even cannot use nodeService.getNodeStatus() to check whether the node is marked as DELETED. Is there has some methods to fetch only LIVE associations?

Thanks in advance.

Best Regards,
Alex
3 REPLIES 3

kevinr
Star Contributor
Star Contributor
Each assocation (source or target) is deleted explicitly by ID before the node is physically deleted.  There is no longer an update to mark a node as deleted.  The row is physically removed and a new row is created as a marker.  Therefore, the DB will not allow dangling associations and if it says there are 10 associations then there are still 10.

https://issues.alfresco.com/jira/browse/ALF-12358

Fixed for 4.1.1.

Upgrade to the lovely new 4.2.c and you will get the fix.

Thanks,

Kevin

alex_chew
Champ in-the-making
Champ in-the-making
Hi  Kevin,

Thanks for the information. I now know where my problem stays.  I can get all related nodes by using nodeService.getTargetAssocs even those ones associated to nodes like "archive://SpaceStore/***". Is there a method to get only live nodes like "workspace://SpaceStore/***"? 

Best  Regards,
Alex

alex_chew
Champ in-the-making
Champ in-the-making
I have added a BeforeMethodAdivce on nodeService.deleteNode. I broke associations manually before the node was physically removed. Now everything goes well. Thanks.

Alex