org.mmbase.bridge.util
Class NodeWrapper

java.lang.Object
  extended by org.mmbase.bridge.util.NodeWrapper
All Implemented Interfaces:
Comparable<Node>, Node
Direct Known Subclasses:
AnnotatedNode, ChangedNode, NodeChanger, NodeMap

public abstract class NodeWrapper
extends Object
implements Node

Wraps another Node. You can use this if you want to implement Node, and want to base that implementation on an existing Node instance.

Since:
MMBase-1.8
Version:
$Id: NodeWrapper.java 41943 2010-04-16 17:18:19Z michiel $
Author:
Michiel Meeuwissen

Field Summary
protected  Node node
           
 
Fields inherited from interface org.mmbase.bridge.Node
CLOUD_COMMITNODE_KEY
 
Constructor Summary
NodeWrapper(Node node)
           
 
Method Summary
 void cancel()
          Cancel changes to a node This fails if the current node is not in edit mode.
 void commit()
          Commit the node to the database.
 int compareTo(Node o)
           
 int countRelatedNodes(NodeManager otherNodeManager, String role, String searchDir)
           
 int countRelatedNodes(String nodeManager)
          Returns the number of related nodes that have a specific node manager.
 int countRelations()
          Returns the number of relations this node has with other nodes.
 int countRelations(String relationManager)
          Returns the number of relation nodes attached to this node that have a specific relation manager.
 void createAlias(String alias)
          Create an alias for this node.
 Parameters createParameters(String functionName)
          Creates a parameter list for a function.
 Relation createRelation(Node destinationNode, RelationManager relationManager)
          Adds a relation between this node and a specified node to the cloud.
 void delete()
          Removes the Node.
 void delete(boolean deleteRelations)
          Removes the Node.
 void deleteAlias(String alias)
          Delete an alias for this node.
 void deleteRelations()
          Removes all relation nodes attached to this node.
 void deleteRelations(String relationManager)
          Removes all relation nodes with a certain relation manager that are attached to this node.
 boolean equals(Object o)
           
 StringList getAliases()
          Returns all aliases for this node.
 boolean getBooleanValue(String fieldName)
          Returns the value of the specified field as a boolean.
 byte[] getByteValue(String fieldName)
          Returns the value of the specified field as a byte array.
 Set<String> getChanged()
          A Set of Strings containing the names of all changed fields.
 Cloud getCloud()
          Returns the cloud this node belongs to.
 String getContext()
          Get the security context of the current Node
 Date getDateValue(String fieldName)
           
 BigDecimal getDecimalValue(String fieldName)
           
 double getDoubleValue(String fieldName)
          Returns the value of the specified field as a double.
 FieldValue getFieldValue(Field field)
          Returns the value of the specified field as a FieldValue object.
 FieldValue getFieldValue(String fieldName)
          Returns the value of the specified field as a FieldValue object.
 float getFloatValue(String fieldName)
          Returns the value of the specified field as a float.
 Function getFunction(String functionName)
          Returns a Fuction object.
 Collection<Function<?>> getFunctions()
          Returns all the Function objects of this Node
 FieldValue getFunctionValue(String functionName, List<?> parameters)
          Returns the value of the specified function on the node.
 InputStream getInputStreamValue(String fieldName)
          Returns the value of the specified field as a java.io.InputStream This is especially useful for large byte-array fields.
 int getIntValue(String fieldName)
          Returns the value of the specified field as an int.
 List<?> getListValue(String fieldName)
           
 long getLongValue(String fieldName)
          Returns the value of the specified field as a long.
 Node getNode()
           
 NodeManager getNodeManager()
          Returns the node manager for this node.
 Node getNodeValue(String fieldName)
          Returns the value of the specified field as a Node.
 int getNumber()
          Returns the unique number for this node.
 Object getObjectValue(String fieldName)
          Returns the field's value as an object.
 StringList getPossibleContexts()
          Contacts the security implementation to find out to which other possible contexts the context of this node may be set.
 NodeList getRelatedNodes()
          Returns all related nodes.
 NodeList getRelatedNodes(NodeManager nodeManager)
          Returns all related nodes that have a specific node manager.
 NodeList getRelatedNodes(NodeManager nodeManager, String role, String searchDir)
          Returns all related nodes that have a specific node manager and role.
 NodeList getRelatedNodes(String nodeManager)
          Returns all related nodes that have a specific node manager.
 NodeList getRelatedNodes(String nodeManager, String role, String searchDir)
          Returns all related nodes that have a specific node manager and role.
 RelationList getRelations()
          Returns all relation nodes attached to this node.
 RelationList getRelations(String role)
          Returns all relation nodes attached to this node that have a specific role
 RelationList getRelations(String role, NodeManager nodeManager)
          Returns all relation nodes attached to this node that have a specific role, or refer a node from a specific nodemanager
 RelationList getRelations(String role, NodeManager nodeManager, String searchDir)
           
 RelationList getRelations(String role, String nodeManager)
          Returns all relation nodes attached to this node that have a specific role, or refer a node from a specific nodemanager
 long getSize(String fieldName)
          Returns the 'size' (e.g.
 String getStringValue(String fieldName)
          Returns the value of the specified field as a String.
 Object getValue(String fieldName)
          Returns the value of the specified field as an object.
 Object getValueWithoutProcess(String fieldName)
          Like getObjectValue, but skips any processing that MMBase would normally perform on a field.
 Document getXMLValue(String fieldName)
          Returns the value of the specified field as a dom.Document If the node value is not itself a Document, the method attempts to attempts to convert the String value into an XML.
 Element getXMLValue(String fieldName, Document tree)
          Returns the value of the specified field as a dom.Element If the node value is not itself a Document, the method attempts to attempts to convert the String value into an XML.
 int hashCode()
           
 boolean hasRelations()
          Checks whether this node has any relations.
 boolean isChanged()
          Whether field values were changed since the last commit.
 boolean isChanged(String fieldName)
          Whether a certain field's value was changed since the last commit.
 boolean isNew()
          Whether this Node is new (not yet committed).
 boolean isNodeManager()
          Determine whether this Node is a NodeManager.
 boolean isNull(String fieldName)
          Whether the value for the specified field is null.
 boolean isRelation()
          Determine whether this Node is a Relation.
 boolean isRelationManager()
          Determine whether this Node is a RelationManager.
 boolean mayChangeContext()
          Check context-change rights on this node.
 boolean mayDelete()
          Check delete rights on this node.
 boolean mayWrite()
          Check write rights on this node.
 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 setContext(String context)
          Sets the security context of this Node (AKA the 'owner' field)
 void setDateValue(String fieldName, Date value)
          Sets the value of the specified field using a Date.
 void setDecimalValue(String fieldName, BigDecimal value)
          Sets the value of the specified field using a BigDecimal.
 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 setNodeManager(NodeManager nm)
          Sets the node manager of this node.
 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.
 void setXMLValue(String fieldName, Document value)
          Set's the value of the specified field as a dom.Element
 NodeManager toNodeManager()
          Returns this as a NodeManager.
 Relation toRelation()
          Returns this as a Relation.
 RelationManager toRelationManager()
          Returns this as a RelationManager.
 String toString()
          Converts the node to a string
 Collection<String> validate()
          Validates a node by checking the values from it's fields against the constraints of each field's datatype.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

node

protected final Node node
Constructor Detail

NodeWrapper

public NodeWrapper(Node node)
Method Detail

getCloud

public Cloud getCloud()
Description copied from interface: Node
Returns the cloud this node belongs to.

Specified by:
getCloud in interface Node
Returns:
the Cloud

getNodeManager

public NodeManager getNodeManager()
Description copied from interface: Node
Returns the node manager for this node.

Specified by:
getNodeManager in interface Node
Returns:
the node manager

setNodeManager

public void setNodeManager(NodeManager nm)
Description copied from interface: Node
Sets the node manager of this node. Note that if this nodemanager is not a descendant of the current node manager, information may get lost!

Specified by:
setNodeManager in interface Node

getNumber

public int getNumber()
Description copied from interface: Node
Returns the unique number for this node. Every node has a unique number which can be used to refer to it. In addition to this number a node can have one or more aliases. A value of -1 indicates an invalid number. Other negative values may be used for temporary ids (but not true node numbers). This may differ by implementation.

Specified by:
getNumber in interface Node
Returns:
the unique number for this node
See Also:
Node.createAlias(String alias)

isRelation

public boolean isRelation()
Description copied from interface: Node
Determine whether this Node is a Relation.

Specified by:
isRelation in interface Node
Returns:
true if this Node is a Relation.

toRelation

public Relation toRelation()
Description copied from interface: Node
Returns this as a Relation.

Specified by:
toRelation in interface Node
Returns:
a Relation object

isNodeManager

public boolean isNodeManager()
Description copied from interface: Node
Determine whether this Node is a NodeManager.

Specified by:
isNodeManager in interface Node
Returns:
true if this Node is a NodeManager.

toNodeManager

public NodeManager toNodeManager()
Description copied from interface: Node
Returns this as a NodeManager.

Specified by:
toNodeManager in interface Node
Returns:
a NodeManager object

isRelationManager

public boolean isRelationManager()
Description copied from interface: Node
Determine whether this Node is a RelationManager.

Specified by:
isRelationManager in interface Node
Returns:
true if this Node is a RelationManager.

toRelationManager

public RelationManager toRelationManager()
Description copied from interface: Node
Returns this as a RelationManager.

Specified by:
toRelationManager in interface Node
Returns:
a NodeManager object

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
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
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
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
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
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
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
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
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
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
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
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
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
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field

setDecimalValue

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

Specified by:
setDecimalValue in interface Node
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
Parameters:
fieldName - the name of the field to be updated
value - the new value for the given field // not yet working

isNull

public boolean isNull(String fieldName)
Description copied from interface: Node
Whether the value for the specified field is null. This avoids acquiring the complete value if you only want to check if for emptiness.

Specified by:
isNull in interface Node
Parameters:
fieldName - the name of the field
Returns:
true when value is null

getSize

public long getSize(String fieldName)
Description copied from interface: Node
Returns the 'size' (e.g. the number of bytes of a byte array) for the specified field. This avoids acquiring the complete value if you only want to know how big the value of the field is.

Specified by:
getSize in interface Node
Parameters:
fieldName - the name of the field
Returns:
the 'size'

getValue

public Object getValue(String fieldName)
Description copied from interface: Node
Returns the value of the specified field as an object. For example a field of type int is returned as an Integer. The object type may vary and is dependent on how data was stored in a field. I.e. It may be possible for an Integer field to return it's value as a String if it was stored that way in the first place.

Specified by:
getValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getValueWithoutProcess

public Object getValueWithoutProcess(String fieldName)
Description copied from interface: Node
Like getObjectValue, but skips any processing that MMBase would normally perform on a field. You can use this to get data from a field for validation purposes.

Specified by:
getValueWithoutProcess in interface Node
Parameters:
fieldName - name of field
Returns:
value without processing

getObjectValue

public Object getObjectValue(String fieldName)
Description copied from interface: Node
Returns the field's value as an object. It is not delegated to the right get--Value.

Specified by:
getObjectValue in interface Node
Parameters:
fieldName - name of the field
Returns:
object value

getBooleanValue

public boolean getBooleanValue(String fieldName)
Description copied from interface: Node
Returns the value of the specified field as a boolean. If the actual value is numeric, this call returns true if the value is a positive, non-zero, value. In other words, values '0' and '-1' are considered false. If the value is a string, this call returns true if the value is "true" or "yes" (case-insensitive). In all other cases (including calling byte fields), false is returned.

Specified by:
getBooleanValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getNodeValue

public Node getNodeValue(String fieldName)
Description copied from interface: Node
Returns the value of the specified field as a Node. If the value is not itself a Node, this call attempts to convert the original field value to a Node, by trying to retrieve a Node using the field value as a Node number or alias.
For instance, getNodeValue("destination"), when run on a OAlias object, returns the referenced destination node (instead of the number, which is what it normally holds).
Mostly, this call is used in cluster nodes (nodes retrieved by using the Cloud.getList method. A cluster node returns one of its compound nodes when an appropriate nodemanager name (name from the nodepath) is specified. I.e. getNodeValue("people") will return the people-node in the cluster. If this fails, the method returns null.
Notes: the behavior of getNodeValue when called on a field that is not intended to be a node reference is currently undefined and is not encouraged.
Calling this method with field "number" or null lets the Node return a reference to itself, regardless of the actual value of the number field or status of the Node.

Specified by:
getNodeValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field
See Also:
Cloud.getList(String, String, String, String, String, String, String, boolean)

getIntValue

public int getIntValue(String fieldName)
Description copied from interface: Node
Returns the value of the specified field as an int. Numeric fields are simply converted. Double and float values may be truncated. For Node values, the numeric key is returned. Long values return -1 of the value is too large. Boolean fields return 0 if false, and 1 if true. String fields are parsed. If a parsed string contains an error, ot the field value is not of a type that can be converted (i.e. a byte array), this function returns -1

Specified by:
getIntValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getFloatValue

public float getFloatValue(String fieldName)
Description copied from interface: Node
Returns the value of the specified field as a float. This function attempts to convert the value to a float. Numeric fields are simply converted. Boolean fields return 0.0 if false, and 1.0 if true. String fields are parsed. If a parsed string contains an error, ot the field value is not of a type that can be converted (i.e. a byte array), this function returns -1.0.

Specified by:
getFloatValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getLongValue

public long getLongValue(String fieldName)
Description copied from interface: Node
Returns the value of the specified field as a long. This function attempts to convert the value to a long. Numeric fields are simply converted. Double and float values may be truncated. Boolean fields return 0 if false, and 1 if true. String fields are parsed. If a parsed string contains an error, ot the field value is not of a type that can be converted (i.e. a byte array), this function returns -1

Specified by:
getLongValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getDoubleValue

public double getDoubleValue(String fieldName)
Description copied from interface: Node
Returns the value of the specified field as a double. This function attempts to convert the value to a double. Numeric fields are simply converted. Double may be truncated. Boolean fields return 0.0 if false, and 1.0 if true. String fields are parsed. If a parsed string contains an error, ot the field value is not of a type that can be converted (i.e. a byte array), this function returns -1.0.

Specified by:
getDoubleValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getByteValue

public byte[] getByteValue(String fieldName)
Description copied from interface: Node
Returns the value of the specified field as a byte array. This function returns either the value of a byte field, or the byte value of a string (converted using the default encoding, i.e. UTF8) Other types of values return an empty byte-array.

Specified by:
getByteValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getInputStreamValue

public InputStream getInputStreamValue(String fieldName)
Description copied from interface: Node
Returns the value of the specified field as a java.io.InputStream This is especially useful for large byte-array fields. By this you can avoid them to be completely stored in memory.

Specified by:
getInputStreamValue in interface Node
Parameters:
fieldName - the name of the field
Returns:
value of field as a input stream

getStringValue

public String getStringValue(String fieldName)
Description copied from interface: Node
Returns the value of the specified field as a String. Byte arrays are converted to string using the default encoding (UTF8). Node values return a string representation of their numeric key. For other values the result is calling the toString() method on the actual object.

Specified by:
getStringValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getDateValue

public Date getDateValue(String fieldName)
Specified by:
getDateValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getDecimalValue

public BigDecimal getDecimalValue(String fieldName)
Specified by:
getDecimalValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getListValue

public List<?> getListValue(String fieldName)
Specified by:
getListValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getFieldValue

public FieldValue getFieldValue(String fieldName)
                         throws NotFoundException
Description copied from interface: Node
Returns the value of the specified field as a FieldValue object.

Specified by:
getFieldValue in interface Node
Parameters:
fieldName - the name of the field whose value to return
Returns:
the value of the specified field
Throws:
NotFoundException - is the field does not exist and MMBase 'in development' (i.e. strict mode)

getFieldValue

public FieldValue getFieldValue(Field field)
Description copied from interface: Node
Returns the value of the specified field as a FieldValue object.

Specified by:
getFieldValue in interface Node
Parameters:
field - the Field object whose value to return
Returns:
the value of the specified field

validate

public Collection<String> validate()
Description copied from interface: Node
Validates a node by checking the values from it's fields against the constraints of each field's datatype. For performance reasons, it only validates fields that actually changed (as of MMBase 1.8.4), or when a new node is created. This method is called by the Node.commit() method, after commit processors are run. Note that because commit processors may make necessary changes to field values, it is possible for validate() to fail when used outside the commit process if the constraints are set too strict.

Specified by:
validate in interface Node
Returns:
Collection of errors as String (in the current locale of the cloud) or an empty collection if everything ok.

commit

public void commit()
Description copied from interface: Node
Commit the node to the database. Prior to committing, the values are processed by any commit-processors associated with the datatype of the node's fields), then validated. Makes this node and/or the changes made to this node visible to the cloud. If this method is called for the first time on this node it will make this node visible to the cloud, otherwise the modifications made to this node using the set methods will be made visible to the cloud. This action fails if the current node is not in edit mode. If the node is in a transaction, nothing happens - actual committing occurs through the transaction.

Specified by:
commit in interface Node

cancel

public void cancel()
Description copied from interface: Node
Cancel changes to a node This fails if the current node is not in edit mode. If the node is in a transaction, nothing happens - actual committing occurs through the transaction.

Specified by:
cancel in interface Node

isNew

public boolean isNew()
Description copied from interface: Node
Whether this Node is new (not yet committed).

Specified by:
isNew in interface Node
Returns:
true when new

isChanged

public boolean isChanged(String fieldName)
Description copied from interface: Node
Whether a certain field's value was changed since the last commit.

Specified by:
isChanged in interface Node
Parameters:
fieldName - the name of the field
Returns:
true when field's value was changed

isChanged

public boolean isChanged()
Description copied from interface: Node
Whether field values were changed since the last commit.

Specified by:
isChanged in interface Node
Returns:
true when changed

getChanged

public Set<String> getChanged()
Description copied from interface: Node
A Set of Strings containing the names of all changed fields.

Specified by:
getChanged in interface Node
Returns:
Set of changed fields

delete

public void delete()
Description copied from interface: Node
Removes the Node. Throws an exception if it still has relations. Like delete(false).

Specified by:
delete in interface Node

delete

public void delete(boolean deleteRelations)
Description copied from interface: Node
Removes the Node.

Specified by:
delete in interface Node
Parameters:
deleteRelations - a boolean. If true, then first all existing relations with this node will be removed.

toString

public String toString()
Description copied from interface: Node
Converts the node to a string

Specified by:
toString in interface Node
Overrides:
toString in class Object
Returns:
string representation of a node

getXMLValue

public Document getXMLValue(String fieldName)
                     throws IllegalArgumentException
Description copied from interface: Node
Returns the value of the specified field as a dom.Document If the node value is not itself a Document, the method attempts to attempts to convert the String value into an XML. This included the empty string, but not the 'null' value. If the value is null, this method returns null

Specified by:
getXMLValue in interface Node
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field as a DOM Element or null
Throws:
IllegalArgumentException - if the value cannot be converted to xml, or the field does not exist.

getXMLValue

public Element getXMLValue(String fieldName,
                           Document tree)
                    throws IllegalArgumentException
Description copied from interface: Node
Returns the value of the specified field as a dom.Element If the node value is not itself a Document, the method attempts to attempts to convert the String value into an XML. This method fails (throws a IllegalArgumentException) if the Field is not of type TYPE_XML. If the value cannot be converted, this method returns null

Specified by:
getXMLValue in interface Node
Parameters:
fieldName - the name of the field to be returned
tree - the DOM Document to which the Element is added (as the document root element)
Returns:
the value of the specified field as a DOM Element or null
Throws:
IllegalArgumentException - if the value cannot be converted to xml.

setXMLValue

public void setXMLValue(String fieldName,
                        Document value)
Description copied from interface: Node
Set's the value of the specified field as a dom.Element

Specified by:
setXMLValue in interface Node
Parameters:
fieldName - the name of the field to be returned
value - the DOM Document to has to be set, if not correct doc-type, system will try to convert it to the wanted type.

hasRelations

public boolean hasRelations()
Description copied from interface: Node
Checks whether this node has any relations.

Specified by:
hasRelations in interface Node
Returns:
true if the node has relations

deleteRelations

public void deleteRelations()
Description copied from interface: Node
Removes all relation nodes attached to this node.

Specified by:
deleteRelations in interface Node

deleteRelations

public void deleteRelations(String relationManager)
Description copied from interface: Node
Removes all relation nodes with a certain relation manager that are attached to this node.

Specified by:
deleteRelations in interface Node
Parameters:
relationManager - the name of the relation manager the removed relation nodes should have

getRelations

public RelationList getRelations()
Description copied from interface: Node
Returns all relation nodes attached to this node.

Specified by:
getRelations in interface Node
Returns:
a list of relation nodes

getRelations

public RelationList getRelations(String role)
Description copied from interface: Node
Returns all relation nodes attached to this node that have a specific role

Specified by:
getRelations in interface Node
Parameters:
role - the name of the role the returned relation nodes should have
Returns:
a list of relation nodes

getRelations

public RelationList getRelations(String role,
                                 String nodeManager)
Description copied from interface: Node
Returns all relation nodes attached to this node that have a specific role, or refer a node from a specific nodemanager

Specified by:
getRelations in interface Node
Parameters:
role - the name of the role the returned relation nodes should have
nodeManager - the name of the nodemanager for the nodes the returned relation nodes should have a relation to
Returns:
a list of relation nodes

getRelations

public RelationList getRelations(String role,
                                 NodeManager nodeManager)
Description copied from interface: Node
Returns all relation nodes attached to this node that have a specific role, or refer a node from a specific nodemanager

Specified by:
getRelations in interface Node
Parameters:
role - the name of the role the returned relation nodes should have
nodeManager - the nodemanager for the nodes the returned relation nodes should have a relation to (can be null)
Returns:
a list of relation nodes

getRelations

public RelationList getRelations(String role,
                                 NodeManager nodeManager,
                                 String searchDir)
Specified by:
getRelations in interface Node
Parameters:
role - forward role of a relation
nodeManager - node manager on the other side of the relation
searchDir - the direction of the relation
Returns:
List of relations

countRelations

public int countRelations()
Description copied from interface: Node
Returns the number of relations this node has with other nodes.

Specified by:
countRelations in interface Node
Returns:
the number of relations this node has with other nodes

countRelations

public int countRelations(String relationManager)
Description copied from interface: Node
Returns the number of relation nodes attached to this node that have a specific relation manager.

Specified by:
countRelations in interface Node
Parameters:
relationManager - relation manager
Returns:
the number of relation nodes attached to this node that have a specific relation manager

getRelatedNodes

public NodeList getRelatedNodes()
Description copied from interface: Node
Returns all related nodes. The returned nodes are not the nodes directly attached to this node (the relation nodes) but the nodes attached to the relation nodes of this node.

Specified by:
getRelatedNodes in interface Node
Returns:
a list of all related nodes

getRelatedNodes

public NodeList getRelatedNodes(String nodeManager)
Description copied from interface: Node
Returns all related nodes that have a specific node manager. The returned nodes are not the nodes directly attached to this node (the relation nodes) but the nodes attached to the relation nodes of this node.

Specified by:
getRelatedNodes in interface Node
Parameters:
nodeManager - the name of the node manager the returned nodes should have
Returns:
a list of related nodes

getRelatedNodes

public NodeList getRelatedNodes(NodeManager nodeManager)
Description copied from interface: Node
Returns all related nodes that have a specific node manager. The returned nodes are not the nodes directly attached to this node (the relation nodes) but the nodes attached to the relation nodes of this node.

Specified by:
getRelatedNodes in interface Node
Parameters:
nodeManager - the node manager the returned nodes should have, can be null
Returns:
a list of related nodes

getRelatedNodes

public NodeList getRelatedNodes(String nodeManager,
                                String role,
                                String searchDir)
Description copied from interface: Node
Returns all related nodes that have a specific node manager and role. The returned nodes are not the nodes directly attached to this node (the relation nodes) but the nodes attached to the relation nodes of this node.

Specified by:
getRelatedNodes in interface Node
Parameters:
nodeManager - the name of the node manager the returned nodes should have
role - the role of the relation
searchDir - the direction of the relation
Returns:
a list of related nodes

getRelatedNodes

public NodeList getRelatedNodes(NodeManager nodeManager,
                                String role,
                                String searchDir)
Description copied from interface: Node
Returns all related nodes that have a specific node manager and role. The returned nodes are not the nodes directly attached to this node (the relation nodes) but the nodes attached to the relation nodes of this node.

Specified by:
getRelatedNodes in interface Node
Parameters:
nodeManager - the node manager the returned nodes should have
role - the role of the relation
searchDir - the direction of the relation
Returns:
a list of related nodes

countRelatedNodes

public int countRelatedNodes(String nodeManager)
Description copied from interface: Node
Returns the number of related nodes that have a specific node manager. The counted nodes are not the nodes directly attached to this node (the relation nodes) but the nodes attached to the relation nodes of this node.

Specified by:
countRelatedNodes in interface Node
Parameters:
nodeManager - the name of the node manager the counted nodes should have
Returns:
the number of related nodes that have a specific node manager

countRelatedNodes

public int countRelatedNodes(NodeManager otherNodeManager,
                             String role,
                             String searchDir)
Specified by:
countRelatedNodes in interface Node
Parameters:
otherNodeManager - the node manager the nodes should have
role - the role of the relation
searchDir - the direction of the relation
Returns:
number of related nodes

getAliases

public StringList getAliases()
Description copied from interface: Node
Returns all aliases for this node.

Specified by:
getAliases in interface Node
Returns:
a list of alias names for this node

createAlias

public void createAlias(String alias)
Description copied from interface: Node
Create an alias for this node. An alias can be used to refer to a node in addition to his number.

Specified by:
createAlias in interface Node
Parameters:
alias - the alias to be created for this node

deleteAlias

public void deleteAlias(String alias)
Description copied from interface: Node
Delete an alias for this node.

Specified by:
deleteAlias in interface Node
Parameters:
alias - the alias to be removed for this node

createRelation

public Relation createRelation(Node destinationNode,
                               RelationManager relationManager)
Description copied from interface: Node
Adds a relation between this node and a specified node to the cloud.

Specified by:
createRelation in interface Node
Parameters:
destinationNode - the node to which you want to relate this node
relationManager - the relation manager you want to use
Returns:
the added relation

setContext

public void setContext(String context)
Description copied from interface: Node
Sets the security context of this Node (AKA the 'owner' field)

Specified by:
setContext in interface Node
Parameters:
context - The security context to which this node should belong,

getContext

public String getContext()
Description copied from interface: Node
Get the security context of the current Node

Specified by:
getContext in interface Node
Returns:
the current context of the node (as a String)

getPossibleContexts

public StringList getPossibleContexts()
Description copied from interface: Node
Contacts the security implementation to find out to which other possible contexts the context of this node may be set.

Specified by:
getPossibleContexts in interface Node
Returns:
A StringList containing the contexts which can be used in setContext on this node.

mayWrite

public boolean mayWrite()
Description copied from interface: Node
Check write rights on this node.

Specified by:
mayWrite in interface Node
Returns:
Whether the node may be changed by the current user

mayDelete

public boolean mayDelete()
Description copied from interface: Node
Check delete rights on this node.

Specified by:
mayDelete in interface Node
Returns:
Whether the node may be deleted by the current user

mayChangeContext

public boolean mayChangeContext()
Description copied from interface: Node
Check context-change rights on this node.

Specified by:
mayChangeContext in interface Node
Returns:
Whether the current user may change the context of this node

getFunctions

public Collection<Function<?>> getFunctions()
Description copied from interface: Node
Returns all the Function objects of this Node

Specified by:
getFunctions in interface Node
Returns:
a Collection of Function objects.

getFunction

public Function getFunction(String functionName)
Description copied from interface: Node
Returns a Fuction object. The object returned is a Function object. You need to explixitly cast the result to this object, since not all bridge implementations (i.e. the RMMCI) support this class.

Specified by:
getFunction in interface Node
Parameters:
functionName - name of the function
Returns:
a Function object.

createParameters

public Parameters createParameters(String functionName)
Description copied from interface: Node
Creates a parameter list for a function. The list can be filled with parameter values by either using the List set(int, Object) method, to set values for parameters by psoition, or by using the set(String, Object) method to set parameters by name.
This object can then be passed to the getFunctionValue method. Note that adding extra parameters (with the add(Object) method) won't work and may cause exceptions.

Specified by:
createParameters in interface Node
Parameters:
functionName - name of the function
Returns:
a Parameters object.

getFunctionValue

public FieldValue getFunctionValue(String functionName,
                                   List<?> parameters)
Description copied from interface: Node
Returns the value of the specified function on the node. A function normally has arguments, which can be supplied with a List.

Specified by:
getFunctionValue in interface Node
Parameters:
functionName - name of the function
parameters - list with parameters for the fucntion
Returns:
the result value of executing the function

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

compareTo

public int compareTo(Node o)
Specified by:
compareTo in interface Comparable<Node>

getNode

public Node getNode()


MMBase 2.0-SNAPSHOT - null