Added invokeBeforeDeleteNode calls for all nodes down a deletion stack

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16480 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-09-24 09:57:45 +00:00
parent 0a118c62aa
commit 6e0979ea2c

View File

@@ -809,6 +809,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
Long nodeId = nodePair.getFirst();
// Get the node's primary children
final List<Pair<Long, NodeRef>> childNodePairs = new ArrayList<Pair<Long, NodeRef>>(5);
// final Map<Long, ChildAssociationRef> childAssocRefsByChildId = new HashMap<Long, ChildAssociationRef>(5);
NodeDaoService.ChildAssocRefQueryCallback callback = new NodeDaoService.ChildAssocRefQueryCallback()
{
public boolean handle(
@@ -819,6 +820,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
{
// Add it
childNodePairs.add(childNodePair);
// childAssocRefsByChildId.put(childNodePair.getFirst(), childAssocPair.getSecond());
// No recurse
return false;
}
@@ -828,18 +830,25 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
// Each child must be deleted
for (Pair<Long, NodeRef> childNodePair : childNodePairs)
{
// Cascade, if required
// Fire node policies. This ensures that each node in the hierarchy gets a notification fired.
Long childNodeId = childNodePair.getFirst();
NodeRef childNodeRef = childNodePair.getSecond();
// QName childNodeType = nodeDaoService.getNodeType(childNodeId);
// Set<QName> childNodeQNames = nodeDaoService.getNodeAspects(childNodeId);
// ChildAssociationRef childParentAssocRef = childAssocRefsByChildId.get(childNodeId);
invokeBeforeDeleteNode(childNodeRef);
// Cascade first, if required.
// This ensures that the beforeDelete policy is fired for all nodes in the hierarchy before
// the actual delete starts.
if (cascade)
{
deletePrimaryChildren(childNodePair, true);
}
// Delete the child
nodeDaoService.deleteNode(childNodePair.getFirst());
// It would appear that policies should be fired here, but they have never been, so
// in the order to maintain historical consistency we keep it the same.
// // Fire node policies. This ensures that each node in the hierarchy gets a notification fired.
// invokeOnDeleteNode(oldParentAssocPair.getSecond(), childNodeTypeQName, childNodeAspectQNames, true);
// invokeOnCreateNode(newParentAssocPair.getSecond());
nodeDaoService.deleteNode(childNodeId);
// invokeOnDeleteNode(childParentAssocRef, childNodeType, childNodeQNames, true);
}
}