org.mmbase.bridge.implementation
Class VirtualNode

Package class diagram package VirtualNode
java.lang.Object
  extended by org.mmbase.bridge.util.AbstractNode
      extended by org.mmbase.bridge.implementation.VirtualNode
All Implemented Interfaces:
Serializable, Comparable<Node>, Node

public class VirtualNode
extends AbstractNode
implements Node, Serializable

Implementation of Node. Simply wraps virtual node of core into an bridge Node. This class can be used even if you don't know the precise implementation of the Cloud object (in contradiction to BasicNode, and therefore has a public constructor VirtualNode(org.mmbase.module.core.VirtualNode, Cloud).

Since:
MMBase-1.8
Version:
$Id: VirtualNode.java 45315 2011-02-18 20:23:11Z michiel $
Author:
Michiel Meeuwissen
See Also:
Node, VirtualNode, Serialized Form
To Do:
This class has large overlap with BasicNode. They probably should share an ancestor (AbstractBasicNode or so). (MMB-1870)

Field Summary
protected  Cloud cloud
           
protected  NodeManager nodeManager
          This is normally, but not always, a VirtualBuilder.
protected  VirtualNode noderef
           
 
Fields inherited from interface org.mmbase.bridge.Node
CLOUD_COMMITNODE_KEY
 
Constructor Summary
protected VirtualNode(Cloud cloud, VirtualNode node, NodeManager nm)
           
  VirtualNode(Map<String,?> values, Cloud cloud)
          Makes a Node from a map of values.
  VirtualNode(VirtualNode node, Cloud cloud)
           
 
Method Summary
protected  FieldValue createFunctionValue(Object result)
           
 Parameters createParameters(String functionName)
           
protected  void edit(int action)
           
protected  org.mmbase.bridge.implementation.VirtualNode.NodeAndField getActualNodeForField(String fieldName)
           
 boolean getBooleanValue(String fieldName)
           
 byte[] getByteValue(String fieldName)
           
 Cloud getCloud()
           
 Date getDateValue(String fieldName)
           
 double getDoubleValue(String fieldName)
           
 float getFloatValue(String fieldName)
           
 Collection<Function<?>> getFunctions()
           
 InputStream getInputStreamValue(String fieldName)
           
 int getIntValue(String fieldName)
           
 List getListValue(String fieldName)
           
 long getLongValue(String fieldName)
           
protected  MMObjectNode getNode()
          Obtains a reference to the underlying MMObjectNode.
protected  Function<?> getNodeFunction(String functionName)
           
 NodeManager getNodeManager()
           
 VirtualNode getNodeRef()
          Returns the MMObjectNode on which the VirtualNode was based
 Node getNodeValue(String fieldName)
          Returns the Node value of a certain field, but in the case of a VirtualNode this can also occasionally be null because the node can have been deleted.
 int getNumber()
           
 long getSize(String fieldName)
           
 String getStringValue(String fieldName)
           
 Object getValueWithoutProcess(String fieldName)
           
protected static VirtualNode getVirtualNode(Map<String,?> values)
           
 Document getXMLValue(String fieldName)
           
 boolean isNodeManager()
           
 boolean isNull(String fieldName)
           
 boolean isRelation()
           
 boolean isRelationManager()
           
 void setSize(String fieldName, long size)
           
protected  void setValueWithoutChecks(String fieldName, Object value)
           
 NodeManager toNodeManager()
           
 Relation toRelation()
           
 RelationManager toRelationManager()
           
 String toString()
           
 
Methods inherited from class org.mmbase.bridge.util.AbstractNode
cancel, checkWrite, commit, compareTo, countRelatedNodes, countRelatedNodes, countRelations, countRelations, createAlias, createRelation, delete, delete, deleteAlias, deleteRelations, deleteRelations, equals, getAliases, getChanged, getContext, getDecimalValue, getFieldValue, getFieldValue, getFunction, getFunctionMap, getFunctionValue, getObjectValue, getPossibleContexts, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getRelations, getRelations, getValue, getXMLValue, hashCode, hasRelations, isChanged, isChanged, isNew, mayChangeContext, mayDelete, mayWrite, processNull, setBooleanValue, setByteValue, setContext, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeManager, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, toNodeNumber, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.bridge.Node
cancel, commit, countRelatedNodes, countRelatedNodes, countRelations, countRelations, createAlias, createRelation, delete, delete, deleteAlias, deleteRelations, deleteRelations, getAliases, getChanged, getContext, getDecimalValue, getFieldValue, getFieldValue, getFunction, getFunctionValue, getObjectValue, getPossibleContexts, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getRelations, getRelations, getValue, getXMLValue, hasRelations, isChanged, isChanged, isNew, mayChangeContext, mayDelete, mayWrite, setBooleanValue, setByteValue, setContext, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeManager, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, validate
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

noderef

protected final VirtualNode noderef

nodeManager

protected transient NodeManager nodeManager
This is normally, but not always, a VirtualBuilder. It is not for some builders which have besides real nodes also virtual nodes, like typedef (cluster nodes) and typerel (allowed relations because of inheritance).


cloud

protected final Cloud cloud
Constructor Detail

