org.mmbase.bridge.util
Class NodeChanger

java.lang.Object
  extended by org.mmbase.bridge.util.NodeWrapper
      extended by org.mmbase.bridge.util.NodeChanger
All Implemented Interfaces:
Comparable<Node>, Node

public class NodeChanger
extends NodeWrapper

Wraps another Node, and adds 'isChangedByThis()'. Before commiting the node, you may want to check if you changed to node, and not some other thread. In that case you can first wrap your Node in a NodeChanger object.

Since:
MMBase-1.8
Version:
$Id: NodeChanger.java 34900 2009-05-01 16:29:42Z michiel $
Author:
Michiel Meeuwissen

Field Summary
protected  Map<String,Object> originalValues
           
 
Fields inherited from class org.mmbase.bridge.util.NodeWrapper
node
 
Fields inherited from interface org.mmbase.bridge.Node
CLOUD_COMMITNODE_KEY
 
Constructor Summary
NodeChanger(Node node)
           
 
Method Summary
 void cancelThis()
           
protected  void change(String fieldName)
           
 boolean isChangedByThis()
          The NodeWrapper.isChanged(java.lang.String) method reflects the isChanged status of the underlying core node.isChanged, this one does that too, but only return true, if this instance performed this change.
 void setBooleanValue(String fieldName, boolean value)
          Sets the value of the specified field using an boolean.
 void setByteValue(String fieldName, byte[] value)
          Sets the value of the specified field using a byte array.
 void setDateValue(String fieldName, Date value)
          Sets the value of the specified field using a Date.
 void setDoubleValue(String fieldName, double value)
          Sets the value of the specified field using a double.
 void setFloatValue(String fieldName, float value)
          Sets the value of the specified field using a float.
 void setInputStreamValue(String fieldName, InputStream value, long size)
          Sets the value of the specified field using a java.io.InputStream.
 void setIntValue(String fieldName, int value)
          Sets the value of the specified field using an int.
 void setListValue(String fieldName, List value)
          Sets the value of the specified field using a List.
 void setLongValue(String fieldName, long value)
          Sets the value of the specified field using a long.
 void setNodeValue(String fieldName, Node value)
          Sets the value of the specified field using an Node.
 void setObjectValue(String fieldName, Object value)
          Sets the value of the specified field using an object, but without dispatching to the right type first.
 void setStringValue(String fieldName, String value)
          Sets the value of the specified field using a String.
 void setValue(String fieldName, Object value)
          Sets the value of the specified field using an object, but delegated to the right set--Value depending on the type of the field.
 void setValueWithoutProcess(String fieldName, Object value)
          Like setValue, but skips any processing that MMBase would normally perform on a field.
 
Methods inherited from class org.mmbase.bridge.util.NodeWrapper
cancel, commit, compareTo, countRelatedNodes, countRelatedNodes, countRelations, countRelations, createAlias, createParameters, createRelation, delete, delete, deleteAlias, deleteRelations, deleteRelations, equals, getAliases, getBooleanValue, getByteValue, getChanged, getCloud, getContext, getDateValue, getDecimalValue, getDoubleValue, getFieldValue, getFieldValue, getFloatValue, getFunction, getFunctions, getFunctionValue, getInputStreamValue, getIntValue, getListValue, getLongValue, getNode, getNodeManager, getNodeValue, getNumber, getObjectValue, getPossibleContexts, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getRelations, getRelations, getSize, getStringValue, getValue, getValueWithoutProcess, getXMLValue, getXMLValue, hashCode, hasRelations, isChanged, isChanged, isNew, isNodeManager, isNull, isRelation, isRelationManager, mayChangeContext, mayDelete, mayWrite, setContext, setDecimalValue, setNodeManager, setXMLValue, toNodeManager, toRelation, toRelationManager, toString, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

originalValues

protected Map<String,Object> originalValues
Constructor Detail

NodeChanger

public NodeChanger(Node node)
Method Detail

change

protected void change(String fieldName)

setValue

public void setValue(String fieldName,
                     Object value)
Description copied from interface: Node
Sets the value of the specified field using an object, but delegated to the right set--Value depending on the type of the field. For example a field of type int can be set using an Integer. This change will not be visible to the cloud until the commit method is called.

