org.mmbase.bridge.implementation
Class BasicNode

java.lang.Object
  extended by org.mmbase.bridge.util.AbstractNode
      extended by org.mmbase.bridge.implementation.BasicNode
All Implemented Interfaces:
Comparable<Node>, Node, SizeMeasurable
Direct Known Subclasses:
BasicNodeManager, BasicRelation

public class BasicNode
extends AbstractNode
implements Node, SizeMeasurable

Basic implementation of Node. Wraps MMObjectNodes, adds security.

Version:
$Id: BasicNode.java 41869 2010-04-13 10:12:28Z michiel $
Author:
Rob Vermeulen, Pierre van Rooden, Michiel Meeuwissen
See Also:
Node, MMObjectNode
To Do:
This class has large overlap with VirtualNode. They probably should share an ancestor (AbstractBasicNode or so) (MMB-1870)

Field Summary
protected  BasicCloud cloud
          Reference to the Cloud.
protected  BasicNodeManager nodeManager
          Reference to the NodeManager
protected  MMObjectNode noderef
          Reference to actual MMObjectNode object.
protected  MMObjectNode originalNoderef
           
protected  int temporaryNodeId
          Temporary node ID.
 
Fields inherited from interface org.mmbase.bridge.Node
CLOUD_COMMITNODE_KEY
 
Constructor Summary
BasicNode(BasicCloud cloud)
           
BasicNode(MMObjectNode node, BasicCloud cloud)
          Instantiates a node, linking it to a specified cloud The NodeManager for the node is requested from the Cloud.
BasicNode(MMObjectNode node, BasicCloud cloud, int id)
          Instantiates a new node (for insert), using a specified nodeManager.
BasicNode(MMObjectNode node, BasicNodeManager nodeManager)
          Instantiates a node, linking it to a specified node manager.
 
Method Summary
 void cancel()
          Cancel changes to a node This fails if the current node is not in edit mode.
protected  void checkAccount()
           
protected  void checkCommit()
           
protected  void checkCreate()
           
protected  void checkDelete()
           
protected  void checkWrite()
          Throws exception if may not write current node
 void commit()
          Commit the node to the database.
 int countRelatedNodes(NodeManager otherNodeManager, String role, String direction)
           
 int countRelatedNodes(String type)
          Returns the number of related nodes that have a specific node manager.
 void createAlias(String aliasName)
          Create an alias for this node.
protected  FieldValue createFunctionValue(Object result)
           
 Parameters createParameters(String functionName)
          Creates a parameter list for a function.
 void delete(boolean deleteRelations)
          Removes the Node.
 void deleteAlias(String aliasName)
          Delete an alias for this node.
 void deleteRelations(String type)
          Removes all relation nodes with a certain relation manager that are attached to this node.
protected  void finalize()
          Reverse the buffers, when changed and not stored...
 StringList getAliases()
          Returns all aliases for this node.
 boolean getBooleanValue(String fieldName)
          Returns the value of the specified field as a boolean.
 int getByteSize()
          Determines the byte-size of this object
 int getByteSize(SizeOf sizeof)
          Determines the byte-size of this object using the given SizeOf instance.
 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)
           
 double getDoubleValue(String fieldName)
          Returns the value of the specified field as a double.
 float getFloatValue(String fieldName)
          Returns the value of the specified field as a float.
 Collection<Function<?>> getFunctions()
          This default implementation is based on Node.getNodeManager().Node.getFunctions().
 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.
protected  MMObjectNode getNode()
          Obtains a reference to the underlying MMObjectNode.
protected  Function<?> getNodeFunction(String functionName)
          Based on getFunctions.
 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.
 StringList getPossibleContexts()
          Contacts the security implementation to find out to which other possible contexts the context of this node may be set.
protected  NodeList getRelatedNodes(NodeManager otherManager, String role)
          Get related nodes for this node
 NodeList getRelatedNodes(NodeManager otherManager, String role, String searchDir)
          Returns all related nodes that have a specific node manager and role.
 RelationList getRelations(String role, NodeManager nodeManager, String searchDir)
          Returns a list of relations of the given node.
 RelationList getRelations(String role, String otherNodeManager)
          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 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.
 boolean hasRelations()
          Checks whether this node has any relations.
protected  void init()
          Initializes state in case of a transaction.
protected  void invalidateNode()
          Invalidates the reference to the underlying MMObjectNode, replacing it with a virtual node that only inherits the number field.
 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()
          Returns whether this is a new (not yet committed) node.
 boolean isNull(String fieldName)
          Whether the value for the specified field is null.
 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 setContext(String context)
          Sets the security context of this Node (AKA the 'owner' field)
