|
||||||||||
| 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.BasicNode
Basic implementation of Node. Wraps MMObjectNodes, adds security.
Node,
MMObjectNode| Field Summary | |
protected BasicCloud |
cloud
Reference to the Cloud. |
protected BasicNodeManager |
nodeManager
Reference to the NodeManager |
protected MMObjectNode |
noderef
Reference to actual MMObjectNode object. |
| Fields inherited from class org.mmbase.bridge.util.AbstractNode |
ACTION_COMMIT, ACTION_CREATE, ACTION_DELETE, ACTION_EDIT |
| 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 |
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 |
edit(int action)
Edit 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 |
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 |
getFunctions()
Returns all the Function objects of this Node |
InputStream |
getInputStreamValue(String fieldName)
Returns the value of the specified field as a java.io.InputStream This is
especially usefull 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)
|
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. |
NodeList |
getRelatedNodes(NodeManager nodeManager,
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 nodeManager)
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. |
int |
hashCode()
|
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 speficied 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)
|
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 java.lang.Object |
clone, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.lang.Comparable |
compareTo |
| Field Detail |
protected BasicNodeManager nodeManager
protected final BasicCloud cloud
protected MMObjectNode noderef
| Method Detail |
protected void setNodeManager(MMObjectNode node)
protected void init()
public int getByteSize()
SizeMeasurable
getByteSize in interface SizeMeasurablepublic int getByteSize(SizeOf sizeof)
SizeMeasurable
getByteSize in interface SizeMeasurableprotected final MMObjectNode getNode()
NotFoundException - if no node was specified.protected void invalidateNode()
protected void setNode(MMObjectNode n)
n - the node to set a reference to.
IllegalArgumentException - is n is nullpublic Cloud getCloud()
Node
getCloud in interface Nodepublic NodeManager getNodeManager()
Node
getNodeManager in interface Nodepublic int getNumber()
Node
getNumber in interface NodegetNumber in class AbstractNodepublic boolean isNew()
isNew in interface NodeisNew in class AbstractNodepublic boolean isChanged(String fieldName)
Node
isChanged in interface NodeisChanged in class AbstractNodepublic boolean isChanged()
Node
isChanged in interface NodeisChanged in class AbstractNodepublic Set getChanged()
Node
getChanged in interface NodegetChanged in class AbstractNodeprotected void edit(int action)
edit in class AbstractNodeaction - The action to perform.
protected void setValueWithoutChecks(String fieldName,
Object value)
setValueWithoutChecks in class AbstractNodefieldName - name of fieldvalue - new value of fieldprotected Integer toNodeNumber(Object v)
AbstractNode
toNodeNumber in class AbstractNode
protected void setSize(String fieldName,
long size)
setSize in class AbstractNodepublic boolean isNull(String fieldName)
Nodenull. This avoids acquiring the
complete value if you only want to check if for emptyness.
isNull in interface NodeisNull in class AbstractNodepublic long getSize(String fieldName)
Node
getSize in interface Nodepublic Object getValueWithoutProcess(String fieldName)
getValueWithoutProcess 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 AbstractNodepublic Date getDateValue(String fieldName)
getDateValue in interface NodegetDateValue in class AbstractNodepublic List getListValue(String fieldName)
getListValue in interface NodegetListValue in class AbstractNodepublic Node getNodeValue(String fieldName)
NodeNode.
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.null.
null lets the
Node return a reference to itself, regardless of the actual value of the
number field or status of the Node.
getNodeValue in interface NodegetNodeValue in class AbstractNodepublic 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 AbstractNodepublic 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 AbstractNodepublic 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 AbstractNodepublic 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 AbstractNodepublic 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 AbstractNodepublic InputStream getInputStreamValue(String fieldName)
Nodejava.io.InputStream This is
especially usefull for large byte-array fields. By this you can avoid them to be completely
stored in memory.
getInputStreamValue in interface NodegetInputStreamValue in class AbstractNodepublic 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 AbstractNodepublic 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 AbstractNodepublic void commit()
Node
commit in interface Nodecommit in class AbstractNodepublic void cancel()
Node
cancel in interface Nodecancel in class AbstractNodepublic void delete(boolean deleteRelations)
Node
delete in interface Nodedelete in class AbstractNodepublic String toString()
Node
toString in interface Node
public void deleteRelations(String type)
throws NotFoundException
Node
deleteRelations in interface NodedeleteRelations in class AbstractNodeNotFoundException
public RelationList getRelations(String role,
String nodeManager)
throws NotFoundException
Node
getRelations in interface NodegetRelations in class AbstractNodeNotFoundException
public RelationList getRelations(String role,
NodeManager nodeManager,
String searchDir)
throws NotFoundException
getRelations in interface NodegetRelations in class AbstractNoderole - role of the relationnodeManager - node manager on the other side of the relationsearchDir - direction of the relation
NotFoundExceptionShould perhaps be implemented with thatpublic boolean hasRelations()
Node
hasRelations in interface NodehasRelations in class AbstractNode
public int countRelatedNodes(NodeManager otherNodeManager,
String role,
String direction)
countRelatedNodes in interface NodecountRelatedNodes in class AbstractNode
public NodeList getRelatedNodes(NodeManager nodeManager,
String role,
String searchDir)
Node
getRelatedNodes in interface NodegetRelatedNodes in class AbstractNodenodeManager - node manager on the other side of the relationrole - role of the relationsearchDir - direction of the relation
Should perhaps be implemented with that.public int countRelatedNodes(String type)
Node
countRelatedNodes in interface NodecountRelatedNodes in class AbstractNodepublic StringList getAliases()
Node
getAliases in interface NodegetAliases in class AbstractNodepublic void createAlias(String aliasName)
Node
createAlias in interface NodecreateAlias in class AbstractNodepublic void deleteAlias(String aliasName)
Node
deleteAlias in interface NodedeleteAlias in class AbstractNodepublic void setContext(String context)
Node
setContext in interface NodesetContext in class AbstractNodepublic String getContext()
Node
getContext in interface NodegetContext in class AbstractNodepublic StringList getPossibleContexts()
Node
getPossibleContexts in interface NodegetPossibleContexts in class AbstractNodepublic boolean mayWrite()
Node
mayWrite in interface NodemayWrite in class AbstractNodepublic boolean mayDelete()
Node
mayDelete in interface NodemayDelete in class AbstractNodepublic boolean mayChangeContext()
Node
mayChangeContext in interface NodemayChangeContext in class AbstractNodeprotected void finalize()
public int hashCode()
Object.hashCode()public Collection getFunctions()
Node
getFunctions in interface NodeFunction objects.protected Function getNodeFunction(String functionName)
getNodeFunction in class AbstractNodepublic Parameters createParameters(String functionName)
Node
createParameters in interface NodecreateParameters in class AbstractNodeprotected FieldValue createFunctionValue(Object result)
createFunctionValue in class AbstractNode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||