public class VirtualNode extends AbstractNode implements Node, Serializable
BasicNode, and therefore has a public constructor
VirtualNode(org.mmbase.module.core.VirtualNode, Cloud).Node,
VirtualNode,
Serialized FormBasicNode. They probably should share an ancestor (AbstractBasicNode or so). (MMB-1870)| Modifier and Type | Field and Description |
|---|---|
protected Cloud |
cloud |
protected NodeManager |
nodeManager
This is normally, but not always, a VirtualBuilder.
|
protected VirtualNode |
noderef |
CLOUD_COMMITNODE_KEY| Modifier | Constructor and Description |
|---|---|
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) |
| Modifier and Type | Method and Description |
|---|---|
protected FieldValue |
createFunctionValue(Object result) |
Parameters |
createParameters(String functionName)
Creates a parameter list for a function.
|
protected void |
edit(int action) |
protected org.mmbase.bridge.implementation.VirtualNode.NodeAndField |
getActualNodeForField(String fieldName) |
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. |
Cloud |
getCloud()
Returns the cloud this node belongs to.
|
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
AbstractNode.getFunctions(). |
NodeManager |
getNodeManager()
Returns the node manager for this node.
|
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()
Returns the unique number for this node.
|
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.
|
protected static VirtualNode |
getVirtualNode(Map<String,?> values) |
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 |
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.
|
void |
setSize(String fieldName,
long size) |
protected void |
setValueWithoutChecks(String fieldName,
Object value) |
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
|
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, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitcancel, 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, validatecompareToprotected final VirtualNode noderef
protected transient NodeManager nodeManager
protected final Cloud cloud
protected VirtualNode(Cloud cloud, VirtualNode node, NodeManager nm)
public VirtualNode(VirtualNode node, Cloud cloud)
public VirtualNode(Map<String,?> values, Cloud cloud)
MapNode, which is a complete reimplementation (with no core dependencies).public String toString()
Nodeprotected static VirtualNode getVirtualNode(Map<String,?> values)
public VirtualNode getNodeRef()
public boolean isRelation()
NodeisRelation in interface NodeisRelation in class AbstractNodetrue if this Node is a Relation.public Relation toRelation()
NodetoRelation in interface NodetoRelation in class AbstractNodeRelation objectpublic boolean isNodeManager()
NodeisNodeManager in interface NodeisNodeManager in class AbstractNodetrue if this Node is a NodeManager.public NodeManager toNodeManager()
NodetoNodeManager in interface NodetoNodeManager in class AbstractNodeNodeManager objectpublic boolean isRelationManager()
NodeisRelationManager in interface NodeisRelationManager in class AbstractNodetrue if this Node is a RelationManager.public RelationManager toRelationManager()
NodetoRelationManager in interface NodetoRelationManager in class AbstractNodeNodeManager objectprotected final MMObjectNode getNode()
NotFoundException - if no node was specified. This generally means thepublic Cloud getCloud()
Nodepublic NodeManager getNodeManager()
NodegetNodeManager in interface Nodepublic int getNumber()
NodegetNumber in interface NodegetNumber in class AbstractNodeNode.createAlias(String alias)protected void edit(int action)
public boolean isNull(String fieldName)
Nodenull. This avoids acquiring the
complete value if you only want to check if for emptiness.isNull in interface NodeisNull in class AbstractNodefieldName - the name of the fieldtrue when value is nullpublic void setSize(String fieldName, long size)
setSize in class AbstractNodepublic long getSize(String fieldName)
Nodeprotected org.mmbase.bridge.implementation.VirtualNode.NodeAndField getActualNodeForField(String fieldName)
protected void setValueWithoutChecks(String fieldName, Object value)
setValueWithoutChecks in class AbstractNodepublic Object getValueWithoutProcess(String fieldName)
NodegetValueWithoutProcess in interface NodefieldName - name of fieldpublic boolean getBooleanValue(String fieldName)
Nodeboolean.
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.getBooleanValue in interface NodegetBooleanValue in class AbstractNodefieldName - the name of the field to be returnedpublic Date getDateValue(String fieldName)
getDateValue in interface NodegetDateValue in class AbstractNodefieldName - the name of the field to be returnedpublic List getListValue(String fieldName)
getListValue in interface NodegetListValue in class AbstractNodefieldName - the name of the field to be returnedpublic Node getNodeValue(String fieldName)
null
because the node can have been deleted.getNodeValue in interface NodegetNodeValue in class AbstractNodefieldName - the name of the field to be returnedCloud.getList(String, String, String, String, String, String, String, boolean)public int getIntValue(String fieldName)
Nodeint.
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 -1getIntValue in interface NodegetIntValue in class AbstractNodefieldName - the name of the field to be returnedpublic float getFloatValue(String fieldName)
Nodefloat.
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.getFloatValue in interface NodegetFloatValue in class AbstractNodefieldName - the name of the field to be returnedpublic long getLongValue(String fieldName)
Nodelong.
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 -1getLongValue in interface NodegetLongValue in class AbstractNodefieldName - the name of the field to be returnedpublic double getDoubleValue(String fieldName)
Nodedouble.
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.getDoubleValue in interface NodegetDoubleValue in class AbstractNodefieldName - the name of the field to be returnedpublic byte[] getByteValue(String fieldName)
Nodebyte 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.getByteValue in interface NodegetByteValue in class AbstractNodefieldName - the name of the field to be returnedpublic InputStream getInputStreamValue(String fieldName)
Nodejava.io.InputStream This is
especially useful for large byte-array fields. By this you can avoid them to be completely
stored in memory.getInputStreamValue in interface NodegetInputStreamValue in class AbstractNodefieldName - the name of the fieldpublic String getStringValue(String fieldName)
NodeString.
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.getStringValue in interface NodegetStringValue in class AbstractNodefieldName - the name of the field to be returnedpublic Document getXMLValue(String fieldName)
Nodedom.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 nullgetXMLValue in interface NodegetXMLValue in class AbstractNodefieldName - the name of the field to be returnednullpublic Collection<Function<?>> getFunctions()
AbstractNodeNode.getNodeManager().Node.getFunctions().getFunctions in interface NodegetFunctions in class AbstractNodeFunction objects.protected Function<?> getNodeFunction(String functionName)
AbstractNodeAbstractNode.getFunctions().getNodeFunction in class AbstractNodepublic Parameters createParameters(String functionName)
NodecreateParameters in interface NodecreateParameters in class AbstractNodefunctionName - name of the functionParameters object.protected FieldValue createFunctionValue(Object result)
createFunctionValue in class AbstractNodeMMBase 1.9-SNAPSHOT - ${javadoctimestamp}