ALF-3885: find multiple class behaviours through (super-)class hierarchy (not just first) - warning: pls review/test your registered (super-)class behaviours

Merged BRANCHES/DEV/WORKP1 to HEAD
        21224: ALF-3885: find multiple class behaviours through type hierarchy (not just first)
        21249: ALF-3885: follow-on to r21224 (to fix PersonServiceTest.testSplitDuplicates)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21253 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2010-07-19 08:34:35 +00:00
parent 5d2a5e23cf
commit 5db5f0a1a6
4 changed files with 34 additions and 29 deletions

View File

@@ -91,6 +91,7 @@ import org.alfresco.service.namespace.QName;
/* (non-Javadoc)
* @see org.alfresco.repo.policy.BehaviourIndex#getAll()
*/
@SuppressWarnings("unchecked")
public Collection<BehaviourDefinition> getAll()
{
lock.readLock().lock();
@@ -129,28 +130,25 @@ import org.alfresco.service.namespace.QName;
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(behaviour == null && binding != null)
while (binding != null)
{
behaviour = classMap.get(binding);
if (behaviour == null)
if (behaviour != null)
{
binding = (B)binding.generaliseBinding();
behaviours.addAll(0, behaviour); // note: list base/generalised before extended/specific
}
}
if (behaviour != null)
{
behaviours.addAll(behaviour);
binding = (B)binding.generaliseBinding();
}
}
// Append all service-level behaviours
behaviours.addAll(serviceMap.getAll());
return behaviours;
}
finally