VirtualNode

protected VirtualNode(Cloud cloud,
                      VirtualNode node,
                      NodeManager nm)

VirtualNode

public VirtualNode(VirtualNode node,
                   Cloud cloud)

VirtualNode

public VirtualNode(Map<String,?> values,
                   Cloud cloud)
Makes a Node from a map of values. Sadly, this uses a local MMBase, so you can't use this with e.g. RMMCI, but I didn't feel like reimplementing Node completely.. See MapNode, which is a complete reimplementation (with no core dependencies).

Method Detail

toString

public String toString()
Specified by:
toString in interface Node
Overrides:
toString in class Object

getVirtualNode

protected static VirtualNode getVirtualNode(Map<String,?> values)

getNodeRef

public VirtualNode getNodeRef()
Returns the MMObjectNode on which the VirtualNode was based


isRelation

public boolean isRelation()
Specified by:
isRelation in interface Node
Overrides:
isRelation in class AbstractNode

toRelation

public Relation toRelation()
Specified by:
toRelation in interface Node
Overrides:
toRelation in class AbstractNode

isNodeManager

public boolean isNodeManager()
Specified by:
isNodeManager in interface Node
Overrides:
isNodeManager in class AbstractNode

toNodeManager

public NodeManager toNodeManager()
Specified by:
toNodeManager in interface Node
Overrides:
toNodeManager in class AbstractNode

isRelationManager

public boolean isRelationManager()
Specified by:
isRelationManager in interface Node
Overrides:
isRelationManager in class AbstractNode

toRelationManager

public RelationManager toRelationManager()
Specified by:
toRelationManager in interface Node
Overrides:
toRelationManager in class AbstractNode

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. This generally means the

getCloud

public Cloud getCloud()
Specified by:
getCloud in interface Node

getNodeManager

public NodeManager getNodeManager()
Specified by:
getNodeManager in interface Node

getNumber

public int getNumber()
Specified by:
getNumber in interface Node
Overrides:
getNumber in class AbstractNode

edit

protected void edit(int action)

isNull

public boolean isNull(String fieldName)
Specified by:
isNull in interface Node
Overrides:
isNull in class AbstractNode

setSize

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

getSize

public long getSize(String fieldName)
Specified by:
getSize in interface Node

getActualNodeForField

protected org.mmbase.bridge.implementation.VirtualNode.NodeAndField getActualNodeForField(String fieldName)
Since:
MMBase-1.9.2

setValueWithoutChecks

protected void setValueWithoutChecks(String fieldName,
                                     Object value)
Specified by:
setValueWithoutChecks in class AbstractNode

getValueWithoutProcess

public Object getValueWithoutProcess(String fieldName)
Specified by:
getValueWithoutProcess in interface Node

getBooleanValue

public boolean getBooleanValue(String fieldName)
Specified by:
getBooleanValue in interface Node
Overrides:
getBooleanValue in class AbstractNode

getDateValue

public Date getDateValue(String fieldName)
Specified by:
getDateValue in interface Node
Overrides:
getDateValue in class AbstractNode

getListValue

public List getListValue(String fieldName)
Specified by:
getListValue in interface Node
Overrides:
getListValue in class AbstractNode

getNodeValue

public Node getNodeValue(String fieldName)
Returns the Node value of a certain field, but in the case of a VirtualNode this can also occasionally be null because the node can have been deleted.

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

getIntValue

public int getIntValue(String fieldName)
Specified by:
getIntValue in interface Node
Overrides:
getIntValue in class AbstractNode

getFloatValue

public float getFloatValue(String fieldName)
Specified by:
getFloatValue in interface Node
Overrides:
getFloatValue in class AbstractNode

getLongValue

public long getLongValue(String fieldName)
Specified by:
getLongValue in interface Node
Overrides:
getLongValue in class AbstractNode

getDoubleValue

public double getDoubleValue(String fieldName)
Specified by:
getDoubleValue in interface Node
Overrides:
getDoubleValue in class AbstractNode

getByteValue

public byte[] getByteValue(String fieldName)
Specified by:
getByteValue in interface Node
Overrides:
getByteValue in class AbstractNode

getInputStreamValue

public InputStream getInputStreamValue(String fieldName)
Specified by:
getInputStreamValue in interface Node
Overrides:
getInputStreamValue in class AbstractNode

getStringValue

public String getStringValue(String fieldName)
Specified by:
getStringValue in interface Node
Overrides:
getStringValue in class AbstractNode

getXMLValue

public Document getXMLValue(String fieldName)
Specified by:
getXMLValue in interface Node
Overrides:
getXMLValue in class AbstractNode

getFunctions

public Collection<Function<?>> getFunctions()
Specified by:
getFunctions in interface Node
Overrides:
getFunctions in class AbstractNode

getNodeFunction

protected Function<?> getNodeFunction(String functionName)
Overrides:
getNodeFunction in class AbstractNode

createParameters

public Parameters createParameters(String functionName)
Specified by:
createParameters in interface Node
Overrides:
createParameters in class AbstractNode

createFunctionValue

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


MMBase2 Core 2.0-SNAPSHOT - 2013-03-30T06:36