Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.cache
Interface MutableCachedNode

All Superinterfaces:
  CachedNode

All Known Implementing Classes:
  SessionNode

    public interface MutableCachedNode

extends CachedNode

Nested Class Summary

Nested classes/interfaces inherited from interface org.modeshape.jcr.cache.CachedNode
`CachedNode.ReferenceType`

Method Summary
`void` | `addMixin(SessionCache cache, Name mixinName)` Add the supplied mixin type if not already an explicitly referenced.
`void` | `addReferrer(SessionCache cache, 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.
`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)` 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)` Copies into this node all the properties and children (deep copy) from the given source node.
`Set<Name>` | `getAddedMixins(SessionCache cache)` Get the set of mixin names that were added to this node but not yet saved.
`Set<NodeKey>` | `getChangedReferrerNodes()` Returns a set with all the referencing nodes (nodes which are referring this node) which have changed.
`String` | `getEtag(SessionCache cache)` Compute an ETag value for this node.
`boolean` | `hasChangedPrimaryType()` Return whether the primary type for the node has changed.
`boolean` | `hasChanges()` Return whether this node has changes.
`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.
`void` | `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.
`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.
`void` | `removeChild(SessionCache cache, NodeKey key)` Remove the node from being a child of this node.
`Set<NodeKey>` | `removedChildren()` Returns a set with the keys of the children which have been removed for this 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, 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.
`void` | `setProperties(SessionCache cache, Iterable<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` | `unlock()` Unlock this node.

Methods inherited from interface org.modeshape.jcr.cache.CachedNode
`getAdditionalParentKeys, getChildReferences, getKey, getMixinTypes, getName, getParentKey, getPath, getPrimaryType, getProperties, getProperties, getProperty, getPropertyCount, getReferrers, getSegment, hasProperties, hasProperty`

Method Detail

### isNew

    boolean isNew()

  Return whether this node was created since last saved.

  Returns:
    true if this node was created since the session was last saved, or false otherwise

### isPropertyNew

    boolean isPropertyNew(SessionCache cache,
                          Name propertyName)

  Return whether the property with the supplied name was created since the session was last saved. This method will always return `true` if `isNew()` returns `true`.

  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:
    `isPropertyModified(org.modeshape.jcr.cache.SessionCache, org.modeshape.jcr.value.Name)`, `isNew()`

### isPropertyModified

    boolean isPropertyModified(SessionCache cache,
                               Name propertyName)

  Return whether the property with the supplied name was modified since the session was last saved.

  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:
    `isPropertyNew(org.modeshape.jcr.cache.SessionCache, org.modeshape.jcr.value.Name)`

### hasChanges

    boolean hasChanges()

  Return whether this node has changes.

  Returns:
    true if this node has changes, or false otherwise

### lock

    void lock(boolean sessionScoped)

  Lock this node.

  Parameters:
    `sessionScoped` - true if the lock should be limited in scope to the lifetime of the session, or false otherwise

### unlock

    void unlock()

  Unlock this node.

### setProperty

    void setProperty(SessionCache cache,
                     Property property)

  Set the property with the given name.

  Parameters:
    `cache` - the cache to which this node belongs; may not be null
    `property` - the property; may not be null
  Throws:
    `NodeNotFoundException` - if this node no longer exists

### setPropertyIfUnchanged

    void setPropertyIfUnchanged(SessionCache cache,
                                Property property)

  Set the given property only if it has not been set previously and therefore appear as changed.

  Parameters:
    `cache` - the cache to which this node belongs; may not be null
    `property` - the property; may not be null
  Throws:
    `NodeNotFoundException` - if this node no longer exists

### setProperties

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

  Set the properties on this node.

  Parameters:
    `cache` - the cache to which this node belongs; may not be null
    `properties` - the properties to be set; may not be null
  Throws:
    `NodeNotFoundException` - if this node no longer exists

### removeProperty

    void removeProperty(SessionCache cache,
                        Name name)

  Remove the property with the given name.

  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
  Throws:
    `NodeNotFoundException` - if this node no longer exists

### addMixin

    void addMixin(SessionCache cache,
                  Name mixinName)

  Add the supplied mixin type if not already an explicitly referenced.

  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

    void removeMixin(SessionCache cache,
                     Name mixinName)

  Remove the supplied mixin type if already an explicitly referenced.

  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

### getAddedMixins

    Set<Name> getAddedMixins(SessionCache cache)

  Get the set of mixin names that were added to this node but not yet saved.

  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

### hasChangedPrimaryType

    boolean hasChangedPrimaryType()

  Return whether the primary type for the node has changed.

  Returns:
    true if the primary type for the node has changed, or false otherwise

### createChild

    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.

  Parameters:
    `cache` - the cache to which this node belongs; may not be null
    `key` - the key for the new node; may not 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

    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.

  Parameters:
    `cache` - the cache to which this node belongs; may not be null
    `key` - the key for the new node; may not 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

    void removeChild(SessionCache cache,
                     NodeKey key)

  Remove the node from being a child of this node. NOTE: THIS METHOD DOES NOT DELETE THE NODE

  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
  Throws:
    `NodeNotFoundException` - if the node does not exist as a child of this node

### moveChild

    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.

  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
  Throws:
    `NodeNotFoundException` - if the node does not exist as a child of this node

### linkChild

    void linkChild(SessionCache cache,
                   NodeKey childKey,
                   Name name)

  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).

  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
  Throws:
    `NodeNotFoundException` - if the node does not exist

### reorderChild

    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.

  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
  Throws:
    `NodeNotFoundException` - if the node does not exist as a child of this node

### renameChild

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

  Renames the child node.

  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
  Throws:
    `NodeNotFoundException` - if the node does not exist as a child of this node

### addReferrer

    void addReferrer(SessionCache cache,
                     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.

  Parameters:
    `cache` - the cache to which this node belongs; 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

    void removeReferrer(SessionCache cache,
                        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.

  Parameters:
    `cache` - the cache to which this node belongs; 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

### getEtag

    String getEtag(SessionCache cache)

  Compute an ETag value for this node.

  Parameters:
    `cache` - the cache to which this node belongs; may not be null
  Returns:
    an ETag value; never null but possibly empty

### deepCopy

    Map<NodeKey,NodeKey> deepCopy(SessionCache cache,
                                  CachedNode sourceNode,
                                  SessionCache sourceCache)

  Copies into this node all the properties and children (deep copy) from the given source node.

  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
  Returns:
    a [source key -> target key] which represents the node correspondence after the copy operation.

### deepClone

    void deepClone(SessionCache cache,
                   CachedNode sourceNode,
                   SessionCache sourceCache)

  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.

  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

### removedChildren

    Set<NodeKey> removedChildren()

  Returns a set with the keys of the children which have been removed for this node.

  Returns:
    a `Set<`NodeKey`>`, never null

### getChangedReferrerNodes

    Set<NodeKey> getChangedReferrerNodes()

  Returns a set with all the referencing nodes (nodes which are referring this node) which have changed.

  Returns:
    the set of `NodeKey` instances, never null.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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