org.mmbase.bridge.implementation
Class BasicNode

java.lang.Object
  extended byorg.mmbase.bridge.implementation.BasicNode
All Implemented Interfaces:
java.lang.Comparable, Node, SizeMeasurable
Direct Known Subclasses:
BasicNodeManager, BasicRelation

public class BasicNode
extends java.lang.Object
implements Node, java.lang.Comparable, SizeMeasurable

Basic implementation of Node. Wraps MMObjectNodes, adds security.

Version:
$Id: BasicNode.java,v 1.123.2.4 2004/07/20 13:03:08 pierre Exp $
Author:
Rob Vermeulen, Pierre van Rooden, Michiel Meeuwissen
See Also:
Node, MMObjectNode

Field Summary
protected  java.lang.String account
          The account this node is edited under.
static int ACTION_COMMIT
           
static int ACTION_CREATE
           
static int ACTION_DELETE
           
static int ACTION_EDIT
           
protected  BasicCloud cloud
          Reference to the Cloud.
protected  boolean isnew
          Determines whether this node was created for insert.
protected  MMBase mmb
          Reference to MMBase root.
protected  NodeManager nodeManager
          Reference to the NodeManager
protected  MMObjectNode noderef
          Reference to actual MMObjectNode object.
protected  int temporaryNodeId
          Temporary node ID.
 
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(java.lang.Object o)
          Compares this node to the passed object.
 int countRelatedNodes(NodeManager otherNodeManager, java.lang.String role, java.lang.String direction)
           
 int countRelatedNodes(java.lang.String type)
          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(java.lang.String type)
          Returns the number of relation nodes attached to this node that have a specific relation manager.
 void createAlias(java.lang.String aliasName)
          Create an alias for this node.
 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(java.lang.String aliasName)
          Delete an alias for this node.
 void deleteRelations()
          Removes all relation nodes attached to this node.
 void deleteRelations(java.lang.String type)
          Removes all relation nodes with a certain relation manager that are attached to this node.
protected  void edit(int action)
          Edit this node.
 boolean equals(java.lang.Object o)
          Compares two nodes, and returns true if they are equal.
