Merged V3.2 to HEAD

17262: Fix for ETHREEOH-2898: Share Login - using return with auto-complete clears login screen details
   17264: Fix for ETHREEOH-2368 Added category is not visible in "Categories" in Side Bar even after the page is refreshed.
   17266: Merged V3.1 to V3.2
      17265: ETHREEOH-3213 - Error occurs if you try to Configure of Site Wiki dashlet if wiki page name contains russian letters
   17279: Fix for ETHREEOH-3110 - Error page if Add broken number by create(edit) ASR or FSR.
   17281: Fix to unreported error where the NodeBrowser would not display nodes that ...
   17283: ETHREEOH-3037 and ETHREEOH-2158
   17286: Fix for ETHREEOH-3075 Encoding field is displayed as empty on Versioned details page.
   17289: Merged V3.1 to V3.2
      17288: Fix for ETHREEOH-3164 Link Destination (with modify properties of a space link) does ...
   17291: Fix for ETHREEOH-2403 It's possible to create a content with spaces.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18034 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-01-14 15:03:17 +00:00
parent 2524187ddb
commit 58dd1c6228

View File

@@ -729,16 +729,17 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
return nodeDaoService.getNodeAspects(nodePair.getFirst()); return nodeDaoService.getNodeAspects(nodePair.getFirst());
} }
/**
* Delete Node
*/
public void deleteNode(NodeRef nodeRef) public void deleteNode(NodeRef nodeRef)
{ {
// Pair contains NodeId, NodeRef
Pair<Long, NodeRef> nodePair = getNodePairNotNull(nodeRef); Pair<Long, NodeRef> nodePair = getNodePairNotNull(nodeRef);
Long nodeId = nodePair.getFirst(); Long nodeId = nodePair.getFirst();
Boolean requiresDelete = null; Boolean requiresDelete = null;
// Invoke policy behaviours
invokeBeforeDeleteNode(nodeRef);
// get the primary parent-child relationship before it is gone // get the primary parent-child relationship before it is gone
Pair<Long, ChildAssociationRef> childAssocPair = nodeDaoService.getPrimaryParentAssoc(nodeId); Pair<Long, ChildAssociationRef> childAssocPair = nodeDaoService.getPrimaryParentAssoc(nodeId);
ChildAssociationRef childAssocRef = childAssocPair.getSecond(); ChildAssociationRef childAssocRef = childAssocPair.getSecond();
@@ -746,12 +747,16 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
QName nodeTypeQName = nodeDaoService.getNodeType(nodeId); QName nodeTypeQName = nodeDaoService.getNodeType(nodeId);
Set<QName> nodeAspectQNames = nodeDaoService.getNodeAspects(nodeId); Set<QName> nodeAspectQNames = nodeDaoService.getNodeAspects(nodeId);
// check if we need to archive the node
StoreRef storeRef = nodeRef.getStoreRef(); StoreRef storeRef = nodeRef.getStoreRef();
StoreRef archiveStoreRef = storeArchiveMap.get(storeRef); StoreRef archiveStoreRef = storeArchiveMap.get(storeRef);
/**
* Work out whether we need to archive or delete the node.
*/
if (archiveStoreRef == null) if (archiveStoreRef == null)
{ {
// The store does not specify archiving
requiresDelete = true; requiresDelete = true;
} }
else else
@@ -784,12 +789,18 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
} }
} }
/**
* Now we have worked out whether to archive or delete, go ahead and do it
*/
if (requiresDelete == null || requiresDelete) if (requiresDelete == null || requiresDelete)
{ {
// Cascade as required // Invoke policy behaviours
invokeBeforeDeleteNode(nodeRef);
// Cascade delecte as required
if (cascadeInTransaction) if (cascadeInTransaction)
{ {
deletePrimaryChildren(nodePair, true); deletePrimaryChildrenNotArchived(nodePair, true);
} }
// perform a normal deletion // perform a normal deletion
nodeDaoService.deleteNode(nodeId); nodeDaoService.deleteNode(nodeId);
@@ -801,20 +812,31 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
} }
else else
{ {
// archive it /**
* Go ahead and archive the node
*
* Archiving will take responsibility for firing the policy behaviours on
* the nodes it modifies.
*/
archiveNode(nodeRef, archiveStoreRef); archiveNode(nodeRef, archiveStoreRef);
// The archive performs a move, which will fire the appropriate OnDeleteNode
invokeOnDeleteNode(childAssocRef, nodeTypeQName, nodeAspectQNames, true);
} }
} }
private void deletePrimaryChildren(Pair<Long, NodeRef> nodePair, boolean cascade) /**
* delete primary children - private method for deleteNode.
*
* recurses through children when deleting a node. Does not archive.
*
* @param nodePair
* @param cascade
*/
private void deletePrimaryChildrenNotArchived(Pair<Long, NodeRef> nodePair, boolean cascade)
{ {
Long nodeId = nodePair.getFirst(); Long nodeId = nodePair.getFirst();
// Get the node's primary children // Get the node's primary children
final List<Pair<Long, NodeRef>> childNodePairs = new ArrayList<Pair<Long, NodeRef>>(5); final List<Pair<Long, NodeRef>> childNodePairs = new ArrayList<Pair<Long, NodeRef>>(5);
// TODO: Fix issues when invoking onDeleteNode
// final Map<Long, ChildAssociationRef> childAssocRefsByChildId = new HashMap<Long, ChildAssociationRef>(5); final Map<Long, ChildAssociationRef> childAssocRefsByChildId = new HashMap<Long, ChildAssociationRef>(5);
NodeDaoService.ChildAssocRefQueryCallback callback = new NodeDaoService.ChildAssocRefQueryCallback() NodeDaoService.ChildAssocRefQueryCallback callback = new NodeDaoService.ChildAssocRefQueryCallback()
{ {
public boolean handle( public boolean handle(
@@ -825,7 +847,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
{ {
// Add it // Add it
childNodePairs.add(childNodePair); childNodePairs.add(childNodePair);
// childAssocRefsByChildId.put(childNodePair.getFirst(), childAssocPair.getSecond()); childAssocRefsByChildId.put(childNodePair.getFirst(), childAssocPair.getSecond());
// No recurse // No recurse
return false; return false;
} }
@@ -844,9 +866,9 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
// Fire node policies. This ensures that each node in the hierarchy gets a notification fired. // Fire node policies. This ensures that each node in the hierarchy gets a notification fired.
Long childNodeId = childNodePair.getFirst(); Long childNodeId = childNodePair.getFirst();
NodeRef childNodeRef = childNodePair.getSecond(); NodeRef childNodeRef = childNodePair.getSecond();
// QName childNodeType = nodeDaoService.getNodeType(childNodeId); QName childNodeType = nodeDaoService.getNodeType(childNodeId);
// Set<QName> childNodeQNames = nodeDaoService.getNodeAspects(childNodeId); Set<QName> childNodeQNames = nodeDaoService.getNodeAspects(childNodeId);
// ChildAssociationRef childParentAssocRef = childAssocRefsByChildId.get(childNodeId); ChildAssociationRef childParentAssocRef = childAssocRefsByChildId.get(childNodeId);
invokeBeforeDeleteNode(childNodeRef); invokeBeforeDeleteNode(childNodeRef);
@@ -855,11 +877,11 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
// the actual delete starts. // the actual delete starts.
if (cascade) if (cascade)
{ {
deletePrimaryChildren(childNodePair, true); deletePrimaryChildrenNotArchived(childNodePair, true);
} }
// Delete the child // Delete the child
nodeDaoService.deleteNode(childNodeId); nodeDaoService.deleteNode(childNodeId);
// invokeOnDeleteNode(childParentAssocRef, childNodeType, childNodeQNames, true); invokeOnDeleteNode(childParentAssocRef, childNodeType, childNodeQNames, false);
} }
} }
@@ -2054,6 +2076,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
} }
/** /**
* Move Node
*
* Drops the old primary association and creates a new one * Drops the old primary association and creates a new one
*/ */
public ChildAssociationRef moveNode( public ChildAssociationRef moveNode(
@@ -2101,7 +2125,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
handleStoreMoveConflicts(nodeToMovePair, newStoreRef); handleStoreMoveConflicts(nodeToMovePair, newStoreRef);
} }
// Invoke policy behaviour // Invoke "Before"policy behaviour
if (movingStore) if (movingStore)
{ {
invokeBeforeDeleteNode(nodeToMoveRef); invokeBeforeDeleteNode(nodeToMoveRef);