Class NodeStateEx


  • public class NodeStateEx
    extends Object
    This Class provides some basic node operations directly on the node state.
    • Method Detail

      • getName

        public Name getName()
        returns the name of this node
        Returns:
        the name of this node
      • getNodeId

        public NodeId getNodeId()
        Returns the id of this node.
        Returns:
        the id of this node.
      • getParentId

        public NodeId getParentId()
        Returns the parent id of this node
        Returns:
        the parent id of this node
      • getState

        public NodeState getState()
        Returns the underlaying node state.
        Returns:
        the underlaying node state.
      • hasProperty

        public boolean hasProperty​(Name name)
        Checks if the given property exists
        Parameters:
        name - name of the property
        Returns:
        true if the given property exists.
      • getPropertyValues

        public InternalValue[] getPropertyValues​(Name name)
        Returns the values of the given property or null
        Parameters:
        name - name of the property
        Returns:
        the values of the given property.
      • getPropertyValue

        public InternalValue getPropertyValue​(Name name)
        Returns the value of the given property or null
        Parameters:
        name - name of the property
        Returns:
        the value of the given property.
      • setPropertyValues

        public void setPropertyValues​(Name name,
                                      int type,
                                      InternalValue[] values)
                               throws RepositoryException
        Sets the property values
        Parameters:
        name - name of the property
        type - property type
        values - values to set
        Throws:
        RepositoryException - if an error occurs
      • setPropertyValues

        public PropertyState setPropertyValues​(Name name,
                                               int type,
                                               InternalValue[] values,
                                               boolean multiple)
                                        throws RepositoryException
        Sets the property values
        Parameters:
        name - name of the property
        type - type of the values
        values - values to set
        multiple - truefor MV properties
        Returns:
        the modified property state
        Throws:
        RepositoryException - if an error occurs
      • getEffectiveNodeType

        public EffectiveNodeType getEffectiveNodeType()
                                               throws RepositoryException
        Returns the effective (i.e. merged and resolved) node type representation of this node's primary and mixin node types.
        Returns:
        the effective node type
        Throws:
        RepositoryException - if an error occurs
      • hasNode

        public boolean hasNode​(Name name)
        checks if the given child node exists.
        Parameters:
        name - name of the node
        Returns:
        true if the given child exists.
      • removeNode

        public boolean removeNode​(Name name)
                           throws RepositoryException
        removes the (first) child node with the given name.
        Parameters:
        name - name of the node
        Returns:
        true if the child was removed
        Throws:
        RepositoryException - if an error occurs
      • removeNode

        public boolean removeNode​(NodeStateEx node)
                           throws RepositoryException
        removes the given child node
        Parameters:
        node - child node to remove
        Returns:
        true if the child was removed
        Throws:
        RepositoryException - if an error occurs
      • removeNode

        public boolean removeNode​(Name name,
                                  int index)
                           throws RepositoryException
        removes the child node with the given name and 1-based index
        Parameters:
        name - name of the child node
        index - index of the child node
        Returns:
        true if the child was removed.
        Throws:
        RepositoryException - if an error occurs
      • removeNode

        public boolean removeNode​(ChildNodeEntry entry)
                           throws RepositoryException
        removes the child node with the given child node entry
        Parameters:
        entry - entry to remove
        Returns:
        true if the child was removed.
        Throws:
        RepositoryException - if an error occurs
      • removeProperty

        public boolean removeProperty​(Name name)
                               throws RepositoryException
        removes the property with the given name
        Parameters:
        name - name of the property
        Returns:
        true if the property was removed.
        Throws:
        RepositoryException - if an error occurs
      • getNode

        public NodeStateEx getNode​(Name name,
                                   int index)
                            throws RepositoryException
        retrieves the child node with the given name and 1-base index or null if the node does not exist.
        Parameters:
        name - name of the child node
        index - index of the child node
        Returns:
        the node state.
        Throws:
        RepositoryException - if an error occurs
      • hasNode

        public boolean hasNode​(NodeId id)
        Checks if the given node state exists
        Parameters:
        id - node id
        Returns:
        true if the node state exists
      • hasProperty

        public boolean hasProperty​(PropertyId id)
        Checks if the given property state exists
        Parameters:
        id - property id
        Returns:
        true if the property state exists
      • moveFrom

        public NodeStateEx moveFrom​(NodeStateEx src,
                                    Name name,
                                    boolean createShare)
                             throws RepositoryException
        Moves the source node to this node using the given name.
        Parameters:
        src - shareable source node
        name - name of new node
        createShare - if true a share is created instead.
        Returns:
        child node
        Throws:
        RepositoryException - if an error occurs
      • store

        public void store​(boolean recursively)
                   throws RepositoryException
        Stores the persistent state and depending on the recursively flag also stores the modified child nodes recursively.
        Parameters:
        recursively - whether to store the nodes recursively or just this single node.
        Throws:
        RepositoryException - if an error occurs
      • hasAncestor

        public boolean hasAncestor​(NodeId nodeId)
                            throws RepositoryException
        Checks if this state has the indicated ancestor
        Parameters:
        nodeId - the node id of the ancestor
        Returns:
        true if it has the indicated ancestor
        Throws:
        RepositoryException - if an error occurs