org.jboss.dna.graph.requests
Class RenameNodeRequest

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

public class RenameNodeRequest
extends Request

Instruction to rename an existing node (but keep it under the same parent). The same-name-sibling index will be determined automatically, based upon it's current location within the list of children.

Author:
Randall Hauch
See Also:
Serialized Form

Constructor Summary
RenameNodeRequest(Location at, Name newName)
          Create a request to rename the node at the supplied location.
 
Method Summary
 Location at()
          Get the location defining the node that is to be read.
 boolean equals(Object obj)
          
 Location getActualLocationAfter()
          Get the actual location of the node after being renamed.
 Location getActualLocationBefore()
          Get the actual location of the node before being renamed.
 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.
 Name toName()
          Get the new name for the node.
 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
 

Constructor Detail

RenameNodeRequest

public RenameNodeRequest(Location at,
                         Name newName)
Create a request to rename the node at the supplied location.

Parameters:
at - the location of the node to be read
newName - the new name for the node
Throws:
IllegalArgumentException - if the location is null
Method Detail

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

at

public Location at()
Get the location defining the node that is to be read.

Returns:
the location of the node; never null

toName

public Name toName()
Get the new name for the node.

Returns:
the new name; never null

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 or is missing its path, if the old location does not represent the same location as the current location, if the new location does not have the same parent as the old location, or if the new location does not have the same name on last segment as that specified on the request

getActualLocationBefore

public Location getActualLocationBefore()
Get the actual location of the node before being renamed.

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

getActualLocationAfter

public Location getActualLocationAfter()
Get the actual location of the node after being renamed.

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