org.jboss.dna.graph.request
Class UpdateValuesRequest

java.lang.Object
  extended by org.jboss.dna.graph.request.Request
      extended by org.jboss.dna.graph.request.ChangeRequest
          extended by org.jboss.dna.graph.request.UpdateValuesRequest
All Implemented Interfaces:
Serializable

public class UpdateValuesRequest
extends ChangeRequest

Instruction to update the values for a certain property on the node at the specified location.

This request is capable of specifying specific values for the property that will be added or removed. Other values for the property not be affected by this request. The request contains a workspace name and a location that uniquely identify a node in the workspace as well as the name of property (that may or may not previously exist) on the node. The request also contains zero or more values to add and zero or more values to remove from the property. All values will be appended to the list of values. Removals are processed before additions.

Even if the property has no values after this call, the property itself will not be removed by this request.

Note that the number of values in a property (e.g., Property.size(), Property.isEmpty(), Property.isSingle(), and Property.isMultiple()) has no influence on whether the property should be removed. It is possible for a property to have no values.

See Also:
Serialized Form

Constructor Summary
UpdateValuesRequest(String workspaceName, Location on, Name propertyName, List<Object> addedValues, List<Object> removedValues)
           
 
Method Summary
 List<Object> addedValues()
          Get the list of values to be added.
 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.
 List<Object> getActualAddedValues()
          Get the actual added values.
 Location getActualLocationOfNode()
          Get the actual location of the node that was updated.
 List<Object> getActualRemovedValues()
          Get the actual removed values.
 String inWorkspace()
          Get the name of the workspace in which the node exists.
 boolean isReadOnly()
          Return whether this request only reads information.
 Location on()
          Get the location defining the node that is to be updated.
 Name property()
          Get the name of the property that is to be updated.
 List<Object> removedValues()
          Get the list of values to be removed.
 void setActualLocation(Location actual, List<Object> actualAddedValues, List<Object> actualRemovedValues)
           
 
Methods inherited from class org.jboss.dna.graph.request.Request
cancel, freeze, getError, hasError, isCancelled, isFrozen, setError, setLatchForFreezing
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateValuesRequest

public UpdateValuesRequest(String workspaceName,
                           Location on,
                           Name propertyName,
                           List<Object> addedValues,
                           List<Object> removedValues)
Method Detail

on

public Location on()
Get the location defining the node that is to be updated.

Returns:
the location of the node; never null

property

public Name property()
Get the name of the property that is to be updated.

Returns:
the name of the property; never null

inWorkspace

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

Returns:
the name of the workspace; never null

addedValues

public List<Object> addedValues()
Get the list of values to be added.

Returns:
the values (if any) to be added; never null

removedValues

public List<Object> removedValues()
Get the list of values to be removed.

Returns:
the values (if any) to be removed; never null

changedLocation

public Location changedLocation()
Description copied from class: ChangeRequest
Get the location of the top-most node that is to be changed by this request.

Specified by:
changedLocation in class ChangeRequest
Returns:
the location changed by this request

changedWorkspace

public String changedWorkspace()
Description copied from class: ChangeRequest
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

changes

public boolean changes(String workspace,
                       Path path)
Description copied from class: ChangeRequest
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

isReadOnly

public boolean isReadOnly()
Description copied from class: Request
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

setActualLocation

public void setActualLocation(Location actual,
                              List<Object> actualAddedValues,
                              List<Object> actualRemovedValues)

getActualLocationOfNode

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

Returns:
the actual location, or null if the actual location was not set

getActualAddedValues

public List<Object> getActualAddedValues()
Get the actual added values. This should always be identical to the list of values that were requested to be added.

Returns:
the values that were added to the node when this request was processed; never null

getActualRemovedValues

public List<Object> getActualRemovedValues()
Get the actual removed values. This will differ from the values that were requested to be removed if some of the values that were requested to be removed were not already values for the property.

Returns:
the values that were removed from the node when this request was processed; never null


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