protected  void setNode(MMObjectNode n)
          Sets the reference to the underlying MMObjectNode.
protected  void setNodeManager(MMObjectNode node)
          Set nodemanager for node
 void setNodeManager(NodeManager nm)
          Sets the node manager of this node.
protected  void setSize(String fieldName, long size)
           
protected  void setValueWithoutChecks(String fieldName, Object value)
          Protected method to be able to set rnumber when creating a relation.
protected  Integer toNodeNumber(Object v)
          A method to convert an object to an node number.
 String toString()
          Converts the node to a string
 
Methods inherited from class org.mmbase.bridge.util.AbstractNode
compareTo, countRelations, countRelations, createRelation, delete, deleteRelations, equals, getDecimalValue, getFieldValue, getFieldValue, getFunction, getFunctionMap, getFunctionValue, getObjectValue, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getValue, getXMLValue, hashCode, isNodeManager, isRelation, isRelationManager, processNull, setBooleanValue, setByteValue, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, toNodeManager, toRelation, toRelationManager, validate
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.bridge.Node
countRelations, countRelations, createRelation, delete, deleteRelations, getDecimalValue, getFieldValue, getFieldValue, getFunction, getFunctionValue, getObjectValue, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getValue, getXMLValue, isNodeManager, isRelation, isRelationManager, setBooleanValue, setByteValue, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, toNodeManager, toRelation, toRelationManager, validate
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

nodeManager

protected BasicNodeManager nodeManager
Reference to the NodeManager


cloud

protected final BasicCloud cloud
Reference to the Cloud.


noderef

protected MMObjectNode noderef
Reference to actual MMObjectNode object.


originalNoderef

protected MMObjectNode originalNoderef

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 assigned by the system).

Constructor Detail

BasicNode

BasicNode(BasicCloud cloud)

BasicNode

BasicNode(MMObjectNode node,
          BasicNodeManager nodeManager)
Instantiates a node, linking it to a specified node manager. Use this constructor if the node you create uses a NodeManager that is not readily available from the cloud (such as a temporary nodemanager for a result list).

Parameters:
node - the MMObjectNode to base the node on
nodeManager - the NodeManager to use for administrating this Node
Throws:
IllegalArgumentException - If node is null

BasicNode

BasicNode(MMObjectNode node,
          BasicCloud cloud)
Instantiates a node, linking it to a specified cloud The NodeManager for the node is requested from the Cloud.

Parameters:
node - the MMObjectNode to base the node on
cloud - the cloud to which this node belongs
Throws:
IllegalArgumentException - If node is null

BasicNode

BasicNode(MMObjectNode node,
          BasicCloud cloud,
          int id)
Instantiates a new node (for insert), using a specified nodeManager.

Parameters:
node - a temporary MMObjectNode that is the base for the node
cloud - the cloud to create the node in
id - the id of the node in the temporary cloud
Method Detail

setNodeManager

protected void setNodeManager(MMObjectNode node)
Set nodemanager for node

Parameters:
node - node to derive nodemanager from.
Since:
MMBase-1.8

init

protected void init()
Initializes state in case of a transaction.


getByteSize

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

Specified by:
getByteSize in interface SizeMeasurable

getByteSize

public int getByteSize(SizeOf sizeof)
Description copied from interface: SizeMeasurable
Determines 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()
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.

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:
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
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
Overrides:
setNodeManager in class AbstractNode

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
Overrides:
getNumber in class AbstractNode
Returns:
the unique number for this node
See Also:
Node.createAlias(String alias)

isNew

public boolean isNew()
Returns whether this is a new (not yet committed) node.

Specified by:
isNew in interface Node
Overrides:
isNew in class AbstractNode
Returns:
is a new node

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
Overrides:
isChanged in class AbstractNode
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
Overrides:
isChanged in class AbstractNode
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
Overrides:
getChanged in class AbstractNode
Returns:
Set of changed fields

checkAccount

protected void checkAccount()

checkDelete

protected void checkDelete()

checkWrite

protected void checkWrite()
Description copied from class: AbstractNode
Throws exception if may not write current node

Overrides:
checkWrite in class AbstractNode

checkCreate

protected void checkCreate()

checkCommit

protected void checkCommit()

setValueWithoutChecks

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

Specified by:
setValueWithoutChecks in class AbstractNode
Parameters:
fieldName - name of field
value - new value of field
Since:
MMBase-1.7

toNodeNumber

protected Integer toNodeNumber(Object v)
Description copied from class: AbstractNode
A method to convert an object to an node number. Default impelmentation is reasonable, but does not support core objects.

Overrides:
toNodeNumber in class AbstractNode

