org.modeshape.jcr.cache.document

## Class SessionNode.DeepCopy

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

- Direct Known Subclasses:
    SessionNode.DeepClone
  Enclosing class:
    SessionNode

      protected class SessionNode.DeepCopy
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Connectors` | `connectors`
    `protected DocumentStore` | `documentStore`
    `protected Map<NodeKey,NodeKey>` | `linkedPlaceholdersToOriginal`
    `protected PropertyFactory` | `propertyFactory`
    `protected SessionCache` | `sourceCache`
    `protected Map<NodeKey,Set<Property>>` | `sourceKeyToReferenceProperties`
    `protected CachedNode` | `sourceNode`
    `protected Map<NodeKey,NodeKey>` | `sourceToTargetKeys`
    `protected Path` | `startingPathInSource`
    `protected String` | `systemWorkspaceKey`
    `protected WritableSessionCache` | `targetCache`
    `protected SessionNode` | `targetNode`
    `protected String` | `targetWorkspaceKey`
    `protected ValueFactories` | `valueFactories`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SessionNode.DeepCopy(SessionNode targetNode, WritableSessionCache cache, CachedNode sourceNode, SessionCache sourceCache, String systemWorkspaceKey, Connectors connectors)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Object` | `convertToInternalBinaryValue(Object value)`
    `protected void` | `copyProperties(MutableCachedNode targetNode, CachedNode sourceNode)`
    `protected void` | `copyUUIDProperty(Property sourceProperty, MutableCachedNode targetNode, CachedNode sourceNode)`
    `protected NodeKey` | `createTargetKeyFor(NodeKey sourceKey, NodeKey parentKeyInTarget, String preferredKey)`
    `protected void` | `doPhase1(MutableCachedNode targetNode, CachedNode sourceNode)` Perform a copy of the source tree to create a similar tree in the target session.
    `protected void` | `doPhase2()` This leaves any linked placeholders that failed in the map.
    `void` | `execute()`
    `protected String` | `getOperationName()`
    `Map<NodeKey,NodeKey>` | `getSourceToTargetKeys()`
    `protected void` | `resolveReferences()` After the entire graph of nodes has been copied, look at each of the target nodes for reference properties pointing towards nodes in the source graph that now have equivalent nodes in the target graph.
    `protected boolean` | `shouldProcessSourceKey(NodeKey sourceKey)`
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### targetCache

          protected final WritableSessionCache targetCache

    - #### targetNode

          protected final SessionNode targetNode

    - #### sourceCache

          protected final SessionCache sourceCache

    - #### sourceNode

          protected final CachedNode sourceNode

    - #### startingPathInSource

          protected final Path startingPathInSource

    - #### propertyFactory

          protected final PropertyFactory propertyFactory

    - #### targetWorkspaceKey

          protected final String targetWorkspaceKey

    - #### linkedPlaceholdersToOriginal

          protected final Map<NodeKey,NodeKey> linkedPlaceholdersToOriginal

    - #### sourceToTargetKeys

          protected final Map<NodeKey,NodeKey> sourceToTargetKeys

    - #### sourceKeyToReferenceProperties

          protected final Map<NodeKey,Set<Property>> sourceKeyToReferenceProperties

    - #### documentStore

          protected final DocumentStore documentStore

    - #### systemWorkspaceKey

          protected final String systemWorkspaceKey

    - #### connectors

          protected final Connectors connectors

    - #### valueFactories

          protected final ValueFactories valueFactories

  - ### Constructor Detail

    - #### SessionNode.DeepCopy

          protected SessionNode.DeepCopy(SessionNode targetNode,
                              WritableSessionCache cache,
                              CachedNode sourceNode,
                              SessionCache sourceCache,
                              String systemWorkspaceKey,
                              Connectors connectors)

  - ### Method Detail

    - #### getSourceToTargetKeys

          public Map<NodeKey,NodeKey> getSourceToTargetKeys()

    - #### execute

          public void execute()

    - #### doPhase1

          protected void doPhase1(MutableCachedNode targetNode,
                      CachedNode sourceNode)

      Perform a copy of the source tree to create a similar tree in the target session. Note that copying linked nodes varies depending upon where the linked nodes are relative to the source tree.
      1. If the linked nodes and the original node are all in the source tree being copied, then the result of the copy will contain a copy of the original and links to the new copy.
      2. If the original node is not within the source tree being copied, then the result of the copy will contain links to the original node.
      The result of phase 1 will have either created the links correctly or will have add placeholders in the target tree representing where the linked children should exist. Such placeholders will be handled in phase 2.
      Parameters:
        `targetNode` - the (empty) target node that should be made to look like the supplied source node; may not be null
        `sourceNode` - the original node that should be copied; may not be null

    - #### createTargetKeyFor

          protected NodeKey createTargetKeyFor(NodeKey sourceKey,
                                   NodeKey parentKeyInTarget,
                                   String preferredKey)

    - #### doPhase2

          protected void doPhase2()

      This leaves any linked placeholders that failed in the map.

    - #### resolveReferences

          protected void resolveReferences()

      After the entire graph of nodes has been copied, look at each of the target nodes for reference properties pointing towards nodes in the source graph that now have equivalent nodes in the target graph. If that is the case, update those reference properties.

    - #### copyProperties

          protected void copyProperties(MutableCachedNode targetNode,
                            CachedNode sourceNode)

    - #### convertToInternalBinaryValue

          protected Object convertToInternalBinaryValue(Object value)

    - #### copyUUIDProperty

          protected void copyUUIDProperty(Property sourceProperty,
                              MutableCachedNode targetNode,
                              CachedNode sourceNode)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getOperationName

          protected String getOperationName()

    - #### shouldProcessSourceKey

          protected boolean shouldProcessSourceKey(NodeKey sourceKey)

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