Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

59021: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      58878: Merged DEV to V4.2-BUG-FIX (4.2.1)
         58843: MNT-10137 : Update of document.name during creation leads to execution of a content rule specified for deletion (outbound)
         Added BeforeMoveNodePolicy binding to BeforeDeleteChildAssociationRuleTrigger to handle renames via move correctly.
         58645: ALF-12726 : Update of document.name during creation leads to execution of a content rule specified for deletion (outbound)
         Added a JUnit test to reproduce the issue.
         58670: MNT-10137 : Update of document.name during creation leads to execution of a content rule specified for deletion (outbound)
         Added an additional check to the test that reproduces the issue (does not pass).
         Added a test that uses NodeService to rename the node (passes).
         58675: MNT-10137 : Update of document.name during creation leads to execution of a content rule specified for deletion (outbound)
         Added fixes to the test.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62065 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-12 00:36:16 +00:00
parent f7f14fd0d2
commit 6ccd948c48
2 changed files with 137 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2013 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -42,7 +42,8 @@ import org.apache.commons.logging.LogFactory;
*/
public class BeforeDeleteChildAssociationRuleTrigger
extends RuleTriggerAbstractBase
implements NodeServicePolicies.BeforeDeleteChildAssociationPolicy
implements NodeServicePolicies.BeforeDeleteChildAssociationPolicy,
NodeServicePolicies.BeforeMoveNodePolicy
{
/**
@@ -78,6 +79,11 @@ public class BeforeDeleteChildAssociationRuleTrigger
this,
new JavaBehaviour(this, POLICY));
}
this.policyComponent.bindClassBehaviour(
NodeServicePolicies.BeforeMoveNodePolicy.QNAME,
this,
new JavaBehaviour(this, NodeServicePolicies.BeforeMoveNodePolicy.QNAME.getLocalName()));
}
public void beforeDeleteChildAssociation(ChildAssociationRef childAssocRef)
@@ -104,4 +110,19 @@ public class BeforeDeleteChildAssociationRuleTrigger
triggerRules(childAssocRef.getParentRef(), childNodeRef);
}
@Override
public void beforeMoveNode(ChildAssociationRef oldChildAssocRef, NodeRef newParentRef)
{
// Break out early if rules are not enabled
if (!areRulesEnabled())
{
return;
}
// Check that it is rename operation, add the node to the ignore list.
if (oldChildAssocRef.getParentRef().equals(newParentRef))
{
TransactionalResourceHelper.getSet(RULE_TRIGGER_RENAMED_NODES).add(oldChildAssocRef.getChildRef());
}
}
}