mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
ACE-4250: Revert r110119 (except keep 2 out of 4 unit tests)
- note: related to ACE-4421/MNT-13836 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@114219 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -20,7 +20,6 @@ package org.alfresco.repo.policy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
@@ -162,17 +161,29 @@ import org.alfresco.util.LockHelper;
|
||||
{
|
||||
List<BehaviourDefinition> behaviours = new ArrayList<BehaviourDefinition>();
|
||||
|
||||
// Determine if behaviour has been disabled
|
||||
boolean isEnabled = true;
|
||||
if (filter != null)
|
||||
{
|
||||
NodeRef nodeRef = binding.getNodeRef();
|
||||
QName className = binding.getClassQName();
|
||||
isEnabled = (nodeRef == null) ? filter.isEnabled(className) : filter.isEnabled(nodeRef, className);
|
||||
}
|
||||
|
||||
if (isEnabled)
|
||||
{
|
||||
// Find class behaviour by scanning up the class hierarchy
|
||||
List<BehaviourDefinition<B>> behaviour = null;
|
||||
while (binding != null)
|
||||
{
|
||||
behaviour = classMap.get(binding);
|
||||
if (behaviour != null && isEnabled(binding))
|
||||
if (behaviour != null)
|
||||
{
|
||||
behaviours.addAll(0, behaviour); // note: list base/generalised before extended/specific
|
||||
}
|
||||
binding = (B)binding.generaliseBinding();
|
||||
}
|
||||
}
|
||||
|
||||
// Append all service-level behaviours
|
||||
behaviours.addAll(serviceMap.getAll());
|
||||
@@ -255,17 +266,4 @@ import org.alfresco.util.LockHelper;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEnabled(B binding)
|
||||
{
|
||||
// Determine if behaviour has been disabled
|
||||
boolean isEnabled = true;
|
||||
if (filter != null)
|
||||
{
|
||||
NodeRef nodeRef = binding.getNodeRef();
|
||||
QName className = binding.getClassQName();
|
||||
isEnabled = (nodeRef == null) ? filter.isEnabled(className) : filter.isEnabled(nodeRef, className);
|
||||
}
|
||||
|
||||
return isEnabled;
|
||||
}
|
||||
}
|
||||
|
@@ -426,6 +426,7 @@ public class PolicyComponentTransactionTest extends TestCase
|
||||
* <p>then disable the super- behaviour only and show that sub behaviour is still enabled and triggered</p>
|
||||
* @throws Exception
|
||||
*/
|
||||
/*
|
||||
public void testChildParentBehaviours2() throws Exception
|
||||
{
|
||||
TestOnCreateNodePolicy baseTypeBehavior = new TestOnCreateNodePolicy();
|
||||
@@ -476,6 +477,7 @@ public class PolicyComponentTransactionTest extends TestCase
|
||||
assertTrue("Behavior should be executed for child type.", fileTypeBehavior.isExecuted());
|
||||
assertEquals(1, fileTypeBehavior.getExecutionCount());
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test for MNT_13836
|
||||
@@ -544,6 +546,7 @@ public class PolicyComponentTransactionTest extends TestCase
|
||||
* <p>then vice-versa, ie. disabling sub- behaviour does not disable inherited super- behaviours</p>
|
||||
* @throws Exception
|
||||
*/
|
||||
/*
|
||||
public void testChildParentBehaviours4() throws Exception
|
||||
{
|
||||
TestOnCreateNodePolicy baseTypeBehavior = new TestOnCreateNodePolicy();
|
||||
@@ -594,6 +597,7 @@ public class PolicyComponentTransactionTest extends TestCase
|
||||
assertFalse("Behavior should not be executed for child type.", fileTypeBehavior.isExecuted());
|
||||
assertEquals(0, fileTypeBehavior.getExecutionCount());
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param className the class to check
|
||||
|
Reference in New Issue
Block a user