org.modeshape.jcr.cache.document

## Class SessionNode

- java.lang.Object
- - org.modeshape.jcr.cache.document.SessionNode

- All Implemented Interfaces:
    CachedNode, MutableCachedNode

      @ThreadSafe
      public class SessionNode
      extends Object
      implements MutableCachedNode

  A node used within a `session` when that node has (or may have) transient (unsaved) changes. This node is an extension of a `CachedNode`, and thus can be used as a regular cached node. All transient changes are captured as a delta on top of the underlying `workspace node`, and so any changes to the workspace node (made by other sessions' save operations) are immediately reflected.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `SessionNode.ChangedAdditionalParents`
    `protected static class` | `SessionNode.ChangedChildren` The representation of the changes made to the child references of this node.
    `protected class` | `SessionNode.DeepClone`
    `protected class` | `SessionNode.DeepCopy`
    `protected static class` | `SessionNode.FederatedSegmentChanges`
    `protected static class` | `SessionNode.InsertedChildReferences`
    `protected static class` | `SessionNode.Insertions`
    `static class` | `SessionNode.LockChange`
    `protected static class` | `SessionNode.MixinChanges`
    `protected static class` | `SessionNode.PermissionChanges`
    `protected static class` | `SessionNode.ReferrerChanges`

    - ### Nested classes/interfaces inherited from interface org.modeshape.jcr.cache.CachedNode

      `CachedNode.Properties, CachedNode.ReferenceType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SessionNode(NodeKey key, boolean isNew)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addFederatedSegment(String externalNodeKey, String segmentName)` Adds a new federated segment with the given name and key to this node.
    `protected SessionNode.ChangedAdditionalParents` | `additionalParents()`
    `void` | `addMixin(SessionCache cache, Name mixinName)` Add the supplied mixin type if not already an explicitly referenced.
    `protected void` | `addOrRemoveReferrers(SessionCache cache, SessionCache systemCache, Property property, Iterator<?> referenceValuesIterator, boolean add)`
    `void` | `addReferrer(SessionCache cache, Property property, NodeKey referrerKey, CachedNode.ReferenceType type)` Adds to this node a reference with the given type from the node with the supplied key to this node.
    `protected MutableChildReferences` | `appended(boolean createIfMissing)`
    `protected SessionNode.ChangedChildren` | `changedChildren()`
    `protected ConcurrentMap<Name,Property>` | `changedProperties()`
    `MutableCachedNode` | `createChild(SessionCache cache, NodeKey key, Name name, Iterable<Property> properties)` Create a new node as a child of this node with the supplied name and properties.
    `MutableCachedNode` | `createChild(SessionCache cache, NodeKey key, Name name, Property firstProperty, Property... additionalProperties)` Create a new node as a child of this node with the supplied name and properties.
    `void` | `deepClone(SessionCache cache, CachedNode sourceNode, SessionCache sourceCache, String systemWorkspaceKey, Connectors connectors)` Clones into this node all the properties and children (deep clone) from the given source node.
    `Map<NodeKey,NodeKey>` | `deepCopy(SessionCache cache, CachedNode sourceNode, SessionCache sourceCache, String systemWorkspaceKey, Connectors connectors)` Copies into this node all the properties and children (deep copy) from the given source node.
    `boolean` | `equals(Object obj)`
    `protected Map<String,String>` | `getAddedFederatedSegments()`
    `Set<Name>` | `getAddedMixins(SessionCache cache)` Get the set of mixin names that were added to this node but not yet saved.
    `Set<NodeKey>` | `getAdditionalParentKeys(NodeCache cache)` Get the keys for all of the nodes (other than the `primary parent`) under which this node appears.
    `Set<NodeKey>` | `getChangedReferrerNodes()` Returns a set with all the referencing nodes (nodes which are referring this node) which have changed.
    `ChildReferences` | `getChildReferences(NodeCache cache)` Get the set of child references for this node.
    `int` | `getDepth(NodeCache cache)` Get the depth of this node.
    `String` | `getEtag(SessionCache cache)` Compute an ETag value for this node.
    `NodeKey` | `getKey()` Get the key for the node.
    `SessionNode.LockChange` | `getLockChange()`
    `SessionNode.MixinChanges` | `getMixinChanges()`
    `Set<Name>` | `getMixinTypes(NodeCache cache)` Get the set of mixin types for this node.
    `Name` | `getName(NodeCache cache)` Get the name for this node, without any same-name-sibiling (SNS) index.
    `org.modeshape.jcr.cache.document.SessionNode.NodeChanges` | `getNodeChanges()` Returns an object encapsulating all the different changes that this session node contains.
    `NodeKey` | `getParentKey(NodeCache cache)` Get the node key for this node's primary parent within this workspace.
    `NodeKey` | `getParentKeyInAnyWorkspace(NodeCache cache)` Get the node key for this node's primary parent in any workspace.
    `Path` | `getPath(NodeCache cache)` Get the path to this node.
    `Path` | `getPath(PathCache pathCache)` Get the path to this node.
    `Map<String,Set<String>>` | `getPermissions(NodeCache cache)` Gets the map of privileges by principal name which are in effect for this node.
    `Name` | `getPrimaryType(NodeCache cache)` Get the primary type for this node.
    `Iterator<Property>` | `getProperties(Collection<?> namePatterns, NodeCache cache)` Get an iterator over all of the properties of this node that have names matching at least one of the supplied patterns.
    `Iterator<Property>` | `getProperties(NodeCache cache)` Get an iterator over all of the node's properties.
    `CachedNode.Properties` | `getPropertiesByName(NodeCache cache)` Get the properties collection.
    `Property` | `getProperty(Name name, NodeCache cache)` Get the property with the given name.
    `int` | `getPropertyCount(NodeCache cache)` Determine the number of properties that this node contains.
    `protected SessionNode.ReferrerChanges` | `getReferrerChanges()`
    `Set<NodeKey>` | `getReferrers(NodeCache cache, CachedNode.ReferenceType type)` Get the keys of the nodes that have JCR REFERENCE and/or WEAK_REFERENCE properties pointing to this node.
    `protected Set<String>` | `getRemovedFederatedSegments()`
    `Path.Segment` | `getSegment(NodeCache cache)` Get the path segment for this node.
    `protected Path.Segment` | `getSegment(NodeCache cache, CachedNode parent)` Get the segment for this node.
    `String` | `getString(NamespaceRegistry registry)`
    `boolean` | `hasACL(NodeCache cache)` Determine if there is an access control list for this node only, not taking into account any possible parents.
    `boolean` | `hasChangedPrimaryType()` Return whether the primary type for the node has changed.
    `boolean` | `hasChanges()` Return whether this node has changes, including property-related changes and other changes not related to properties.
    `int` | `hashCode()`
    `boolean` | `hasNonPropertyChanges()` Return whether this node has changes unrelated to properties.
    `boolean` | `hasOnlyChangesToAdditionalParents()` Return whether this node contains only changes to the additional parents.
    `boolean` | `hasProperties(NodeCache cache)` Determine if the node contains one or more properties.
    `boolean` | `hasProperty(Name name, NodeCache cache)` Determine if the node contains a property with the specified name.
    `boolean` | `hasPropertyChanges()` Return whether this node has changes in the properties.
    `boolean` | `isAtOrBelow(NodeCache cache, Path path)` Determine if this node is effectively at or below the supplied path.
    `boolean` | `isExternal(NodeCache cache)` Determine if this node belongs to an external source (via federation) or is local to the repository.
    `boolean` | `isNew()` Return whether this node was created since last saved.
    `boolean` | `isPropertyModified(SessionCache cache, Name propertyName)` Return whether the property with the supplied name was modified since the session was last saved.
    `boolean` | `isPropertyNew(SessionCache cache, Name propertyName)` Return whether the property with the supplied name was created since the session was last saved.
    `protected boolean` | `isPropertyRemoved(Name name)`
    `boolean` | `isQueryable(NodeCache cache)` Determine if this node should be indexed and therefore available for querying.
    `boolean` | `linkChild(SessionCache cache, NodeKey childKey, Name name)` Link the existing node with the supplied key to be appended as a child of this node.
    `void` | `lock(boolean sessionScoped)` Lock this node.
    `protected SessionNode.MixinChanges` | `mixinChanges(boolean createIfMissing)`
    `void` | `moveChild(SessionCache cache, NodeKey key, MutableCachedNode newParent, Name newName)` Remove the node from being a child of this node and append it as a child of the supplied node.
    `protected NodeKey` | `newParent()`
    `protected CachedNode` | `nodeInWorkspace(AbstractSessionCache session)` Get the CachedNode within the workspace cache.
    `protected CachedNode` | `parent(AbstractSessionCache session)`
    `protected SessionNode.PermissionChanges` | `permissionChanges()`
    `protected SessionNode.ReferrerChanges` | `referrerChanges(boolean createIfMissing)`
    `MutableCachedNode.PermissionChanges` | `removeACL(SessionCache cache)` Removes any potential existing ACL for this node.
    `void` | `removeAllProperties(SessionCache cache)` Remove all of the properties from this node.
    `protected void` | `removeAllReferences(SessionCache cache)`
    `void` | `removeChild(SessionCache cache, NodeKey key)` Remove the node from being a child of this node.
    `protected SessionNode` | `removeChildFromNode(AbstractSessionCache session, NodeKey childKey)` Remove the child from this parent node.
    `Set<NodeKey>` | `removedChildren()` Returns a set with the keys of the children which have been removed for this node.
    `protected Set<Name>` | `removedProperties()`
    `void` | `removeFederatedSegment(String externalNodeKey)` Removes the federated segment towards an external node.
    `void` | `removeMixin(SessionCache cache, Name mixinName)` Remove the supplied mixin type if already an explicitly referenced.
    `void` | `removeProperty(SessionCache cache, Name name)` Remove the property with the given name.
    `void` | `removeReferrer(SessionCache cache, Property property, NodeKey referrerKey, CachedNode.ReferenceType type)` Remove from this node a reference with the given type from the node with the supplied key to this node.
    `void` | `renameChild(SessionCache cache, NodeKey key, Name newName)` Renames the child node.
    `void` | `reorderChild(SessionCache cache, NodeKey key, NodeKey nextNode)` Remove the node from being a child of this node and append it as a child before the supplied node.
    `protected void` | `replaceParentWithAdditionalParent(NodeCache cache, NodeKey oldParent, NodeKey existingAdditionalParent)`
    `protected AbstractSessionCache` | `session(NodeCache cache)`
    `SessionNode.PermissionChanges` | `setPermissions(SessionCache cache, Map<String,Set<String>> privilegesByPrincipalName)` Sets permissions for this node, creating in effect an ACL.
    `void` | `setProperties(SessionCache cache, Iterable<Property> properties)` Set the properties on this node.
    `void` | `setProperties(SessionCache cache, Iterator<Property> properties)` Set the properties on this node.
    `void` | `setProperty(SessionCache cache, Property property)` Set the property with the given name.
    `void` | `setPropertyIfUnchanged(SessionCache cache, Property property)` Set the given property only if it has not been set previously and therefore appear as changed.
    `void` | `setQueryable(boolean queryable)` Sets a flag indicating if this node should be queryable or not.
    `void` | `setReference(SessionCache cache, Property property, SessionCache systemCache)` Sets a property of type reference in the case when there's an active system cache and the property is a reference towards a transient node from the system cache.
    `String` | `toString()`
    `void` | `unlock()` Unlock this node.
    `protected WorkspaceCache` | `workspace(NodeCache cache)`
    `protected WritableSessionCache` | `writableSession(NodeCache cache)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SessionNode

          public SessionNode(NodeKey key,
                     boolean isNew)

  - ### Method Detail

    - #### changedChildren

          protected final SessionNode.ChangedChildren changedChildren()

    - #### removedProperties

          protected final Set<Name> removedProperties()

    - #### changedProperties

          protected final ConcurrentMap<Name,Property> changedProperties()

    - #### newParent

          protected final NodeKey newParent()

    - #### isNew

          public final boolean isNew()

      Description copied from interface: `MutableCachedNode`
      Return whether this node was created since last saved.
      Specified by:
        `isNew` in interface `MutableCachedNode`
      Returns:
        true if this node was created since the session was last saved, or false otherwise

    - #### isPropertyNew

          public final boolean isPropertyNew(SessionCache cache,
                              Name propertyName)

      Description copied from interface: `MutableCachedNode`
      Return whether the property with the supplied name was created since the session was last saved. This method will always return `true` if `MutableCachedNode.isNew()` returns `true`.
      Specified by:
        `isPropertyNew` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `propertyName` - the name of the property; may not be null
      Returns:
        true if this node contains a property that was created since the session was last saved, or false otherwise
      See Also:
        `MutableCachedNode.isPropertyModified(org.modeshape.jcr.cache.SessionCache, org.modeshape.jcr.value.Name)`, `MutableCachedNode.isNew()`

    - #### isPropertyModified

          public final boolean isPropertyModified(SessionCache cache,
                                   Name propertyName)

      Description copied from interface: `MutableCachedNode`
      Return whether the property with the supplied name was modified since the session was last saved.
      Specified by:
        `isPropertyModified` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `propertyName` - the name of the property; may not be null
      Returns:
        true if this node contains a property that was created since the session was last saved, or false otherwise
      See Also:
        `MutableCachedNode.isPropertyNew(org.modeshape.jcr.cache.SessionCache, org.modeshape.jcr.value.Name)`

    - #### hasChanges

          public boolean hasChanges()

      Description copied from interface: `MutableCachedNode`
      Return whether this node has changes, including property-related changes and other changes not related to properties. This is equivalent to calling `hasNonPropertyChanges() || hasPropertyChanges()`.
      Specified by:
        `hasChanges` in interface `MutableCachedNode`
      Returns:
        true if this node has changes, or false otherwise
      See Also:
        `MutableCachedNode.hasNonPropertyChanges()`, `MutableCachedNode.hasPropertyChanges()`

    - #### hasNonPropertyChanges

          public boolean hasNonPropertyChanges()

      Description copied from interface: `MutableCachedNode`
      Return whether this node has changes unrelated to properties.
      Specified by:
        `hasNonPropertyChanges` in interface `MutableCachedNode`
      Returns:
        true if this node has changes unrelated to properties, or false otherwise
      See Also:
        `MutableCachedNode.hasChanges()`, `MutableCachedNode.hasPropertyChanges()`

    - #### hasPropertyChanges

          public boolean hasPropertyChanges()

      Description copied from interface: `MutableCachedNode`
      Return whether this node has changes in the properties.
      Specified by:
        `hasPropertyChanges` in interface `MutableCachedNode`
      Returns:
        true if this node has added, removed, or changed properties, or false otherwise
      See Also:
        `MutableCachedNode.hasChanges()`, `MutableCachedNode.hasNonPropertyChanges()`

    - #### lock

          public void lock(boolean sessionScoped)

      Description copied from interface: `MutableCachedNode`
      Lock this node.
      Specified by:
        `lock` in interface `MutableCachedNode`
      Parameters:
        `sessionScoped` - true if the lock should be limited in scope to the lifetime of the session, or false otherwise

    - #### unlock

          public void unlock()

      Description copied from interface: `MutableCachedNode`
      Unlock this node.
      Specified by:
        `unlock` in interface `MutableCachedNode`

    - #### getLockChange

          public SessionNode.LockChange getLockChange()

    - #### replaceParentWithAdditionalParent

          protected void replaceParentWithAdditionalParent(NodeCache cache,
                                               NodeKey oldParent,
                                               NodeKey existingAdditionalParent)

    - #### appended

          protected MutableChildReferences appended(boolean createIfMissing)

    - #### mixinChanges

          protected SessionNode.MixinChanges mixinChanges(boolean createIfMissing)

    - #### referrerChanges

          protected SessionNode.ReferrerChanges referrerChanges(boolean createIfMissing)

    - #### writableSession

          protected final WritableSessionCache writableSession(NodeCache cache)

    - #### session

          protected final AbstractSessionCache session(NodeCache cache)

    - #### workspace

          protected final WorkspaceCache workspace(NodeCache cache)

    - #### nodeInWorkspace

          protected CachedNode nodeInWorkspace(AbstractSessionCache session)

      Get the CachedNode within the workspace cache.
      Parameters:
        `session` - the session; may not be null
      Returns:
        the workspace cache's node, or null if this node is new

    - #### getParentKey

          public NodeKey getParentKey(NodeCache cache)

      Description copied from interface: `CachedNode`
      Get the node key for this node's primary parent within this workspace.
      Specified by:
        `getParentKey` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the parent's key; null if this is the root node or it has been removed from the document by someone else

    - #### getParentKeyInAnyWorkspace

          public NodeKey getParentKeyInAnyWorkspace(NodeCache cache)

      Description copied from interface: `CachedNode`
      Get the node key for this node's primary parent in any workspace.
      Specified by:
        `getParentKeyInAnyWorkspace` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the parent's key; null if this is the root node or it has been removed from the document by someone else

    - #### parent

          protected CachedNode parent(AbstractSessionCache session)

    - #### additionalParents

          protected SessionNode.ChangedAdditionalParents additionalParents()

    - #### getAdditionalParentKeys

          public Set<NodeKey> getAdditionalParentKeys(NodeCache cache)

      Description copied from interface: `CachedNode`
      Get the keys for all of the nodes (other than the `primary parent`) under which this node appears.
      Specified by:
        `getAdditionalParentKeys` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the immutable set of keys to the additional parents, excluding the primary parent

    - #### hasOnlyChangesToAdditionalParents

          public boolean hasOnlyChangesToAdditionalParents()

      Description copied from interface: `MutableCachedNode`
      Return whether this node contains only changes to the additional parents.
      Specified by:
        `hasOnlyChangesToAdditionalParents` in interface `MutableCachedNode`
      Returns:
        true if this node contains only added or removed additional parents.

    - #### isAtOrBelow

          public boolean isAtOrBelow(NodeCache cache,
                            Path path)

      Description copied from interface: `CachedNode`
      Determine if this node is effectively at or below the supplied path. Note that because of `additional parents`, a node has multiple effective paths.
      Specified by:
        `isAtOrBelow` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
        `path` - the path to be used for comparison; may not be null
      Returns:
        true if this node can be considered at or below the supplied path; or false otherwise

    - #### getKey

          public NodeKey getKey()

      Description copied from interface: `CachedNode`
      Get the key for the node.
      Specified by:
        `getKey` in interface `CachedNode`
      Returns:
        the node's key; never null

    - #### getName

          public Name getName(NodeCache cache)

      Description copied from interface: `CachedNode`
      Get the name for this node, without any same-name-sibiling (SNS) index.
      Specified by:
        `getName` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the name; never null, but the root node will have a zero-length name
      See Also:
        `CachedNode.getSegment(NodeCache)`, `CachedNode.getPath(NodeCache)`

    - #### getSegment

          public Path.Segment getSegment(NodeCache cache)

      Description copied from interface: `CachedNode`
      Get the path segment for this node. The segment consists of a name and a same-name-sibling (SNS) index.
      Specified by:
        `getSegment` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the segment; never null, but the root node will have a zero-length name
      See Also:
        `CachedNode.getName(NodeCache)`, `CachedNode.getPath(NodeCache)`

    - #### getSegment

          protected final Path.Segment getSegment(NodeCache cache,
                                CachedNode parent)

      Get the segment for this node.
      Parameters:
        `cache` - the cache
        `parent` - the parent node
      Returns:
        the segment
      Throws:
        `NodeNotFoundInParentException` - if the node doesn't exist in the referenced parent

    - #### getDepth

          public int getDepth(NodeCache cache)
                       throws NodeNotFoundException

      Description copied from interface: `CachedNode`
      Get the depth of this node. The depth is equivalent to the number of segments in the node's path (0 for the root node, 1 for "`/foo`", 2 for "`/foo/bar`", etc.), although this method will likely compute the depth more efficiently that finding the path and asking for the number of segments.

      The depth is calculated based upon the primary parent (and `primary path`). This is, although shared nodes are accessible at multiple paths, only the primary path is used to determine the depth of the node.

      Specified by:
        `getDepth` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the depth of this node; 0 for the root, or a positive number for all other nodes
      Throws:
        `NodeNotFoundException` - if this node no longer exists

    - #### getPath

          public Path getPath(NodeCache cache)

      Description copied from interface: `CachedNode`
      Get the path to this node.
      Specified by:
        `getPath` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the node's path; never null with at least one segment for all nodes except the root node
      See Also:
        `CachedNode.getName(NodeCache)`, `CachedNode.getSegment(NodeCache)`

    - #### getPath

          public Path getPath(PathCache pathCache)
                       throws NodeNotFoundException

      Description copied from interface: `CachedNode`
      Get the path to this node.
      Specified by:
        `getPath` in interface `CachedNode`
      Parameters:
        `pathCache` - the cache of paths that can be used to compute the path for any node; may not be null
      Returns:
        the node's path; never null with at least one segment for all nodes except the root node
      Throws:
        `NodeNotFoundInParentException` - if this node no longer exists inside the parent node (and perhaps in no other parent)
        `NodeNotFoundException` - if this node no longer exists
      See Also:
        `CachedNode.getName(NodeCache)`, `CachedNode.getSegment(NodeCache)`

    - #### getPrimaryType

          public Name getPrimaryType(NodeCache cache)

      Description copied from interface: `CachedNode`
      Get the primary type for this node.
      Specified by:
        `getPrimaryType` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the primary type name; never null

    - #### hasChangedPrimaryType

          public boolean hasChangedPrimaryType()

      Description copied from interface: `MutableCachedNode`
      Return whether the primary type for the node has changed.
      Specified by:
        `hasChangedPrimaryType` in interface `MutableCachedNode`
      Returns:
        true if the primary type for the node has changed, or false otherwise

    - #### getMixinTypes

          public Set<Name> getMixinTypes(NodeCache cache)

      Description copied from interface: `CachedNode`
      Get the set of mixin types for this node.
      Specified by:
        `getMixinTypes` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the immutable list of mixin type names; never null but possibly empty

    - #### addMixin

          public void addMixin(SessionCache cache,
                      Name mixinName)

      Description copied from interface: `MutableCachedNode`
      Add the supplied mixin type if not already an explicitly referenced.
      Specified by:
        `addMixin` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `mixinName` - the name of the mixin to be removed; may not be null

    - #### removeMixin

          public void removeMixin(SessionCache cache,
                         Name mixinName)

      Description copied from interface: `MutableCachedNode`
      Remove the supplied mixin type if already an explicitly referenced.
      Specified by:
        `removeMixin` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `mixinName` - the name of the mixin to be removed; may not be null

    - #### getMixinChanges

          public SessionNode.MixinChanges getMixinChanges()

    - #### getAddedMixins

          public Set<Name> getAddedMixins(SessionCache cache)

      Description copied from interface: `MutableCachedNode`
      Get the set of mixin names that were added to this node but not yet saved.
      Specified by:
        `getAddedMixins` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
      Returns:
        the newly-added mixin type names; never null but possibly empty

    - #### getReferrers

          public Set<NodeKey> getReferrers(NodeCache cache,
                                  CachedNode.ReferenceType type)

      Description copied from interface: `CachedNode`
      Get the keys of the nodes that have JCR REFERENCE and/or WEAK_REFERENCE properties pointing to this node.
      Specified by:
        `getReferrers` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
        `type` - the flag specifying whether nodes with REFERENCE properties and/or WEAK reference properties should be included in the result; may not be null
      Returns:
        the set of keys to the nodes that have a reference to this node; never null but possibly empty

    - #### getReferrerChanges

          protected SessionNode.ReferrerChanges getReferrerChanges()

    - #### addReferrer

          public void addReferrer(SessionCache cache,
                         Property property,
                         NodeKey referrerKey,
                         CachedNode.ReferenceType type)

      Description copied from interface: `MutableCachedNode`
      Adds to this node a reference with the given type from the node with the supplied key to this node.
      Specified by:
        `addReferrer` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `property` - the `Property` of the referrer node; may not be null
        `referrerKey` - the key for the node that has a new reference to this node; may not be null
        `type` - the reference type; may not be null

    - #### removeReferrer

          public void removeReferrer(SessionCache cache,
                            Property property,
                            NodeKey referrerKey,
                            CachedNode.ReferenceType type)

      Description copied from interface: `MutableCachedNode`
      Remove from this node a reference with the given type from the node with the supplied key to this node.
      Specified by:
        `removeReferrer` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `property` - the `Property` of the referrer node; may not be null
        `referrerKey` - the key for the node that no longer has a reference to this node; may not be null
        `type` - the reference type; may not be null

    - #### getPropertyCount

          public int getPropertyCount(NodeCache cache)

      Description copied from interface: `CachedNode`
      Determine the number of properties that this node contains.
      Specified by:
        `getPropertyCount` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the number of properties; never negative

    - #### hasProperties

          public boolean hasProperties(NodeCache cache)

      Description copied from interface: `CachedNode`
      Determine if the node contains one or more properties.
      Specified by:
        `hasProperties` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        true if the node has at least one property, or false otherwise

    - #### hasProperty

          public boolean hasProperty(Name name,
                            NodeCache cache)

      Description copied from interface: `CachedNode`
      Determine if the node contains a property with the specified name.
      Specified by:
        `hasProperty` in interface `CachedNode`
      Parameters:
        `name` - the name of the property
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        true if the node has the named property, or false otherwise

    - #### getProperty

          public Property getProperty(Name name,
                             NodeCache cache)

      Description copied from interface: `CachedNode`
      Get the property with the given name.
      Specified by:
        `getProperty` in interface `CachedNode`
      Parameters:
        `name` - the name of the property
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the property, or null if the property does not exist on this node

    - #### isPropertyRemoved

          protected final boolean isPropertyRemoved(Name name)

    - #### getPropertiesByName

          public CachedNode.Properties getPropertiesByName(NodeCache cache)

      Description copied from interface: `CachedNode`
      Get the properties collection.
      Specified by:
        `getPropertiesByName` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the properties; never null but possibly empty

    - #### getProperties

          public Iterator<Property> getProperties(NodeCache cache)

      Description copied from interface: `CachedNode`
      Get an iterator over all of the node's properties.
      Specified by:
        `getProperties` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the property iterator; never null but possibly empty

    - #### getProperties

          public Iterator<Property> getProperties(Collection<?> namePatterns,
                                         NodeCache cache)

      Description copied from interface: `CachedNode`
      Get an iterator over all of the properties of this node that have names matching at least one of the supplied patterns.
      Specified by:
        `getProperties` in interface `CachedNode`
      Parameters:
        `namePatterns` - the regex patterns or string literals describing the names
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the property iterator; never null but possibly empty

    - #### setProperty

          public void setProperty(SessionCache cache,
                         Property property)

      Description copied from interface: `MutableCachedNode`
      Set the property with the given name.
      Specified by:
        `setProperty` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `property` - the property; may not be null

    - #### setReference

          public void setReference(SessionCache cache,
                          Property property,
                          SessionCache systemCache)

      Description copied from interface: `MutableCachedNode`
      Sets a property of type reference in the case when there's an active system cache and the property is a reference towards a transient node from the system cache.
      Specified by:
        `setReference` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `property` - the property; may not be null
        `systemCache` - an existing system cache which contains transient nodes towards which the property points.

    - #### removeAllReferences

          protected void removeAllReferences(SessionCache cache)

    - #### addOrRemoveReferrers

          protected void addOrRemoveReferrers(SessionCache cache,
                                  SessionCache systemCache,
                                  Property property,
                                  Iterator<?> referenceValuesIterator,
                                  boolean add)

    - #### setPropertyIfUnchanged

          public void setPropertyIfUnchanged(SessionCache cache,
                                    Property property)

      Description copied from interface: `MutableCachedNode`
      Set the given property only if it has not been set previously and therefore appear as changed.
      Specified by:
        `setPropertyIfUnchanged` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `property` - the property; may not be null

    - #### setProperties

          public void setProperties(SessionCache cache,
                           Iterable<Property> properties)

      Description copied from interface: `MutableCachedNode`
      Set the properties on this node.
      Specified by:
        `setProperties` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `properties` - the properties to be set; may not be null

    - #### setProperties

          public void setProperties(SessionCache cache,
                           Iterator<Property> properties)

      Description copied from interface: `MutableCachedNode`
      Set the properties on this node.
      Specified by:
        `setProperties` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `properties` - the iterator over the properties to be set; may not be null

    - #### removeProperty

          public void removeProperty(SessionCache cache,
                            Name name)

      Description copied from interface: `MutableCachedNode`
      Remove the property with the given name.
      Specified by:
        `removeProperty` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `name` - the name of the property to be removed; may not be null

    - #### removeAllProperties

          public void removeAllProperties(SessionCache cache)

      Description copied from interface: `MutableCachedNode`
      Remove all of the properties from this node.
      Specified by:
        `removeAllProperties` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null

    - #### getChildReferences

          public ChildReferences getChildReferences(NodeCache cache)

      Description copied from interface: `CachedNode`
      Get the set of child references for this node. Note that each child reference will need to be resolved by the caller.
      Specified by:
        `getChildReferences` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the representation of the children of this node; never null but possibly empty

    - #### createChild

          public MutableCachedNode createChild(SessionCache cache,
                                      NodeKey key,
                                      Name name,
                                      Property firstProperty,
                                      Property... additionalProperties)

      Description copied from interface: `MutableCachedNode`
      Create a new node as a child of this node with the supplied name and properties.
      Specified by:
        `createChild` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `key` - the key for the new node; may be null
        `name` - the name for the new node; may not be null
        `firstProperty` - the first property; may not be null
        `additionalProperties` - the properties that should be set on the node; may be null or empty, and any null property references will be ignored
      Returns:
        the new child node

    - #### createChild

          public MutableCachedNode createChild(SessionCache cache,
                                      NodeKey key,
                                      Name name,
                                      Iterable<Property> properties)

      Description copied from interface: `MutableCachedNode`
      Create a new node as a child of this node with the supplied name and properties.
      Specified by:
        `createChild` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `key` - the key for the new node; may be null
        `name` - the name for the new node; may not be null
        `properties` - the properties that should be set on the node; may be null or empty, and any null property references will be ignored
      Returns:
        the new child node

    - #### removeChild

          public void removeChild(SessionCache cache,
                         NodeKey key)

      Description copied from interface: `MutableCachedNode`
      Remove the node from being a child of this node. NOTE: THIS METHOD DOES NOT DELETE THE NODE
      Specified by:
        `removeChild` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `key` - the key for the child that is to be removed; may not be null

    - #### moveChild

          public void moveChild(SessionCache cache,
                       NodeKey key,
                       MutableCachedNode newParent,
                       Name newName)

      Description copied from interface: `MutableCachedNode`
      Remove the node from being a child of this node and append it as a child of the supplied node.
      Specified by:
        `moveChild` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `key` - the key for the child that is to be removed; may not be null
        `newParent` - the new parent for the node; may not be null and may not be this node
        `newName` - the new name for the node, or null if the existing name is to be used

    - #### removeChildFromNode

          protected SessionNode removeChildFromNode(AbstractSessionCache session,
                                        NodeKey childKey)

      Remove the child from this parent node. This method works whether or not the child is a shared node (e.g., a shareable node that has 2+ nodes in the shared set).
      Parameters:
        `session` - the session
        `childKey` - the child key; may not be null
      Returns:
        the child node; never null

    - #### reorderChild

          public void reorderChild(SessionCache cache,
                          NodeKey key,
                          NodeKey nextNode)

      Description copied from interface: `MutableCachedNode`
      Remove the node from being a child of this node and append it as a child before the supplied node.
      Specified by:
        `reorderChild` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `key` - the key for the child that is to be removed; may not be null
        `nextNode` - the key for the node before which the node should be moved; may be null if the node should be moved to the end of the parents

    - #### renameChild

          public void renameChild(SessionCache cache,
                         NodeKey key,
                         Name newName)

      Description copied from interface: `MutableCachedNode`
      Renames the child node.
      Specified by:
        `renameChild` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `key` - the key for the child that is to be removed; may not be null
        `newName` - the new name for the node; may not be null

    - #### linkChild

          public boolean linkChild(SessionCache cache,
                          NodeKey childKey,
                          Name name)

      Description copied from interface: `MutableCachedNode`
      Link the existing node with the supplied key to be appended as a child of this node. After this method, the referenced node is considered a child of this node as well as a child of its original parent(s).

      The link can be removed by simply `removing` the linked child from the parent, and this works whether or not the parent is the original parent or an additional parent.

      Specified by:
        `linkChild` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `childKey` - the key for the child that is to be removed; may not be null
        `name` - the name for the (linked) node, or null if the existing name is to be used
      Returns:
        true if the link was created, or false if the link already existed as a child of this node

    - #### getEtag

          public String getEtag(SessionCache cache)

      Description copied from interface: `MutableCachedNode`
      Compute an ETag value for this node.
      Specified by:
        `getEtag` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
      Returns:
        an ETag value; never null but possibly empty

    - #### deepCopy

          public Map<NodeKey,NodeKey> deepCopy(SessionCache cache,
                                      CachedNode sourceNode,
                                      SessionCache sourceCache,
                                      String systemWorkspaceKey,
                                      Connectors connectors)

      Description copied from interface: `MutableCachedNode`
      Copies into this node all the properties and children (deep copy) from the given source node.
      Specified by:
        `deepCopy` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `sourceNode` - the node from which to copy the properties and children; may not be null
        `sourceCache` - the cache in which the source node belongs; may not be null
        `systemWorkspaceKey` - the key of the system workspace; may not be null
        `connectors` - a `Connectors` instance which used for processing external nodes.
      Returns:
        a [source key -> target key] which represents the node correspondence after the copy operation.

    - #### deepClone

          public void deepClone(SessionCache cache,
                       CachedNode sourceNode,
                       SessionCache sourceCache,
                       String systemWorkspaceKey,
                       Connectors connectors)

      Description copied from interface: `MutableCachedNode`
      Clones into this node all the properties and children (deep clone) from the given source node. Each cloned node will have the same identifier as the source node.
      Specified by:
        `deepClone` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `sourceNode` - the node from which to copy the properties and children; may not be null
        `sourceCache` - the cache in which the source node belongs; may not be null
        `systemWorkspaceKey` - the key of the system workspace; may not be null
        `connectors` - a `Connectors` instance which used for processing external nodes.

    - #### removedChildren

          public Set<NodeKey> removedChildren()

      Description copied from interface: `MutableCachedNode`
      Returns a set with the keys of the children which have been removed for this node.
      Specified by:
        `removedChildren` in interface `MutableCachedNode`
      Returns:
        a `Set<`NodeKey`>`, never null

    - #### getChangedReferrerNodes

          public Set<NodeKey> getChangedReferrerNodes()

      Description copied from interface: `MutableCachedNode`
      Returns a set with all the referencing nodes (nodes which are referring this node) which have changed.
      Specified by:
        `getChangedReferrerNodes` in interface `MutableCachedNode`
      Returns:
        the set of `NodeKey` instances, never null.

    - #### addFederatedSegment

          public void addFederatedSegment(String externalNodeKey,
                                 String segmentName)

      Description copied from interface: `MutableCachedNode`
      Adds a new federated segment with the given name and key to this node.
      Specified by:
        `addFederatedSegment` in interface `MutableCachedNode`
      Parameters:
        `externalNodeKey` - the key of the external node which should be linked under this name; may not be null
        `segmentName` - the name of the segment (i.e. the name of the alias under which an external child is linked); may not be null

    - #### getAddedFederatedSegments

          protected Map<String,String> getAddedFederatedSegments()

    - #### removeFederatedSegment

          public void removeFederatedSegment(String externalNodeKey)

      Description copied from interface: `MutableCachedNode`
      Removes the federated segment towards an external node.
      Specified by:
        `removeFederatedSegment` in interface `MutableCachedNode`
      Parameters:
        `externalNodeKey` - the key of the external node which should be linked under this name; may not be null

    - #### getRemovedFederatedSegments

          protected Set<String> getRemovedFederatedSegments()

    - #### getNodeChanges

          public org.modeshape.jcr.cache.document.SessionNode.NodeChanges getNodeChanges()

      Description copied from interface: `MutableCachedNode`
      Returns an object encapsulating all the different changes that this session node contains.
      Specified by:
        `getNodeChanges` in interface `MutableCachedNode`
      Returns:
        a `non-null` `MutableCachedNode.NodeChanges` object.

    - #### isQueryable

          public boolean isQueryable(NodeCache cache)

      Description copied from interface: `CachedNode`
      Determine if this node should be indexed and therefore available for querying. By default, every node is queryable, so only in certain cases can a node be made non-queryable.
      Specified by:
        `isQueryable` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        `true` if the node should be indexed, `false` otherwise

    - #### setQueryable

          public void setQueryable(boolean queryable)

      Description copied from interface: `MutableCachedNode`
      Sets a flag indicating if this node should be queryable or not.
      Specified by:
        `setQueryable` in interface `MutableCachedNode`
      Parameters:
        `queryable` - a `boolean`.

    - #### hasACL

          public boolean hasACL(NodeCache cache)

      Description copied from interface: `CachedNode`
      Determine if there is an access control list for this node only, not taking into account any possible parents.
      Specified by:
        `hasACL` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        `true` if this node has an ACL, `false` otherwise

    - #### getPermissions

          public Map<String,Set<String>> getPermissions(NodeCache cache)

      Description copied from interface: `CachedNode`
      Gets the map of privileges by principal name which are in effect for this node. This will not look at any of the parent nodes.
      Specified by:
        `getPermissions` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        a `Map` which contains a set of permission names keyed by principal name or `null` if no privileges are in effect for this node(i.e. this node does not have an ACL). An empty `Map` means a node which has an ACL, but does not have any permissions.

    - #### setPermissions

          public SessionNode.PermissionChanges setPermissions(SessionCache cache,
                                                     Map<String,Set<String>> privilegesByPrincipalName)

      Description copied from interface: `MutableCachedNode`
      Sets permissions for this node, creating in effect an ACL.
      Specified by:
        `setPermissions` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
        `privilegesByPrincipalName` - a set of privileges enqueued by principal name; may not be null
      Returns:
        a `MutableCachedNode.PermissionChanges` instance which reflects how the persistent state has been affected by the change; never null

    - #### permissionChanges

          protected SessionNode.PermissionChanges permissionChanges()

    - #### removeACL

          public MutableCachedNode.PermissionChanges removeACL(SessionCache cache)

      Description copied from interface: `MutableCachedNode`
      Removes any potential existing ACL for this node.
      Specified by:
        `removeACL` in interface `MutableCachedNode`
      Parameters:
        `cache` - the cache to which this node belongs; may not be null
      Returns:
        a `MutableCachedNode.PermissionChanges` instance which reflects which principal have been removed; never null

    - #### isExternal

          public boolean isExternal(NodeCache cache)

      Description copied from interface: `CachedNode`
      Determine if this node belongs to an external source (via federation) or is local to the repository.
      Specified by:
        `isExternal` in interface `CachedNode`
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        `true` if the node is local, `false` otherwise.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getString

          public String getString(NamespaceRegistry registry)

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.