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

## org.modeshape.graph.request
Class CopyBranchRequest

    java.lang.Object
      org.modeshape.graph.request.Request
          org.modeshape.graph.request.ChangeRequest
              org.modeshape.graph.request.CopyBranchRequest

All Implemented Interfaces:
  Serializable, Cloneable

    public class CopyBranchRequest

extends ChangeRequest

Instruction that a branch be copied from one location into another. This request can copy a branch in one workspace into another workspace, or it can copy a branch in the same workspace. Copying a branch always results in the generation of new UUIDs for the copied nodes. `Cloning a branch` provides functionality similar to copy, but with the ability to preserve UUIDs in the move.

See Also:
  `CloneBranchRequest`, Serialized Form

Field Summary
`static NodeConflictBehavior` | `DEFAULT_NODE_CONFLICT_BEHAVIOR`

Constructor Summary
`CopyBranchRequest(Location from, String fromWorkspace, Location into, String intoWorkspace)` Create a request to copy a branch to another.
`CopyBranchRequest(Location from, String fromWorkspace, Location into, String intoWorkspace, Name nameForCopy)` Create a request to copy a branch to another.
`CopyBranchRequest(Location from, String fromWorkspace, Location into, String intoWorkspace, Name nameForCopy, NodeConflictBehavior nodeConflictBehavior)` Create a request to copy a branch to another.

Method Summary
`void` | `cancel()` Cancel this request.
`Location` | `changedLocation()` Get the location of the top-most node that is to be changed by this request.
`String` | `changedWorkspace()` Get the name of the workspace that was changed by this request.
`boolean` | `changes(String workspace, Path path)` Determine if this request changes the branch at the given path.
`CopyBranchRequest` | `clone()` This method does not clone the results.
`Name` | `desiredName()` Get the name of the copy if it is to be different than that of the original.
`boolean` | `equals(Object obj)`
`Location` | `from()` Get the location defining the top of the branch to be copied
`String` | `fromWorkspace()` Get the name of the workspace containing the branch to be copied.
`Location` | `getActualLocationAfter()` Get the actual location of the node after being copied.
`Location` | `getActualLocationBefore()` Get the actual location of the node before being copied.
`RequestType` | `getType()` Returns the type of the request
`int` | `hashCode()`
`Location` | `into()` Get the location defining the parent where the new copy is to be placed
`String` | `intoWorkspace()` Get the name of the workspace where the copy is to be placed
`boolean` | `isReadOnly()` Return whether this request only reads information.
`boolean` | `isSameWorkspace()` Determine whether this copy operation is within the same workspace.
`NodeConflictBehavior` | `nodeConflictBehavior()` Get the expected behavior when copying the branch and the `destination` already has a node with the same name.
`void` | `setActualLocations(Location fromLocation, Location intoLocation)` Sets the actual and complete location of the node being renamed and its new location.
`String` | `toString()`

Methods inherited from class org.modeshape.graph.request.Request
`checkNotFrozen, freeze, getError, hasError, isCancelled, isFrozen, printable, printable, setError, setLatchForFreezing`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_NODE_CONFLICT_BEHAVIOR

    public static final NodeConflictBehavior DEFAULT_NODE_CONFLICT_BEHAVIOR

Constructor Detail

### CopyBranchRequest

    public CopyBranchRequest(Location from,
                             String fromWorkspace,
                             Location into,
                             String intoWorkspace)

  Create a request to copy a branch to another.

  Parameters:
    `from` - the location of the top node in the existing branch that is to be copied
    `fromWorkspace` - the name of the workspace where the `from` node exists
    `into` - the location of the existing node into which the copy should be placed
    `intoWorkspace` - the name of the workspace where the `into` node is to be copied, or null if the source's default workspace is to be used
  Throws:
    `IllegalArgumentException` - if any of the parameters are null

### CopyBranchRequest

    public CopyBranchRequest(Location from,
                             String fromWorkspace,
                             Location into,
                             String intoWorkspace,
                             Name nameForCopy)

  Create a request to copy a branch to another.

  Parameters:
    `from` - the location of the top node in the existing branch that is to be copied
    `fromWorkspace` - the name of the workspace where the `from` node exists
    `into` - the location of the existing node into which the copy should be placed
    `intoWorkspace` - the name of the workspace where the `into` node is to be copied
    `nameForCopy` - the desired name for the node that results from the copy, or null if the name of the original should be used
  Throws:
    `IllegalArgumentException` - if any of the parameters are null

