|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.bridge.util.AbstractNode
org.mmbase.bridge.implementation.VirtualNode
public class VirtualNode
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).
Node,
VirtualNode,
Serialized FormBasicNode. 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)
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 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 |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.lang.Comparable |
|---|
compareTo |
| Field Detail |
|---|
protected final VirtualNode noderef
protected transient NodeManager nodeManager
protected final Cloud cloud
| Constructor Detail |
|---|
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).
| Method Detail |
|---|
public String toString()
Node
toString in interface NodetoString in class Objectprotected static VirtualNode getVirtualNode(Map<String,?> values)
public VirtualNode getNodeRef()
public boolean isRelation()
Node
isRelation in interface NodeisRelation in class AbstractNodetrue if this Node is a Relation.public Relation toRelation()
Node
toRelation in interface NodetoRelation in class AbstractNodeRelation objectpublic boolean isNodeManager()
Node
isNodeManager in interface NodeisNodeManager in class AbstractNodetrue if this Node is a NodeManager.public NodeManager toNodeManager()
Node
toNodeManager in interface NodetoNodeManager in class AbstractNodeNodeManager objectpublic boolean isRelationManager()
Node
isRelationManager in interface NodeisRelationManager in class AbstractNodetrue if this Node is a RelationManager.public RelationManager toRelationManager()
Node
toRelationManager in interface NodetoRelationManager in class AbstractNodeNodeManager objectprotected final MMObjectNode getNode()
NotFoundException - if no node was specified. This generally means thepublic Cloud getCloud()
Node
getCloud in interface Nodepublic NodeManager getNodeManager()
Node
getNodeManager in interface Nodepublic int getNumber()
Node
getNumber 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 field
true when value is null
public void setSize(String fieldName,
long size)
setSize in class AbstractNodepublic long getSize(String fieldName)
Node
getSize in interface NodefieldName - the name of the field
protected org.mmbase.bridge.implementation.VirtualNode.NodeAndField getActualNodeForField(String fieldName)
protected void setValueWithoutChecks(String fieldName,
Object value)
setValueWithoutChecks in class AbstractNodepublic Object getValueWithoutProcess(String fieldName)
Node
getValueWithoutProcess in interface NodefieldName - name of field
public 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 returned
public Date getDateValue(String fieldName)
getDateValue in interface NodegetDateValue in class AbstractNodefieldName - the name of the field to be returned
public List getListValue(String fieldName)
getListValue in interface NodegetListValue in class AbstractNodefieldName - the name of the field to be returned
public 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 returned
Cloud.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 -1
getIntValue in interface NodegetIntValue in class AbstractNodefieldName - the name of the field to be returned
public 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 returned
public 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 -1
getLongValue in interface NodegetLongValue in class AbstractNodefieldName - the name of the field to be returned
public 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 returned
public 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 returned
public 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 field
public 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 returned
public 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 null
getXMLValue in interface NodegetXMLValue in class AbstractNodefieldName - the name of the field to be returned
nullpublic Collection<Function<?>> getFunctions()
AbstractNodeNode.getNodeManager().Node.getFunctions().
getFunctions in interface NodegetFunctions in class AbstractNodeFunction objects.protected Function<?> getNodeFunction(String functionName)
AbstractNodegetFunctions.
getNodeFunction in class AbstractNodepublic Parameters createParameters(String functionName)
Node
createParameters in interface NodecreateParameters in class AbstractNodefunctionName - name of the function
Parameters object.protected FieldValue createFunctionValue(Object result)
createFunctionValue in class AbstractNode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||