org.jboss.dna.graph.requests
Class CopyBranchRequest

java.lang.Object
  extended by org.jboss.dna.graph.requests.Request
      extended by org.jboss.dna.graph.requests.CopyBranchRequest
All Implemented Interfaces:
Serializable

public class CopyBranchRequest
extends Request

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

Author:
Randall Hauch
See Also:
Serialized Form

Field Summary
static NodeConflictBehavior DEFAULT_CONFLICT_BEHAVIOR
           
 
Constructor Summary
CopyBranchRequest(Location from, Location into)
          Create a request to copy a branch to another.
CopyBranchRequest(Location from, Location into, NodeConflictBehavior conflictBehavior)
          Create a request to copy a branch to another.
 
Method Summary
 NodeConflictBehavior conflictBehavior()
          Get the expected behavior when copying the branch and the destination already has a node with the same name.
 boolean equals(Object obj)
          
 Location from()
          Get the location defining the top of 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.
 Location into()
          Get the location defining the parent where the new copy is to be placed
 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.jboss.dna.graph.requests.Request
cancel, getError, hasError, isCancelled, setError
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_CONFLICT_BEHAVIOR

public static final NodeConflictBehavior DEFAULT_CONFLICT_BEHAVIOR
Constructor Detail

CopyBranchRequest

public CopyBranchRequest(Location from,
                         Location into)
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
into - the location of the existing node into which the copy should be placed
Throws:
IllegalArgumentException - if from or into are null

CopyBranchRequest

public CopyBranchRequest(Location from,
                         Location into,
                         NodeConflictBehavior conflictBehavior)
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
into - the location of the existing node into which the copy should be placed
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 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

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

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

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 renamed
newLocation - the actual location of the node after being renamed
Throws:
IllegalArgumentException - if the either location is null, if the old location does not represent the same location as the from location, if the new location does not represent the same location as the into location, or if the either location does not have a path

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 moved, or null if the actual location was not set

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


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