Specified by:
setValue in interface Node
Overrides:
setValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setValueWithoutProcess

public void setValueWithoutProcess(String fieldName,
                                   Object value)
Description copied from interface: Node
Like setValue, but skips any processing that MMBase would normally perform on a field. You can use this to set data on fields that are 'system' defined, to prevent (among other things) infinite recursion. Use with care - in general processing of a field has a purpose!

Specified by:
setValueWithoutProcess in interface Node
Overrides:
setValueWithoutProcess in class NodeWrapper
Parameters:
fieldName - name of field
value - new value of the field

setObjectValue

public void setObjectValue(String fieldName,
                           Object value)
Description copied from interface: Node
Sets the value of the specified field using an object, but without dispatching to the right type first.

Specified by:
setObjectValue in interface Node
Overrides:
setObjectValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setBooleanValue

public void setBooleanValue(String fieldName,
                            boolean value)
Description copied from interface: Node
Sets the value of the specified field using an boolean. This change will not be visible to the cloud until the commit method is called.

Specified by:
setBooleanValue in interface Node
Overrides:
setBooleanValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setNodeValue

public void setNodeValue(String fieldName,
                         Node value)
Description copied from interface: Node
Sets the value of the specified field using an Node. This change will not be visible to the cloud until the commit method is called.

Specified by:
setNodeValue in interface Node
Overrides:
setNodeValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setIntValue

public void setIntValue(String fieldName,
                        int value)
Description copied from interface: Node
Sets the value of the specified field using an int. This change will not be visible to the cloud until the commit method is called.

Specified by:
setIntValue in interface Node
Overrides:
setIntValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setFloatValue

public void setFloatValue(String fieldName,
                          float value)
Description copied from interface: Node
Sets the value of the specified field using a float. This change will not be visible to the cloud until the commit method is called.

Specified by:
setFloatValue in interface Node
Overrides:
setFloatValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setDoubleValue

public void setDoubleValue(String fieldName,
                           double value)
Description copied from interface: Node
Sets the value of the specified field using a double. This change will not be visible to the cloud until the commit method is called.

Specified by:
setDoubleValue in interface Node
Overrides:
setDoubleValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setByteValue

public void setByteValue(String fieldName,
                         byte[] value)
Description copied from interface: Node
Sets the value of the specified field using a byte array. This change will not be visible to the cloud until the commit method is called.

Specified by:
setByteValue in interface Node
Overrides:
setByteValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setInputStreamValue

public void setInputStreamValue(String fieldName,
                                InputStream value,
                                long size)
Description copied from interface: Node
Sets the value of the specified field using a java.io.InputStream.

Specified by:
setInputStreamValue in interface Node
Overrides:
setInputStreamValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field
size - size of input stream

setLongValue

public void setLongValue(String fieldName,
                         long value)
Description copied from interface: Node
Sets the value of the specified field using a long. This change will not be visible to the cloud until the commit method is called.

Specified by:
setLongValue in interface Node
Overrides:
setLongValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setStringValue

public void setStringValue(String fieldName,
                           String value)
Description copied from interface: Node
Sets the value of the specified field using a String. This change will not be visible to the cloud until the commit method is called.

Specified by:
setStringValue in interface Node
Overrides:
setStringValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setDateValue

public void setDateValue(String fieldName,
                         Date value)
Description copied from interface: Node
Sets the value of the specified field using a Date. This change will not be visible to the cloud until the commit method is called.

Specified by:
setDateValue in interface Node
Overrides:
setDateValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setListValue

public void setListValue(String fieldName,
                         List value)
Description copied from interface: Node
Sets the value of the specified field using a List. This change will not be visible to the cloud until the commit method is called.

Specified by:
setListValue in interface Node
Overrides:
setListValue in class NodeWrapper
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field // not yet working

isChangedByThis

public boolean isChangedByThis()
The NodeWrapper.isChanged(java.lang.String) method reflects the isChanged status of the underlying core node.isChanged, this one does that too, but only return true, if this instance performed this change.


cancelThis

public void cancelThis()


MMBase 2.0-SNAPSHOT - null