Class ScriptableNode

  • All Implemented Interfaces:
    java.io.Serializable, SlingWrapper, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Wrapper
    Direct Known Subclasses:
    ScriptableVersion, ScriptableVersionHistory

    public class ScriptableNode
    extends ScriptableBase
    implements SlingWrapper
    A wrapper for JCR nodes that exposes all properties and child nodes as properties of a Javascript object.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CLASSNAME  
      • Fields inherited from class org.mozilla.javascript.ScriptableObject

        CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
      • Fields inherited from interface org.mozilla.javascript.Scriptable

        NOT_FOUND
    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptableNode()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object get​(java.lang.String name, org.mozilla.javascript.Scriptable start)
      Gets the value of a (Javascript) property or child node.
      java.lang.String getClassName()
      The name of the JavaScript host object "class".
      java.lang.Object getDefaultValue​(java.lang.Class typeHint)  
      java.lang.Object[] getIds()  
      protected java.lang.Class<?> getStaticType()  
      java.lang.Class<?>[] getWrappedClasses()
      The list of Java classes wrapped by this wrapper.
      protected java.lang.Object getWrappedObject()  
      boolean has​(java.lang.String name, org.mozilla.javascript.Scriptable start)  
      void jsConstructor​(java.lang.Object res)  
      java.lang.Object jsFunction_addNode​(java.lang.String path, java.lang.String primaryType)  
      java.lang.Object jsFunction_getBaseVersion()  
      boolean jsFunction_getCheckedOut()  
      java.lang.Object jsFunction_getChildren()  
      java.lang.Object jsFunction_getDefinition()  
      int jsFunction_getDepth()  
      int jsFunction_getIndex()  
      java.lang.Object jsFunction_getLock()  
      boolean jsFunction_getLocked()  
      javax.jcr.nodetype.NodeType[] jsFunction_getMixinNodeTypes()  
      boolean jsFunction_getModified()  
      java.lang.String jsFunction_getName()  
      boolean jsFunction_getNew()  
      java.lang.Object jsFunction_getNode​(java.lang.String path)  
      java.lang.Object jsFunction_getNodes​(java.lang.String namePattern)  
      java.lang.Object jsFunction_getParent()  
      java.lang.String jsFunction_getPath()  
      java.lang.Object jsFunction_getPrimaryItem()  
      java.lang.Object jsFunction_getPrimaryNodeType()  
      java.lang.Object jsFunction_getProperties()  
      java.lang.Object jsFunction_getProperty​(java.lang.String name)  
      java.util.Iterator<?> jsFunction_getReferences()  
      java.lang.Object jsFunction_getSession()  
      java.lang.String jsFunction_getUUID()  
      java.lang.Object jsFunction_getVersionHistory()  
      boolean jsFunction_hasNode​(java.lang.String path)  
      void jsFunction_remove()  
      java.lang.String toString()  
      java.lang.Object unwrap()  
      • Methods inherited from class org.mozilla.javascript.ScriptableObject

        applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasInstance, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ScriptableNode

        public ScriptableNode()
    • Method Detail

      • jsConstructor

        public void jsConstructor​(java.lang.Object res)
      • getClassName

        public java.lang.String getClassName()
        Description copied from interface: SlingWrapper
        The name of the JavaScript host object "class".
        Specified by:
        getClassName in interface org.mozilla.javascript.Scriptable
        Specified by:
        getClassName in interface SlingWrapper
        Specified by:
        getClassName in class org.mozilla.javascript.ScriptableObject
        Returns:
        the class name
      • getWrappedClasses

        public java.lang.Class<?>[] getWrappedClasses()
        Description copied from interface: SlingWrapper
        The list of Java classes wrapped by this wrapper.
        Specified by:
        getWrappedClasses in interface SlingWrapper
        Returns:
        the wrapped classes
      • getStaticType

        protected java.lang.Class<?> getStaticType()
        Specified by:
        getStaticType in class ScriptableBase
        Returns:
        the static type to use for NativeJavaObject wrapping
      • getWrappedObject

        protected java.lang.Object getWrappedObject()
        Specified by:
        getWrappedObject in class ScriptableBase
        Returns:
        the Java object that we're wrapping, used to create a NativeJavaObject instance for default wrapping.
      • jsFunction_addNode

        public java.lang.Object jsFunction_addNode​(java.lang.String path,
                                                   java.lang.String primaryType)
                                            throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • jsFunction_getNode

        public java.lang.Object jsFunction_getNode​(java.lang.String path)
                                            throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • jsFunction_getChildren

        public java.lang.Object jsFunction_getChildren()
      • jsFunction_getNodes

        public java.lang.Object jsFunction_getNodes​(java.lang.String namePattern)
      • jsFunction_getProperties

        public java.lang.Object jsFunction_getProperties()
      • jsFunction_getPrimaryItem

        public java.lang.Object jsFunction_getPrimaryItem()
      • jsFunction_getProperty

        public java.lang.Object jsFunction_getProperty​(java.lang.String name)
                                                throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • jsFunction_getUUID

        public java.lang.String jsFunction_getUUID()
      • jsFunction_getIndex

        public int jsFunction_getIndex()
      • jsFunction_getReferences

        public java.util.Iterator<?> jsFunction_getReferences()
      • jsFunction_getPrimaryNodeType

        public java.lang.Object jsFunction_getPrimaryNodeType()
      • jsFunction_getMixinNodeTypes

        public javax.jcr.nodetype.NodeType[] jsFunction_getMixinNodeTypes()
      • jsFunction_getDefinition

        public java.lang.Object jsFunction_getDefinition()
      • jsFunction_getCheckedOut

        public boolean jsFunction_getCheckedOut()
      • jsFunction_getVersionHistory

        public java.lang.Object jsFunction_getVersionHistory()
      • jsFunction_getBaseVersion

        public java.lang.Object jsFunction_getBaseVersion()
      • jsFunction_getLock

        public java.lang.Object jsFunction_getLock()
      • jsFunction_getLocked

        public boolean jsFunction_getLocked()
      • jsFunction_getSession

        public java.lang.Object jsFunction_getSession()
      • jsFunction_getPath

        public java.lang.String jsFunction_getPath()
      • jsFunction_getName

        public java.lang.String jsFunction_getName()
      • jsFunction_getParent

        public java.lang.Object jsFunction_getParent()
      • jsFunction_getDepth

        public int jsFunction_getDepth()
      • jsFunction_getNew

        public boolean jsFunction_getNew()
      • jsFunction_getModified

        public boolean jsFunction_getModified()
      • jsFunction_remove

        public void jsFunction_remove()
                               throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • jsFunction_hasNode

        public boolean jsFunction_hasNode​(java.lang.String path)
                                   throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • get

        public java.lang.Object get​(java.lang.String name,
                                    org.mozilla.javascript.Scriptable start)
        Gets the value of a (Javascript) property or child node. If there is a single single-value JCR property of this node, return its string value. If there are multiple properties of the same name or child nodes of the same name, return an array.
        Specified by:
        get in interface org.mozilla.javascript.Scriptable
        Overrides:
        get in class org.mozilla.javascript.ScriptableObject
      • getIds

        public java.lang.Object[] getIds()
        Specified by:
        getIds in interface org.mozilla.javascript.Scriptable
        Overrides:
        getIds in class org.mozilla.javascript.ScriptableObject
      • getDefaultValue

        public java.lang.Object getDefaultValue​(java.lang.Class typeHint)
        Specified by:
        getDefaultValue in interface org.mozilla.javascript.Scriptable
        Overrides:
        getDefaultValue in class org.mozilla.javascript.ScriptableObject
      • has

        public boolean has​(java.lang.String name,
                           org.mozilla.javascript.Scriptable start)
        Specified by:
        has in interface org.mozilla.javascript.Scriptable
        Overrides:
        has in class org.mozilla.javascript.ScriptableObject
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • unwrap

        public java.lang.Object unwrap()
        Specified by:
        unwrap in interface org.mozilla.javascript.Wrapper