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 MoveBranchRequest

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

All Implemented Interfaces:
  Serializable, Cloneable

    public class MoveBranchRequest

extends ChangeRequest

Instruction that a branch be moved from one location into another.

See Also:
  Serialized Form

Field Summary
`static NodeConflictBehavior` | `DEFAULT_CONFLICT_BEHAVIOR`

Constructor Summary
`MoveBranchRequest(Location from, Location into, Location before, String workspaceName, Name newNameForMovedNode, NodeConflictBehavior conflictBehavior)` Create a request to move a branch from one location into another.
`MoveBranchRequest(Location from, Location into, String workspaceName)` Create a request to move a branch from one location into another.
`MoveBranchRequest(Location from, Location into, String workspaceName, Name newNameForMovedNode)` Create a request to move a branch from one location into another.
`MoveBranchRequest(Location from, Location into, String workspaceName, NodeConflictBehavior conflictBehavior)` Create a request to move a branch from one location into another.

Method Summary
`Location` | `before()` Get the location defining the node before which the branch is to be placed
`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.
`MoveBranchRequest` | `clone()` This method does not clone the results.
`NodeConflictBehavior` | `conflictBehavior()` Get the expected behavior when copying the branch and the `destination` already has a node with the same name.
`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 moved
`Location` | `getActualLocationAfter()` Get the actual location of the node after being moved.
`Location` | `getActualLocationBefore()` Get the actual location of the node before being moved.
`RequestType` | `getType()` Returns the type of the request
`int` | `hashCode()`
`boolean` | `hasNoEffect()` Determine whether this move request can be determined to have no effect.
`Location` | `into()` Get the location defining the parent where the branch is to be placed
`String` | `inWorkspace()` Get the name of the workspace in which the branch exists.
`boolean` | `isReadOnly()` Return whether this request only reads information.
`void` | `setActualLocations(Location oldLocation, Location newLocation)` 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_CONFLICT_BEHAVIOR

    public static final NodeConflictBehavior DEFAULT_CONFLICT_BEHAVIOR

Constructor Detail

### MoveBranchRequest

    public MoveBranchRequest(Location from,
                             Location into,
                             String workspaceName)

  Create a request to move a branch from one location into another.

  Parameters:
    `from` - the location of the top node in the existing branch that is to be moved
    `into` - the location of the existing node into which the branch should be moved
    `workspaceName` - the name of the workspace
  Throws:
    `IllegalArgumentException` - if any of the parameters are null

### MoveBranchRequest

    public MoveBranchRequest(Location from,
                             Location into,
                             String workspaceName,
                             Name newNameForMovedNode)

  Create a request to move a branch from one location into another.

  Parameters:
    `from` - the location of the top node in the existing branch that is to be moved
    `into` - the location of the existing node into which the branch should be moved
    `workspaceName` - the name of the workspace
    `newNameForMovedNode` - the new name for the node being moved, or null if the name of the original should be used
  Throws:
    `IllegalArgumentException` - if any of the parameters are null

### MoveBranchRequest

    public MoveBranchRequest(Location from,
                             Location into,
                             String workspaceName,
                             NodeConflictBehavior conflictBehavior)

  Create a request to move a branch from one location into another.

  Parameters:
    `from` - the location of the top node in the existing branch that is to be moved
    `into` - the location of the existing node into which the branch should be moved
    `workspaceName` - the name of the workspace
    `conflictBehavior` - the expected behavior if an equivalently-named child already exists at the `into` location
  Throws:
    `IllegalArgumentException` - if any of the parameters are null

### MoveBranchRequest

    public MoveBranchRequest(Location from,
                             Location into,
                             Location before,
                             String workspaceName,
                             Name newNameForMovedNode,
                             NodeConflictBehavior conflictBehavior)

  Create a request to move a branch from one location into another.

  Parameters:
    `from` - the location of the top node in the existing branch that is to be moved
    `into` - the location of the existing node into which the branch should be moved
    `before` - the location of the child of the `into` node that the branch should be placed before; null indicates that the branch should be the last child of its new parent
    `workspaceName` - the name of the workspace
    `newNameForMovedNode` - the new name for the node being moved, or null if the name of the original should be used
    `conflictBehavior` - 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 moved

  Returns:
    the from location; never null

### into

    public Location into()

  Get the location defining the parent where the branch is to be placed

  Returns:
    the to location; or null if the node is being reordered within the same parent

### before

    public Location before()

  Get the location defining the node before which the branch is to be placed

  Returns:
    the to location; null indicates that the branch should be the last child node of its new parent

### inWorkspace

    public String inWorkspace()

  Get the name of the workspace in which the branch exists.

  Returns:
    the name of the workspace containing the branch; never null

### 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

### conflictBehavior

    public NodeConflictBehavior conflictBehavior()

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

  Returns:
    the behavior specification

### 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()`

### hasNoEffect

    public boolean hasNoEffect()

  Determine whether this move request can be determined to have no effect.

  A move is known to have no effect when all of the following conditions are true:

  - the `into` location has a `path` but no `identification properties`;
  - the `from` location has a `path`; and
  - the `from` location's `parent` is the same as the `into` location's path.
  If all of these conditions are not true, this method returns false.

  Returns:
    true if this move request really doesn't change the parent of the node, or false if it cannot be determined

### setActualLocations

    public void setActualLocations(Location oldLocation,
                                   Location newLocation)

  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:
    `oldLocation` - the actual location of the node before being moved
    `newLocation` - the actual new location 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 moved.

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

  Returns:
    the actual location of the node after being moved, 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`.

  This method returns the `getActualLocationAfter()` location, or if null the `into()` location.

  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()`

### 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()`

### hashCode

    public int hashCode()

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

### 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 MoveBranchRequest 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-2012 JBoss, a division of Red Hat. All Rights Reserved.