setSize

protected void setSize(String fieldName,
                       long size)
Specified by:
setSize in class AbstractNode

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
Overrides:
isNull in class AbstractNode
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'

getValueWithoutProcess

public Object getValueWithoutProcess(String fieldName)
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:
the value without processing
Since:
MMBase-1.8

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
Overrides:
getBooleanValue in class AbstractNode
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
Overrides:
getDateValue in class AbstractNode
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
Overrides:
getListValue in class AbstractNode
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
Overrides:
getNodeValue in class AbstractNode
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
Overrides:
getIntValue in class AbstractNode
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
Overrides:
getFloatValue in class AbstractNode
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
Overrides:
getLongValue in class AbstractNode
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
Overrides:
getDoubleValue in class AbstractNode
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
Overrides:
getByteValue in class AbstractNode
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
Overrides:
getInputStreamValue in class AbstractNode
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
Overrides:
getStringValue in class AbstractNode
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field

getXMLValue

public Document getXMLValue(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. 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
Overrides:
getXMLValue in class AbstractNode
Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field as a DOM Element or null

commit

public void commit()
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. This implementation checks create rights, then validates the values, then processes the 'commit processors' and then calls BasicCloud.afterCommit(BasicNode)

Specified by:
commit in interface Node
Overrides:
commit in class AbstractNode

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
Overrides:
cancel in class AbstractNode

delete

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

Specified by:
delete in interface Node
Overrides:
delete in class AbstractNode
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

deleteRelations

public void deleteRelations(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
Overrides:
deleteRelations in class AbstractNode
Parameters:
type - the name of the relation manager the removed relation nodes should have
Throws:
NotFoundException

getRelations

public RelationList getRelations(String role,
                                 String otherNodeManager)
                          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
Overrides:
getRelations in class AbstractNode
Parameters:
role - the name of the role the returned relation nodes should have
otherNodeManager - 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(String role,
                                 NodeManager nodeManager,
                                 String searchDir)
                          throws NotFoundException
Returns a list of relations of the given node.

Specified by:
getRelations in interface Node
Overrides:
getRelations in class AbstractNode
Parameters:
role - role of the relation
nodeManager - node manager on the other side of the relation
searchDir - direction of the relation
Returns:
list of relations
Throws:
NotFoundException - See Queries.createRelationNodesQuery(Node, NodeManager, String, String) 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
Overrides:
hasRelations in class AbstractNode
Returns:
true if the node has relations

countRelatedNodes

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

getRelatedNodes

protected NodeList getRelatedNodes(NodeManager otherManager,
                                   String role)
Get related nodes for this node

Parameters:
otherManager - nodemanager on the other side of the relation
role - name of the relation
Returns:
List of related nodes
Since:
MMBase-1.8.2

getRelatedNodes

public NodeList getRelatedNodes(NodeManager otherManager,
                                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
Overrides:
getRelatedNodes in class AbstractNode
Parameters:
otherManager - node manager on the other side of the relation
role - role of the relation
searchDir - direction of the relation
Returns:
List of related nodes
Since:
MMBase-1.6
See Also:
Should perhaps be implemented with that.

countRelatedNodes

public int countRelatedNodes(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
Overrides:
countRelatedNodes in class AbstractNode
Parameters:
type - the name of the node manager the counted nodes should have
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
Overrides:
getAliases in class AbstractNode
Returns:
a list of alias names for this node

createAlias

public void createAlias(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
Overrides:
createAlias in class AbstractNode
Parameters:
aliasName - the alias to be created for this node

deleteAlias

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

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

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
Overrides:
setContext in class AbstractNode
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
Overrides:
getContext in class AbstractNode
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
Overrides:
getPossibleContexts in class AbstractNode
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
Overrides:
mayWrite in class AbstractNode
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
Overrides:
mayDelete in class AbstractNode
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
Overrides:
mayChangeContext in class AbstractNode
Returns:
Whether the current user may change the context of this node

finalize

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

Overrides:
finalize in class Object

getFunctions

public Collection<Function<?>> getFunctions()
Description copied from class: AbstractNode
This default implementation is based on Node.getNodeManager().Node.getFunctions().

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

getNodeFunction

protected Function<?> getNodeFunction(String functionName)
Description copied from class: AbstractNode
Based on getFunctions.

Overrides:
getNodeFunction in class AbstractNode

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
Overrides:
createParameters in class AbstractNode
Parameters:
functionName - name of the function
Returns:
a Parameters object.

createFunctionValue

protected FieldValue createFunctionValue(Object result)
Overrides:
createFunctionValue in class AbstractNode


MMBase 2.0-SNAPSHOT - null