Merged HEAD (5.1) to 5.1.N (5.1.1)

117981 amukha: 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/BRANCHES/DEV/5.1.N/root@118033 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Natalia Smintanca
2015-11-19 09:48:28 +00:00
parent 4e4cf4c4e7
commit 76b0d1dffb
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;
}
}