From f122157dce26497cd54edd3769fb997154f8bcba Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Thu, 7 May 2009 07:47:26 +0000 Subject: [PATCH] Added isSubType(qname) to ScriptNode API. - Example: var isType = node.isSubType("abc:someqname"); git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14225 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/repo/jscript/ScriptNode.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/source/java/org/alfresco/repo/jscript/ScriptNode.java b/source/java/org/alfresco/repo/jscript/ScriptNode.java index d82a426472..96cf4a64d3 100644 --- a/source/java/org/alfresco/repo/jscript/ScriptNode.java +++ b/source/java/org/alfresco/repo/jscript/ScriptNode.java @@ -667,7 +667,7 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol return isLinkToDocument.booleanValue(); } - + /** * @return true if the Node is a Category */ @@ -706,7 +706,7 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol } /** - * @param aspect The aspect name to test for (full qualified or short-name form) + * @param aspect The aspect name to test for (fully qualified or short-name form) * @return true if the node has the aspect false otherwise */ public boolean hasAspect(String aspect) @@ -714,6 +714,19 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol return getAspectsSet().contains(createQName(aspect)); } + /** + * @param type The qname type to test this object against (fully qualified or short-name form) + * @return true if this Node is a sub-type of the specified class (or itself of that class) + */ + public boolean isSubType(String type) + { + ParameterCheck.mandatoryString("Type", type); + + QName qnameType = createQName(type); + + return this.services.getDictionaryService().isSubClass(getQNameType(), qnameType); + } + /** * @return QName path to this node. This can be used for Lucene PATH: style queries */