mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Made the ThreadPoolExecutorFactory more configurable, but also with more sensible defaults.
- The queue for background jobs is unlimited - A smaller number of core threads is maintained - It is possible to set the threads' priority (default low) Added hasAspect() method to XPath functions. Various other cosmetic changes. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6146 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -559,4 +559,9 @@ public class DocumentNavigator extends DefaultNavigator implements NamedAccessNa
|
||||
QName nodeTypeQName = nodeService.getType(nodeRef);
|
||||
return dictionaryService.isSubClass(nodeTypeQName, typeQName);
|
||||
}
|
||||
|
||||
public Boolean hasAspect(NodeRef nodeRef, QName typeQName)
|
||||
{
|
||||
return nodeService.hasAspect(nodeRef, typeQName);
|
||||
}
|
||||
}
|
||||
|
@@ -225,8 +225,7 @@ public class NodeServiceXPath extends BaseXPath
|
||||
}
|
||||
|
||||
/**
|
||||
* A boolean function to determine if a node type is a subtype of another
|
||||
* type
|
||||
* A boolean function to determine if a node type is a subtype of another type
|
||||
*/
|
||||
static class SubTypeOf implements Function
|
||||
{
|
||||
@@ -278,6 +277,59 @@ public class NodeServiceXPath extends BaseXPath
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A boolean function to determine if a node has a given aspect
|
||||
*/
|
||||
static class HasAspect implements Function
|
||||
{
|
||||
public Object call(Context context, List args) throws FunctionCallException
|
||||
{
|
||||
if (args.size() != 1)
|
||||
{
|
||||
throw new FunctionCallException("hasAspect() requires one argument: hasAspect(QName typeQName)");
|
||||
}
|
||||
return evaluate(context.getNodeSet(), args.get(0), context.getNavigator());
|
||||
}
|
||||
|
||||
public Object evaluate(List nodes, Object qnameObj, Navigator nav)
|
||||
{
|
||||
if (nodes.size() != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// resolve the qname of the type we are checking for
|
||||
String qnameStr = StringFunction.evaluate(qnameObj, nav);
|
||||
if (qnameStr.equals("*"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
QName typeQName;
|
||||
|
||||
if (qnameStr.startsWith("{"))
|
||||
{
|
||||
typeQName = QName.createQName(qnameStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
typeQName = QName.createQName(qnameStr, ((DocumentNavigator) nav).getNamespacePrefixResolver());
|
||||
}
|
||||
// resolve the noderef
|
||||
NodeRef nodeRef = null;
|
||||
if (nav.isElement(nodes.get(0)))
|
||||
{
|
||||
nodeRef = ((ChildAssociationRef) nodes.get(0)).getChildRef();
|
||||
}
|
||||
else if (nav.isAttribute(nodes.get(0)))
|
||||
{
|
||||
nodeRef = ((DocumentNavigator.Property) nodes.get(0)).parent;
|
||||
}
|
||||
|
||||
DocumentNavigator dNav = (DocumentNavigator) nav;
|
||||
boolean result = dNav.hasAspect(nodeRef, typeQName);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
static class Deref implements Function
|
||||
{
|
||||
|
||||
@@ -643,6 +695,7 @@ public class NodeServiceXPath extends BaseXPath
|
||||
"ends-with", new EndsWithFunction());
|
||||
|
||||
registerFunction("", "subtypeOf", new SubTypeOf());
|
||||
registerFunction("", "hasAspect", new HasAspect());
|
||||
registerFunction("", "deref", new Deref());
|
||||
registerFunction("", "like", new Like());
|
||||
registerFunction("", "contains", new Contains());
|
||||
|
Reference in New Issue
Block a user