protected  void finalize()
          Reverse the buffers, when changed and not stored...
 StringList getAliases()
          Returns all aliases for this node.
 boolean getBooleanValue(java.lang.String fieldName)
          Returns the value of the specified field as a boolean.
 int getByteSize()
          Determins the byte-size of this object
 int getByteSize(SizeOf sizeof)
          Determins the byte-size of this object using the given SizeOf instance.
 byte[] getByteValue(java.lang.String fieldName)
          Returns the value of the specified field as a byte array.
 Cloud getCloud()
          Returns the cloud this node belongs to.
 java.lang.String getContext()
          Get the security context of the current Node
 double getDoubleValue(java.lang.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(java.lang.String fieldName)
          Returns the value of the specified field as a FieldValue object.
 float getFloatValue(java.lang.String fieldName)
          Returns the value of the specified field as a float.
 FieldValue getFunctionValue(java.lang.String functionName, java.util.List arguments)
          Returns the value of the specified function on the node.
 int getIntValue(java.lang.String fieldName)
          Returns the value of the specified field as an int.
 long getLongValue(java.lang.String fieldName)
          Returns the value of the specified field as a long.
protected  MMObjectNode getNode()
          Obtains a reference to the underlying MMObjectNode.
 NodeManager getNodeManager()
          Returns the node manager for this node.
 Node getNodeValue(java.lang.String fieldName)
          Returns the value of the specified field as a Node.
 int getNumber()
          Returns the unique number for this node.
 java.lang.Object getObjectValue(java.lang.String fieldName)
          Returns the field's value as an object.
 StringList getPossibleContexts()
          Contacts the security implementation to find out to which other possible contextes 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, java.lang.String role, java.lang.String searchDir)
          Returns all related nodes that have a specific node manager and role.
 NodeList getRelatedNodes(java.lang.String type)
          Returns all related nodes that have a specific node manager.
 NodeList getRelatedNodes(java.lang.String type, java.lang.String role, java.lang.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(java.lang.String role)
          Returns all relation nodes attached to this node that have a specific role
 RelationList getRelations(java.lang.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(java.lang.String role, NodeManager nodeManager, java.lang.String searchDir)
           
 RelationList getRelations(java.lang.String role, java.lang.String nodeManager)
          Returns all relation nodes attached to this node that have a specific role, or refer a node from a specific nodemanager
 java.lang.String getStringValue(java.lang.String fieldName)
          Returns the value of the specified field as a String.
 java.lang.Object getValue(java.lang.String fieldName)
          Returns the value of the specified field as an object.
 org.w3c.dom.Document getXMLValue(java.lang.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.
 org.w3c.dom.Element getXMLValue(java.lang.String fieldName, org.w3c.dom.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.
protected  void init()
          Initializes the node.
protected  void invalidateNode()
          Invalidates the reference to the underlying MMObjectNode, replacing it with a virtual node that only inherits the number field.
 boolean isNodeManager()
          Determine whether this Node is a NodeManager.
 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(java.lang.String fieldName, boolean value)
          Sets the value of the specified field using an boolean.
 void setByteValue(java.lang.String fieldName, byte[] value)
          Sets the value of the specified field using a byte array.
 void setContext(java.lang.String context)
          Sets the security context of this Node (AKA the 'owner' field)
 void setDoubleValue(java.lang.String fieldName, double value)
          Sets the value of the specified field using a double.
 void setFloatValue(java.lang.String fieldName, float value)
          Sets the value of the specified field using a float.
 void setIntValue(java.lang.String fieldName, int value)
          Sets the value of the specified field using an int.
 void setLongValue(java.lang.String fieldName, long value)
          Sets the value of the specified field using a long.
protected  void setNode(MMObjectNode n)
          Sets the reference to the underlying MMObjectNode.
 void setNodeValue(java.lang.String fieldName, Node value)
          Sets the value of the specified field using an Node.
 void setObjectValue(java.lang.String fieldName, java.lang.Object value)
          Sets the value of the specified field using an object.
 void setStringValue(java.lang.String fieldName, java.lang.String value)
          Sets the value of the specified field using a String.
 void setValue(java.lang.String fieldName, java.lang.Object value)
          Setting value with default method (depending on field's type)
protected  void setValueWithoutChecks(java.lang.String fieldName, java.lang.Object value)
          Protected method to be able to set rnumber when creating a relation.
protected  void setValueWithoutProcess(java.lang.String fieldName, java.lang.Object value)
          Like setValue, but withouth the valueinterceptor, this is called by nthe other set-values.
 void setXMLValue(java.lang.String fieldName, org.w3c.dom.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.
 java.lang.String toString()
          Converts the node to a string
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTION_CREATE

public static final int ACTION_CREATE
See Also:
Constant Field Values

ACTION_EDIT

public static final int ACTION_EDIT
See Also:
Constant Field Values

ACTION_DELETE

public static final int ACTION_DELETE
See Also:
Constant Field Values

ACTION_COMMIT

public static final int ACTION_COMMIT
See Also:
Constant Field Values

nodeManager

protected NodeManager nodeManager
Reference to the NodeManager

Warning: Scope will be changed to:
private

cloud

protected BasicCloud cloud
Reference to the Cloud.

Warning: Scope will be changed to:
private

mmb

protected MMBase mmb
Reference to MMBase root.

Warning: Scope will be changed to:
private

noderef

protected MMObjectNode noderef
Reference to actual MMObjectNode object.

Warning: Scope will be changed to:
private

temporaryNodeId

protected int temporaryNodeId
Temporary node ID. This is necessary since there is otherwise no sure (and quick) way to determine whether a node is in 'edit' mode (i.e. has a temporary node). Basically, a temporarynodeid is either -1 (invalid), or a negative number smaller than -1 (a temporary number assigend by the system).

Warning: Scope will be changed to:
private

account

protected java.lang.String account
The account this node is edited under. This is needed to check whether people have not switched users during an edit.

Warning: Scope will be changed to:
private

isnew

protected boolean isnew
Determines whether this node was created for insert.

Warning: Scope will be changed to:
private
Method Detail

init

protected void init()
Initializes the node. Determines nodemanager and cloud (depending on information available), Sets references to MMBase modules and initializes state in case of a transaction.


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

getByteSize

public int getByteSize()
Description copied from interface: SizeMeasurable
Determins the byte-size of this object

Specified by:
getByteSize in interface SizeMeasurable

getByteSize

public int getByteSize(SizeOf sizeof)
Description copied from interface: SizeMeasurable
Determins the byte-size of this object using the given SizeOf instance. A SizeOf instance stores a Set already counted objects. So this method is typically called by SizeOf itself (recursion).

Specified by:
getByteSize in interface SizeMeasurable

getNode

protected final MMObjectNode getNode()
                              throws NotFoundException
Obtains a reference to the underlying MMObjectNode. If the underlying node was deleted, this returns a virtual node with no info except the (original) node number.

Returns:
the underlying MMObjectNode
Throws:
NotFoundException - if no node was specified. This generally means the

invalidateNode

protected void invalidateNode()
Invalidates the reference to the underlying MMObjectNode, replacing it with a virtual node that only inherits the number field.

Since:
MMBase-1.6.4

setNode

protected void setNode(MMObjectNode n)
Sets the reference to the underlying MMObjectNode.

Parameters:
n - the node to set a reference to.
Throws:
java.lang.IllegalArgumentException - is n is null
Since:
MMBase-1.6.4

getCloud

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

Specified by:
getCloud in interface Node

getNodeManager

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

Specified by:
getNodeManager 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)

edit

protected void edit(int action)
Edit this node. Check whether edits are allowed and prepare a node for edits if needed. The type of edit is determined by the action specified, and one of:
ACTION_CREATE (create a node),
ACTION_EDIT (edit node, or change aliasses),
ACTION_DELETE (delete node),
ACTION_COMMIT (commit a node after changes)

Parameters:
action - The action to perform.

setValue

public void setValue(java.lang.String fieldName,
                     java.lang.Object value)
Setting value with default method (depending on field's type)

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

protected void setValueWithoutProcess(java.lang.String fieldName,
                                      java.lang.Object value)
Like setValue, but withouth the valueinterceptor, this is called by nthe other set-values.

Since:
MMBase-1.7
To Do:
setting certain specific fields (i.e. snumber) should be directed to a dedicated method such as setSource(), where applicable.

setValueWithoutChecks

protected void setValueWithoutChecks(java.lang.String fieldName,
                                     java.lang.Object value)
Protected method to be able to set rnumber when creating a relation.

Since:
MMBase-1.7

setObjectValue

public void setObjectValue(java.lang.String fieldName,
                           java.lang.Object value)
Description copied from interface: Node
Sets the value of the specified field using an object.

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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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

setLongValue

public void setLongValue(java.lang.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(java.lang.String fieldName,
                           java.lang.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

setXMLValue

public void setXMLValue(java.lang.String fieldName,
                        org.w3c.dom.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.

getValue

public java.lang.Object getValue(java.lang.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

getObjectValue

public java.lang.Object getObjectValue(java.lang.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

getBooleanValue

public boolean getBooleanValue(java.lang.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 concidered 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(java.lang.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 teh number, which is what it normally holds).
Mosty, this call is used in cluster nodes (nodes retrived 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(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)

getIntValue

public int getIntValue(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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

getStringValue

public java.lang.String getStringValue(java.lang.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

getFieldValue

public FieldValue getFieldValue(java.lang.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

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

getFunctionValue

public FieldValue getFunctionValue(java.lang.String functionName,
                                   java.util.List arguments)
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 - the name of the function to be executed
arguments - parameters to the function
Returns:
the function value of the specified function

getXMLValue

public org.w3c.dom.Document getXMLValue(java.lang.String fieldName)
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. 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
Returns:
the value of the specified field as a DOM Element or null

getXMLValue

public org.w3c.dom.Element getXMLValue(java.lang.String fieldName,
                                       org.w3c.dom.Document tree)
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

commit

public void commit()
Description copied from interface: Node
Commit the node to the database. 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

delete

public void delete()
Description copied from interface: Node
Removes the Node. Throws an exception if 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 java.lang.String toString()
Description copied from interface: Node
Converts the node to a string

Specified by:
toString in interface Node

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(java.lang.String type)
                     throws NotFoundException
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:
type - the name of the relation manager the removed relation nodes should have
Throws:
NotFoundException

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(java.lang.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(java.lang.String role,
                                 java.lang.String nodeManager)
                          throws NotFoundException
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
Throws:
NotFoundException

getRelations

public RelationList getRelations(java.lang.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(java.lang.String role,
                                 NodeManager nodeManager,
                                 java.lang.String searchDir)
                          throws NotFoundException
Specified by:
getRelations in interface Node
Throws:
NotFoundException
See Also:
Should perhaps be implemented with that

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

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(java.lang.String type)
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
Returns:
the number of relation nodes attached to this node that have a specific relation manager

countRelatedNodes

public int countRelatedNodes(NodeManager otherNodeManager,
                             java.lang.String role,
                             java.lang.String direction)
Specified by:
countRelatedNodes in interface Node

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(java.lang.String type)
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:
type - 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(NodeManager nodeManager,
                                java.lang.String role,
                                java.lang.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
Since:
MMBase-1.6
See Also:
Should perhaps be implemented with that.

getRelatedNodes

public NodeList getRelatedNodes(java.lang.String type,
                                java.lang.String role,
                                java.lang.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:
type - 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

countRelatedNodes

public int countRelatedNodes(java.lang.String type)
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
Returns:
the number of related nodes that have a specific node manager

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(java.lang.String aliasName)
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:
aliasName - the alias to be created for this node

deleteAlias

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

Specified by:
deleteAlias in interface Node
Parameters:
aliasName - 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(java.lang.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 java.lang.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 contextes the context of this node may be set.

Specified by:
getPossibleContexts in interface Node
Returns:
A StringList containing the contextes 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

finalize

protected void finalize()
Reverse the buffers, when changed and not stored...


compareTo

public int compareTo(java.lang.Object o)
Compares this node to the passed object. Returns 0 if they are equal, -1 if the object passed is a NodeManager and larger than this manager, and +1 if the object passed is a NodeManager and smaller than this manager. This is used to sort Nodes. A node is 'larger' than another node if its GUI() result is larger (alphabetically, case sensitive) than that of the other node. If the GUI() results are the same, the nodes are compared on number, and (if needed) on their owning clouds.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - the object to compare it with

hashCode

public int hashCode()
Since:
MMBase-1.6.2

equals

public boolean equals(java.lang.Object o)
Compares two nodes, and returns true if they are equal. This effectively means that both objects are nodes, and they both have the same number and cloud

Parameters:
o - the object to compare it with


MMBase build 1.7.4.20050922