org.modeshape.graph.request
Class DeleteChildrenRequest

java.lang.Object
  extended by org.modeshape.graph.request.Request
      extended by org.modeshape.graph.request.ChangeRequest
          extended by org.modeshape.graph.request.DeleteChildrenRequest
All Implemented Interfaces:
Serializable, Cloneable

public class DeleteChildrenRequest
extends ChangeRequest

Instruction that all nodes below a supplied node be deleted. This is similar to DeleteBranchRequest, except that the parent node (top node in the branch) is not deleted.

See Also:
Serialized Form

Constructor Summary
DeleteChildrenRequest(Location at, String workspaceName)
          Create a request to delete all children of the supplied node.
 
Method Summary
 void addDeletedChild(Location child)
          Add to the list of children that has been read the child with the given path and identification properties.
 void addDeletedChild(Path pathToChild, Property idProperty)
          Add to the list of children that has been read the child with the given path and identification property.
 void addDeletedChild(Path pathToChild, Property firstIdProperty, Property... remainingIdProperties)
          Add to the list of children that has been read the child with the given path and identification properties.
 void addDeletedChildren(Iterable<Location> children)
          Add to the list of children that has been read the supplied children with the given path and identification properties.
 Location at()
          Get the location defining the top of the branch to be deleted
 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.
 DeleteChildrenRequest clone()
           This method does not clone the results.
 boolean equals(Object obj)
          
 List<Location> getActualChildrenDeleted()
          Get the list of the actual children that were deleted.
 Location getActualLocationOfNode()
          Get the actual location of the node that was deleted.
 String inWorkspace()
          Get the name of the workspace in which the branch exists.
 boolean isReadOnly()
          Return whether this request only reads information.
 void setActualLocationOfNode(Location actual)
          Sets the actual and complete location of the node being deleted.
 String toString()
          
 
Methods inherited from class org.modeshape.graph.request.Request
cancel, freeze, getError, hasError, isCancelled, isFrozen, setError, setLatchForFreezing
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeleteChildrenRequest

public DeleteChildrenRequest(Location at,
                             String workspaceName)
Create a request to delete all children of the supplied node. The supplied parent node will not be deleted.

Parameters:
at - the location of the parent node
workspaceName - the name of the workspace containing the parent
Throws:
IllegalArgumentException - if the location or workspace name is null
Method Detail

at

public Location at()
Get the location defining the top of the branch to be deleted

Returns:
the location of the branch; never null

inWorkspace

public String inWorkspace()
Get the name of the workspace in which the branch exists.

Returns:
the name of the workspace; 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()

setActualLocationOfNode

public void setActualLocationOfNode(Location actual)
Sets the actual and complete location of the node being deleted. This method must be called when processing the request, and the actual location must have a path.

Parameters:
actual - the actual location of the node being deleted, or null if the current location should be used
Throws:
IllegalArgumentException - if the actual location is not equal to the current location, or if the actual location does not have a path.
IllegalStateException - if the request is frozen

addDeletedChildren

public void addDeletedChildren(Iterable<Location> children)
Add to the list of children that has been read the supplied children with the given path and identification properties. The children are added in order.

Parameters:
children - the locations of the children that were read
Throws:
IllegalArgumentException - if the parameter is null
IllegalStateException - if the request is frozen
See Also:
addDeletedChild(Location), addDeletedChild(Path, Property), addDeletedChild(Path, Property, Property...)

addDeletedChild

public void addDeletedChild(Location child)
Add to the list of children that has been read the child with the given path and identification properties. The children should be added in order.

Parameters:
child - the location of the child that was read
Throws:
IllegalArgumentException - if the location is null
IllegalStateException - if the request is frozen
See Also:
addDeletedChild(Path, Property), addDeletedChild(Path, Property, Property...)

addDeletedChild

public void addDeletedChild(Path pathToChild,
                            Property firstIdProperty,
                            Property... remainingIdProperties)
Add to the list of children that has been read the child with the given path and identification properties. The children should be added in order.

Parameters:
pathToChild - the path of the child that was just read
firstIdProperty - the first identification property of the child that was just read
remainingIdProperties - the remaining identification properties of the child that was just read
Throws:
IllegalArgumentException - if the path or identification properties are null
IllegalStateException - if the request is frozen
See Also:
addDeletedChild(Location), addDeletedChild(Path, Property)

addDeletedChild

public void addDeletedChild(Path pathToChild,
                            Property idProperty)
Add to the list of children that has been read the child with the given path and identification property. The children should be added in order.

Parameters:
pathToChild - the path of the child that was just read
idProperty - the identification property of the child that was just read
Throws:
IllegalArgumentException - if the path or identification properties are null
IllegalStateException - if the request is frozen
See Also:
addDeletedChild(Location), addDeletedChild(Path, Property, Property...)

getActualChildrenDeleted

public List<Location> getActualChildrenDeleted()
Get the list of the actual children that were deleted.

Returns:
the actual children, or empty if there were no children (if frozen)

getActualLocationOfNode

public Location getActualLocationOfNode()
Get the actual location of the node that was deleted.

Returns:
the actual location, 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()

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


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