diff --git a/source/java/org/alfresco/repo/jscript/ScriptNode.java b/source/java/org/alfresco/repo/jscript/ScriptNode.java index 35e1bb50b5..883aee4bc5 100644 --- a/source/java/org/alfresco/repo/jscript/ScriptNode.java +++ b/source/java/org/alfresco/repo/jscript/ScriptNode.java @@ -809,6 +809,16 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol return this.properties; } + /** + * Return all the property names defined for this node's type as an array of short QNames. + * + * @return Array of property names for this node's type. + */ + public Scriptable getTypePropertyNames() + { + return getTypePropertyNames(true); + } + /** * Return all the property names defined for this node's type as an array. * @@ -827,6 +837,24 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol return Context.getCurrentContext().newArray(this.scope, result); } + /** + * Return all the property names defined for this node as an array. + * + * @param useShortQNames if true short-form qnames will be returned, else long-form. + * @return Array of property names for this node type and optionally parent properties. + */ + public Scriptable getPropertyNames(boolean useShortQNames) + { + Set props = this.nodeService.getProperties(this.nodeRef).keySet(); + Object[] result = new Object[props.size()]; + int count = 0; + for (QName qname : props) + { + result[count++] = useShortQNames ? getShortQName(qname).toString() : qname.toString(); + } + return Context.getCurrentContext().newArray(this.scope, result); + } + /** * @return true if this Node is a container (i.e. a folder) */