|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mmbase.bridge.implementation.BasicNode
Basic implementation of Node. Wraps MMObjectNodes, adds security.
Node,
MMObjectNode| Field Summary | |
protected java.lang.String |
account
The account this node is edited under. |
static int |
ACTION_COMMIT
|
static int |
ACTION_CREATE
|
static int |
ACTION_DELETE
|
static int |
ACTION_EDIT
|
protected BasicCloud |
cloud
Reference to the Cloud. |
protected boolean |
isnew
Determines whether this node was created for insert. |
protected MMBase |
mmb
Reference to MMBase root. |
protected NodeManager |
nodeManager
Reference to the NodeManager |
protected MMObjectNode |
noderef
Reference to actual MMObjectNode object. |
protected int |
temporaryNodeId
Temporary node ID. |
| 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 |
compareTo(java.lang.Object o)
Compares this node to the passed object. |
int |
countRelatedNodes(NodeManager otherNodeManager,
java.lang.String role,
java.lang.String direction)
|
int |
countRelatedNodes(java.lang.String type)
Returns the number of related nodes that have a specific node manager. |
int |
countRelations()
Returns the number of relations this node has with other nodes. |
int |
countRelations(java.lang.String type)
Returns the number of relation nodes attached to this node that have a specific relation manager. |
void |
createAlias(java.lang.String aliasName)
Create an alias for this node. |
Relation |
createRelation(Node destinationNode,
RelationManager relationManager)
Adds a relation between this node and a specified node to the cloud. |
void |
delete()
Removes the Node. |
void |
delete(boolean deleteRelations)
Removes the Node. |
void |
deleteAlias(java.lang.String aliasName)
Delete an alias for this node. |
void |
deleteRelations()
Removes all relation nodes attached to this node. |
void |
deleteRelations(java.lang.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. |
boolean |
equals(java.lang.Object o)
Compares two nodes, and returns true if they are equal. |
protected void |
finalize()
Reverse the buffers, when changed and not stored... |
StringList |
getAliases()
Returns all aliases for this node. |
boolean |
getBooleanValue(java.lang.String fieldName)
Returns the value of the specified field as a boolean. |
int |
getByteSize()
Determins the byte-size of this object |
int |
getByteSize(SizeOf sizeof)
Determins the byte-size of this object using the given SizeOf instance. |
byte[] |
getByteValue(java.lang.String fieldName)
Returns the value of the specified field as a byte array. |
Cloud |
getCloud()
Returns the cloud this node belongs to. |
java.lang.String |
getContext()
Get the security context of the current Node |
double |
getDoubleValue(java.lang.String fieldName)
Returns the value of the specified field as a double. |
FieldValue |
getFieldValue(Field field)
Returns the value of the specified field as a FieldValue object. |
FieldValue |
getFieldValue(java.lang.String fieldName)
Returns the value of the specified field as a FieldValue object. |
float |
getFloatValue(java.lang.String fieldName)
Returns the value of the specified field as a float. |
FieldValue |
getFunctionValue(java.lang.String functionName,
java.util.List arguments)
Returns the value of the specified function on the node. |
int |
getIntValue(java.lang.String fieldName)
Returns the value of the specified field as an int. |
long |
getLongValue(java.lang.String fieldName)
Returns the value of the specified field as a long. |
protected MMObjectNode |
getNode()
Obtains a reference to the underlying MMObjectNode. |
NodeManager |
getNodeManager()
Returns the node manager for this node. |
Node |
getNodeValue(java.lang.String fieldName)
Returns the value of the specified field as a Node. |
int |
getNumber()
Returns the unique number for this node. |
java.lang.Object |
getObjectValue(java.lang.String fieldName)
Returns the field's value as an object. |
StringList |
getPossibleContexts()
Contacts the security implementation to find out to which other possible contextes the context of this node may be set. |
NodeList |
getRelatedNodes()
Returns all related nodes. |
NodeList |
getRelatedNodes(NodeManager nodeManager)
Returns all related nodes that have a specific node manager. |
NodeList |
getRelatedNodes(NodeManager nodeManager,
java.lang.String role,
java.lang.String searchDir)
Returns all related nodes that have a specific node manager and role. |
NodeList |
getRelatedNodes(java.lang.String type)
Returns all related nodes that have a specific node manager. |
NodeList |
getRelatedNodes(java.lang.String type,
java.lang.String role,
java.lang.String searchDir)
Returns all related nodes that have a specific node manager and role. |
RelationList |
getRelations()
Returns all relation nodes attached to this node. |
RelationList |
getRelations(java.lang.String role)
Returns all relation nodes attached to this node that have a specific role |
RelationList |
getRelations(java.lang.String role,
NodeManager nodeManager)
Returns all relation nodes attached to this node that have a specific role, or refer a node from a specific nodemanager |
RelationList |
getRelations(java.lang.String role,
NodeManager nodeManager,
java.lang.String searchDir)
|
RelationList |
getRelations(java.lang.String role,
java.lang.String nodeManager)
Returns all relation nodes attached to this node that have a specific role, or refer a node from a specific nodemanager |
java.lang.String |
getStringValue(java.lang.String fieldName)
Returns the value of the specified field as a String. |
java.lang.Object |
getValue(java.lang.String fieldName)
Returns the value of the specified field as an object. |
org.w3c.dom.Document |
getXMLValue(java.lang.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. |
org.w3c.dom.Element |
getXMLValue(java.lang.String fieldName,
org.w3c.dom.Document tree)
Returns the value of the specified field as a dom.Element
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 the node. |
protected void |
invalidateNode()
Invalidates the reference to the underlying MMObjectNode, replacing it with a virtual node that only inherits the number field. |
boolean |
isNodeManager()
Determine whether this Node is a NodeManager. |
boolean |
isRelation()
Determine whether this Node is a Relation. |
boolean |
isRelationManager()
Determine whether this Node is a RelationManager. |
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 |
setBooleanValue(java.lang.String fieldName,
boolean value)
Sets the value of the specified field using an boolean. |
void |
setByteValue(java.lang.String fieldName,
byte[] value)
Sets the value of the specified field using a byte array. |
void |
setContext(java.lang.String context)
Sets the security context of this Node (AKA the 'owner' field) |
void |
setDoubleValue(java.lang.String fieldName,
double value)
Sets the value of the specified field using a double. |
void |
setFloatValue(java.lang.String fieldName,
float value)
Sets the value of the specified field using a float. |
void |
setIntValue(java.lang.String fieldName,
int value)
Sets the value of the specified field using an int. |
void |
setLongValue(java.lang.String fieldName,
long value)
Sets the value of the specified field using a long. |
protected void |
setNode(MMObjectNode n)
Sets the reference to the underlying MMObjectNode. |
void |
setNodeValue(java.lang.String fieldName,
Node value)
Sets the value of the specified field using an Node. |
void |
setObjectValue(java.lang.String fieldName,
java.lang.Object value)
Sets the value of the specified field using an object. |
void |
setStringValue(java.lang.String fieldName,
java.lang.String value)
Sets the value of the specified field using a String. |
void |
setValue(java.lang.String fieldName,
java.lang.Object value)
Setting value with default method (depending on field's type) |
protected void |
setValueWithoutChecks(java.lang.String fieldName,
java.lang.Object value)
Protected method to be able to set rnumber when creating a relation. |
protected void |
setValueWithoutProcess(java.lang.String fieldName,
java.lang.Object value)
Like setValue, but withouth the valueinterceptor, this is called by nthe other set-values. |
void |
setXMLValue(java.lang.String fieldName,
org.w3c.dom.Document value)
Set's the value of the specified field as a dom.Element |
NodeManager |
toNodeManager()
Returns this as a NodeManager. |
Relation |
toRelation()
Returns this as a Relation. |
RelationManager |
toRelationManager()
Returns this as a RelationManager. |
java.lang.String |
toString()
Converts the node to a string |
| Methods inherited from class java.lang.Object |
clone, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int ACTION_CREATE
public static final int ACTION_EDIT
public static final int ACTION_DELETE
public static final int ACTION_COMMIT
protected NodeManager nodeManager
protected BasicCloud cloud
protected MMBase mmb
protected MMObjectNode noderef
protected int temporaryNodeId
protected java.lang.String account
protected boolean isnew
| Method Detail |
protected void init()
public boolean isRelation()
Node
isRelation in interface Nodetrue if this Node is a Relation.public Relation toRelation()
Node
toRelation in interface NodeRelation objectpublic boolean isNodeManager()
Node
isNodeManager in interface Nodetrue if this Node is a NodeManager.public NodeManager toNodeManager()
Node
toNodeManager in interface NodeNodeManager objectpublic boolean isRelationManager()
Node
isRelationManager in interface Nodetrue if this Node is a RelationManager.public RelationManager toRelationManager()
Node
toRelationManager in interface NodeNodeManager objectpublic int getByteSize()
SizeMeasurable
getByteSize in interface SizeMeasurablepublic int getByteSize(SizeOf sizeof)
SizeMeasurable
getByteSize in interface SizeMeasurable
protected final MMObjectNode getNode()
throws NotFoundException
NotFoundException - if no node was specified. This generally means theprotected void invalidateNode()
protected void setNode(MMObjectNode n)
n - the node to set a reference to.
java.lang.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 NodeNode.createAlias(String alias)protected void edit(int action)
action - The action to perform.
public void setValue(java.lang.String fieldName,
java.lang.Object value)
setValue in interface NodefieldName - the name of the field to be updatedvalue - the new value for the given field
protected void setValueWithoutProcess(java.lang.String fieldName,
java.lang.Object value)
protected void setValueWithoutChecks(java.lang.String fieldName,
java.lang.Object value)
public void setObjectValue(java.lang.String fieldName,
java.lang.Object value)
Node
setObjectValue in interface NodefieldName - the name of the field to be updatedvalue - the new value for the given field
public void setBooleanValue(java.lang.String fieldName,
boolean value)
Nodeboolean.
This change will not be visible to the cloud until the commit method is
called.
setBooleanValue in interface NodefieldName - the name of the field to be updatedvalue - the new value for the given field
public void setNodeValue(java.lang.String fieldName,
Node value)
NodeNode.
This change will not be visible to the cloud until the commit method is
called.
setNodeValue in interface NodefieldName - the name of the field to be updatedvalue - the new value for the given field
public void setIntValue(java.lang.String fieldName,
int value)
Nodeint.
This change will not be visible to the cloud until the commit method is
called.
setIntValue in interface NodefieldName - the name of the field to be updatedvalue - the new value for the given field
public void setFloatValue(java.lang.String fieldName,
float value)
Nodefloat.
This change will not be visible to the cloud until the commit method is
called.
setFloatValue in interface NodefieldName - the name of the field to be updatedvalue - the new value for the given field
public void setDoubleValue(java.lang.String fieldName,
double value)
Nodedouble.
This change will not be visible to the cloud until the commit method is
called.
setDoubleValue in interface NodefieldName - the name of the field to be updatedvalue - the new value for the given field
public void setByteValue(java.lang.String fieldName,
byte[] value)
Nodebyte array.
This change will not be visible to the cloud until the commit method is
called.
setByteValue in interface NodefieldName - the name of the field to be updatedvalue - the new value for the given field
public void setLongValue(java.lang.String fieldName,
long value)
Nodelong.
This change will not be visible to the cloud until the commit method is
called.
setLongValue in interface NodefieldName - the name of the field to be updatedvalue - the new value for the given field
public void setStringValue(java.lang.String fieldName,
java.lang.String value)
NodeString.
This change will not be visible to the cloud until the commit method is
called.
setStringValue in interface NodefieldName - the name of the field to be updatedvalue - the new value for the given field
public void setXMLValue(java.lang.String fieldName,
org.w3c.dom.Document value)
Nodedom.Element
setXMLValue in interface NodefieldName - the name of the field to be returnedvalue - the DOM Document to has to be set, if not correct doc-type,
system will try to convert it to the wanted type.public java.lang.Object getValue(java.lang.String fieldName)
Nodeint is returned as an Integer.
The object type may vary and is dependent on how data was stored in a field.
I.e. It may be possible for an Integer field to return it's value as a String
if it was stored that way in the first place.
getValue in interface NodefieldName - the name of the field to be returned
public java.lang.Object getObjectValue(java.lang.String fieldName)
Node
getObjectValue in interface Nodepublic boolean getBooleanValue(java.lang.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 concidered 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 NodefieldName - the name of the field to be returned
public Node getNodeValue(java.lang.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 NodefieldName - the name of the field to be returned
Cloud.getList(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)public int getIntValue(java.lang.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 NodefieldName - the name of the field to be returned
public float getFloatValue(java.lang.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 NodefieldName - the name of the field to be returned
public long getLongValue(java.lang.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 NodefieldName - the name of the field to be returned
public double getDoubleValue(java.lang.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 NodefieldName - the name of the field to be returned
public byte[] getByteValue(java.lang.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 NodefieldName - the name of the field to be returned
public java.lang.String getStringValue(java.lang.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 NodefieldName - the name of the field to be returned
public FieldValue getFieldValue(java.lang.String fieldName)
throws NotFoundException
NodeFieldValue object.
getFieldValue in interface NodefieldName - the name of the field whose value to return
NotFoundException - is the field does not existpublic FieldValue getFieldValue(Field field)
NodeFieldValue object.
getFieldValue in interface Nodefield - the Field object whose value to return
public FieldValue getFunctionValue(java.lang.String functionName,
java.util.List arguments)
Node
getFunctionValue in interface NodefunctionName - the name of the function to be executedarguments - parameters to the function
public org.w3c.dom.Document getXMLValue(java.lang.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.
If the value cannot be converted, this method returns null
getXMLValue in interface NodefieldName - the name of the field to be returned
null
public org.w3c.dom.Element getXMLValue(java.lang.String fieldName,
org.w3c.dom.Document tree)
Nodedom.Element
If the node value is not itself a Document, the method attempts to
attempts to convert the String value into an XML.
This method fails (throws a IllegalArgumentException) if the Field is not of type TYPE_XML.
If the value cannot be converted, this method returns null
getXMLValue in interface NodefieldName - the name of the field to be returnedtree - the DOM Document to which the Element is added
(as the document root element)
nullpublic void commit()
Node
commit in interface Nodepublic void cancel()
Node
cancel in interface Nodepublic void delete()
Node
delete in interface Nodepublic void delete(boolean deleteRelations)
Node
delete in interface NodedeleteRelations - a boolean. If true, then first all
existing relations with this node will be removed.public java.lang.String toString()
Node
toString in interface Nodepublic void deleteRelations()
Node
deleteRelations in interface Node
public void deleteRelations(java.lang.String type)
throws NotFoundException
Node
deleteRelations in interface Nodetype - the name of the relation manager the removed
relation nodes should have
NotFoundExceptionpublic RelationList getRelations()
Node
getRelations in interface Nodepublic RelationList getRelations(java.lang.String role)
Node
getRelations in interface Noderole - the name of the role the returned
relation nodes should have
public RelationList getRelations(java.lang.String role,
java.lang.String nodeManager)
throws NotFoundException
Node
getRelations in interface Noderole - the name of the role the returned
relation nodes should havenodeManager - the name of the nodemanager for the nodes the returned
relation nodes should have a relation to
NotFoundException
public RelationList getRelations(java.lang.String role,
NodeManager nodeManager)
Node
getRelations in interface Noderole - the name of the role the returned
relation nodes should havenodeManager - the nodemanager for the nodes the returned
relation nodes should have a relation to (can be null)
public RelationList getRelations(java.lang.String role,
NodeManager nodeManager,
java.lang.String searchDir)
throws NotFoundException
getRelations in interface NodeNotFoundExceptionShould perhaps be implemented with thatpublic boolean hasRelations()
Node
hasRelations in interface Nodetrue if the node has relationspublic int countRelations()
Node
countRelations in interface Nodepublic int countRelations(java.lang.String type)
Node
countRelations in interface Node
public int countRelatedNodes(NodeManager otherNodeManager,
java.lang.String role,
java.lang.String direction)
countRelatedNodes in interface Nodepublic NodeList getRelatedNodes()
Node
getRelatedNodes in interface Nodepublic NodeList getRelatedNodes(java.lang.String type)
Node
getRelatedNodes in interface Nodetype - the name of the node manager the returned nodes
should have
public NodeList getRelatedNodes(NodeManager nodeManager)
Node
getRelatedNodes in interface NodenodeManager - the node manager the returned nodes should have, can be null
public NodeList getRelatedNodes(NodeManager nodeManager,
java.lang.String role,
java.lang.String searchDir)
Node
getRelatedNodes in interface NodenodeManager - the node manager the returned nodes should haverole - the role of the relationsearchDir - the direction of the relation
Should perhaps be implemented with that.
public NodeList getRelatedNodes(java.lang.String type,
java.lang.String role,
java.lang.String searchDir)
Node
getRelatedNodes in interface Nodetype - the name of the node manager the returned nodes
should haverole - the role of the relationsearchDir - the direction of the relation
public int countRelatedNodes(java.lang.String type)
Node
countRelatedNodes in interface Nodepublic StringList getAliases()
Node
getAliases in interface Nodepublic void createAlias(java.lang.String aliasName)
Node
createAlias in interface NodealiasName - the alias to be created for this nodepublic void deleteAlias(java.lang.String aliasName)
Node
deleteAlias in interface NodealiasName - the alias to be removed for this node
public Relation createRelation(Node destinationNode,
RelationManager relationManager)
Node
createRelation in interface NodedestinationNode - the node to which you want to relate this noderelationManager - the relation manager you want to use
public void setContext(java.lang.String context)
Node
setContext in interface Nodecontext - The security context to which this node should belong,public java.lang.String getContext()
Node
getContext in interface Nodepublic StringList getPossibleContexts()
Node
getPossibleContexts in interface Nodepublic boolean mayWrite()
Node
mayWrite in interface Nodepublic boolean mayDelete()
Node
mayDelete in interface Nodepublic boolean mayChangeContext()
Node
mayChangeContext in interface Nodeprotected void finalize()
public int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparableo - the object to compare it withpublic int hashCode()
public boolean equals(java.lang.Object o)
o - the object to compare it with
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||