mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/PATCHES/5.1.1/root@125484 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
package org.alfresco.web.config;
|
|
|
|
import java.util.Set;
|
|
|
|
import org.springframework.extensions.config.evaluator.Evaluator;
|
|
import org.alfresco.service.namespace.QName;
|
|
import org.alfresco.web.bean.repository.Node;
|
|
import org.alfresco.web.bean.repository.Repository;
|
|
|
|
/**
|
|
* Evaluator that determines whether a given object has a particular aspect applied
|
|
*
|
|
* @author gavinc
|
|
*/
|
|
public final class AspectEvaluator implements Evaluator
|
|
{
|
|
/**
|
|
* Determines whether the given aspect is applied to the given object
|
|
*
|
|
* @see org.springframework.extensions.config.evaluator.Evaluator#applies(java.lang.Object, java.lang.String)
|
|
*/
|
|
public boolean applies(Object obj, String condition)
|
|
{
|
|
boolean result = false;
|
|
|
|
if (obj instanceof Node)
|
|
{
|
|
Set aspects = ((Node)obj).getAspects();
|
|
if (aspects != null)
|
|
{
|
|
QName spaceQName = Repository.resolveToQName(condition);
|
|
result = aspects.contains(spaceQName);
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|