Merged V1.3 to HEAD (3106:3116)

svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3106 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3116 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3401 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-07-26 09:41:53 +00:00
parent 50ae7908ae
commit 133c4bc2f3
13 changed files with 163 additions and 66 deletions

View File

@@ -318,7 +318,7 @@ public abstract class AbstractNodeServiceImpl implements NodeService
/**
* @see NodeServicePolicies.OnDeleteNodePolicy#onDeleteNode(ChildAssociationRef)
*/
protected void invokeOnDeleteNode(ChildAssociationRef childAssocRef, QName childNodeTypeQName, Set<QName> childAspectQnames)
protected void invokeOnDeleteNode(ChildAssociationRef childAssocRef, QName childNodeTypeQName, Set<QName> childAspectQnames, boolean isArchivedNode)
{
// get qnames to invoke against
Set<QName> qnames = new HashSet<QName>(childAspectQnames.size() + 1);
@@ -327,7 +327,7 @@ public abstract class AbstractNodeServiceImpl implements NodeService
// execute policy for node type and aspects
NodeServicePolicies.OnDeleteNodePolicy policy = onDeleteNodeDelegate.get(childAssocRef.getChildRef(), qnames);
policy.onDeleteNode(childAssocRef);
policy.onDeleteNode(childAssocRef, isArchivedNode);
}
/**

View File

@@ -679,7 +679,7 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest
nodeService.addAspect(nodeRef, ASPECT_QNAME_TEST_TITLED, null);
}
public void onDeleteNode(ChildAssociationRef childAssocRef)
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isArchivedNode)
{
// add the child to the list
deletedNodeRefs.add(childAssocRef.getChildRef());

View File

@@ -140,9 +140,10 @@ public interface NodeServicePolicies
* which has been deleted and cannot be used to retrieve node or associaton
* information from any of the services.
*
* @param childAssocRef the primary parent-child association of the deleted node
* @param childAssocRef the primary parent-child association of the deleted node
* @param isNodeArchived indicates whether the node has been archived rather than purged
*/
public void onDeleteNode(ChildAssociationRef childAssocRef);
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived);
}
public interface BeforeAddAspectPolicy extends ClassPolicy

View File

@@ -451,7 +451,9 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
// invoke policy behaviour
if (movingStore)
{
invokeOnDeleteNode(oldAssocRef, nodeToMoveTypeQName, nodeToMoveAspects);
// TODO for now indicate that the node has been archived to prevent the version history from being removed
// in the future a onMove policy could be added and remove the need for onDelete and onCreate to be fired here
invokeOnDeleteNode(oldAssocRef, nodeToMoveTypeQName, nodeToMoveAspects, true);
invokeOnCreateNode(newAssoc.getChildAssocRef());
}
else
@@ -643,6 +645,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
public void deleteNode(NodeRef nodeRef)
{
boolean isArchivedNode = false;
// Invoke policy behaviours
invokeBeforeDeleteNode(nodeRef);
@@ -663,15 +667,17 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
{
// perform a normal deletion
nodeDaoService.deleteNode(node, true);
isArchivedNode = false;
}
else
{
// archive it
archiveNode(nodeRef, archiveStoreRef);
isArchivedNode = true;
}
// Invoke policy behaviours
invokeOnDeleteNode(childAssocRef, nodeTypeQName, nodeAspectQNames);
invokeOnDeleteNode(childAssocRef, nodeTypeQName, nodeAspectQNames, isArchivedNode);
}
public ChildAssociationRef addChild(NodeRef parentRef, NodeRef childRef, QName assocTypeQName, QName assocQName)

View File

@@ -96,7 +96,7 @@ public class NodeIndexer
indexer.updateNode(nodeRef);
}
public void onDeleteNode(ChildAssociationRef childAssocRef)
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isArchivedNode)
{
indexer.deleteNode(childAssocRef);
}

View File

@@ -335,7 +335,7 @@ public class IntegrityChecker
/**
* No checking performed: The association changes will be handled
*/
public void onDeleteNode(ChildAssociationRef childAssocRef)
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isArchivedNode)
{
}