### CopyBranchRequest

    public CopyBranchRequest(Location from,
                             String fromWorkspace,
                             Location into,
                             String intoWorkspace,
                             Name nameForCopy,
                             NodeConflictBehavior nodeConflictBehavior)

  Create a request to copy a branch to another.

  Parameters:
    `from` - the location of the top node in the existing branch that is to be copied
    `fromWorkspace` - the name of the workspace where the `from` node exists
    `into` - the location of the existing node into which the copy should be placed
    `intoWorkspace` - the name of the workspace where the `into` node is to be copied
    `nameForCopy` - the desired name for the node that results from the copy, or null if the name of the original should be used
    `nodeConflictBehavior` - the expected behavior if an equivalently-named child already exists at the `into` location
  Throws:
    `IllegalArgumentException` - if any of the parameters are null

Method Detail

### from

    public Location from()

  Get the location defining the top of the branch to be copied

  Returns:
    the from location; never null

### into

    public Location into()

  Get the location defining the parent where the new copy is to be placed

  Returns:
    the to location; never null

### fromWorkspace

    public String fromWorkspace()

  Get the name of the workspace containing the branch to be copied.

  Returns:
    the name of the workspace containing the branch to be copied; never null

### intoWorkspace

    public String intoWorkspace()

  Get the name of the workspace where the copy is to be placed

  Returns:
    the name of the workspace where the copy is to be placed; never null

### isSameWorkspace

    public boolean isSameWorkspace()

  Determine whether this copy operation is within the same workspace.

  Returns:
    true if this operation is to be performed within the same workspace, or false if the workspace of the `original` is different than that of the `copy`

### desiredName

    public Name desiredName()

  Get the name of the copy if it is to be different than that of the original.

  Returns:
    the desired name of the copy, or null if the name of the original is to be used

### isReadOnly

    public boolean isReadOnly()

  Return whether this request only reads information.

  Specified by:
    `isReadOnly` in class `Request`
  Returns:
    true if this request reads information, or false if it requests that the repository content be changed in some way
  See Also:
    `Request.isReadOnly()`

### nodeConflictBehavior

    public NodeConflictBehavior nodeConflictBehavior()

  Get the expected behavior when copying the branch and the `destination` already has a node with the same name.

  Returns:
    the behavior specification

### setActualLocations

    public void setActualLocations(Location fromLocation,
                                   Location intoLocation)

  Sets the actual and complete location of the node being renamed and its new location. This method must be called when processing the request, and the actual location must have a `path`.

  Parameters:
    `fromLocation` - the actual location of the node being copied
    `intoLocation` - the actual location of the new copy of the node
  Throws:
    `IllegalArgumentException` - if the either location is null; or if the either location does not have a path
    `IllegalStateException` - if the request is frozen

### getActualLocationBefore

    public Location getActualLocationBefore()

  Get the actual location of the node before being copied.

  Returns:
    the actual location of the node before being moved, or null if the actual location was not set

### getActualLocationAfter

    public Location getActualLocationAfter()

  Get the actual location of the node after being copied.

  Returns:
    the actual location of the node after being copied, or null if the actual location was not set

### changes

    public boolean changes(String workspace,
                           Path path)

  Determine if this request changes the branch at the given path.

  Specified by:
    `changes` in class `ChangeRequest`
  Parameters:
    `workspace` - the name of the workspace; may not be null
    `path` - the path; may not be null
  Returns:
    true if this request changes a node under the given path
  See Also:
    `ChangeRequest.changes(java.lang.String, org.modeshape.graph.property.Path)`

### changedLocation

    public Location changedLocation()

  Get the location of the top-most node that is to be changed by this request. If this request has been completed, this location will always have a `path`.

  Specified by:
    `changedLocation` in class `ChangeRequest`
  Returns:
    the location changed by this request
  See Also:
    `ChangeRequest.changedLocation()`

### changedWorkspace

    public String changedWorkspace()

  Get the name of the workspace that was changed by this request.

  Specified by:
    `changedWorkspace` in class `ChangeRequest`
  Returns:
    the name of the workspace changed by this request
  See Also:
    `ChangeRequest.changedWorkspace()`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`
  See Also:
    `Object.hashCode()`

### cancel

    public void cancel()

  Cancel this request. After this method is called, the `cancellation flag` is set, and any current or future processing of the request may be affected by the cancellation. (Note however, that processors may choose to not respect this request.)

  This method is safe to be called by different threads.

  Overrides:
    `cancel` in class `Request`
  See Also:
    `Request.cancel()`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`
  See Also:
    `Object.equals(java.lang.Object)`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`
  See Also:
    `Object.toString()`

### clone

    public CopyBranchRequest clone()

  This method does not clone the results.

  This method does not clone the results.

  Specified by:
    `clone` in class `ChangeRequest`
  See Also:
    `ChangeRequest.clone()`

### getType

    public RequestType getType()

  Description copied from class: `Request`
  Returns the type of the request

  Specified by:
    `getType` in class `Request`
  Returns:
    the type of the request

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

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