Merged DEV (5.1) to HEAD (5.1)

117318: ACE-4421: Minor tweak (JavaDoc comment + fix boolean),
   117293: ACE-4421: Custom behaviours cannot be disabled (using disableBehaviour(QName))
      - Changed the ClassBehaviourIndex#find as the main logic is handled by BehaviourFilterImpl#isEnabled
      - Updated the BehaviourFilter interface accordingly.,
   115822: ACE-4421: Custom behaviours cannot be disabled (using disableBehaviour(QName))
      - Reworked the solution to use only one new method: disable(QName className, boolean includeSubClasses)
      - Modified the isEnabled(QName className) to correspond with the new logic
      - Modified the JUnit tests.,
   115078: ACE-4421: Minor tweak (JavaDoc comment + fix boolean),
   115071: ACE-4421: Custom behaviours cannot be disabled (using disableBehaviour(QName))
      - Added new API for disabling behaviours.
      - Added JUnit tests.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@117981 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alex Mukha
2015-11-18 17:13:08 +00:00
parent e657c5b5fc
commit c0c2a9c1d1
6 changed files with 900 additions and 196 deletions

View File

@@ -161,19 +161,11 @@ import org.alfresco.util.LockHelper;
{
List<BehaviourDefinition> behaviours = new ArrayList<BehaviourDefinition>();
// Determine if behaviour has been disabled
boolean isEnabled = true;
if (filter != null)
// Find class behaviour by scanning up the class hierarchy
List<BehaviourDefinition<B>> behaviour = null;
if (isEnabled(binding))
{
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);
@@ -184,7 +176,6 @@ import org.alfresco.util.LockHelper;
binding = (B)binding.generaliseBinding();
}
}
// Append all service-level behaviours
behaviours.addAll(serviceMap.getAll());
@@ -196,7 +187,6 @@ import org.alfresco.util.LockHelper;
}
}
@Override
public void addChangeObserver(BehaviourChangeObserver<B> observer)
{
@@ -264,6 +254,18 @@ import org.alfresco.util.LockHelper;
{
lock.writeLock().unlock();
}
}
}
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;
}
}