org.mmbase.module.core
Class MMObjectNode

java.lang.Object
  extended byorg.mmbase.module.core.MMObjectNode
All Implemented Interfaces:
SizeMeasurable
Direct Known Subclasses:
VirtualNode

public class MMObjectNode
extends java.lang.Object
implements SizeMeasurable

MMObjectNode is the core of the MMBase system. This class is what its all about, because the instances of this class hold the content we are using. All active Nodes with data and relations are MMObjectNodes and make up the object world that is MMBase (Creating, searching, removing is done by the node's parent, which is a class extended from MMObjectBuilder)

Version:
$Id: MMObjectNode.java,v 1.122.2.3 2005/08/15 16:44:47 michiel Exp $
Author:
Daniel Ockeloen, Pierre van Rooden, Eduard Witteveen, Michiel Meeuwissen

Field Summary
protected  java.lang.String alias
          Alias name of this node.
 java.util.Vector changed
          Vector which stores the keys of the fields that were changed since the last commit.
protected  boolean initializing
          Determines whether the node is being initialized (typically when it is loaded from the database).
 MMObjectBuilder parent
          Pointer to the parent builder that is responsible for this node.
 java.lang.String prefix
          Used to make fields from multiple nodes (for multilevel for example) possible.
 java.util.Hashtable properties
          Holds the 'extra' name-value pairs (the node's properties) which are retrieved from the 'properties' table.
protected static RelatedNodesCache relatedCache
          Results of getRelatedNodes
protected static RelationsCache relationsCache
          objectNumber -> List of all relation nodes
static java.lang.Object VALUE_NULL
          You cannot store real 'null's in a hashtable, so this constant can be used for this.
static java.lang.String VALUE_SHORTED
          Large fields (blobs) are loaded 'lazily', so only on explicit request.
 java.util.Hashtable values
          Holds the name - value pairs of this node (the node's fields).
protected  boolean virtual
          Determines whether this node is virtual.
 
Constructor Summary
MMObjectNode(MMObjectBuilder parent)
          Main constructor.
 
Method Summary
 boolean clearChanged()
          Clear the 'signal' Vector with the changed keys since last commit/insert.
 boolean commit()
          Commit the node to the database or other storage system.
 boolean commit(UserContext user)
          Commit this node to the storage
 boolean defaultEquals(MMObjectNode n)
           
 void delPropertiesCache()
          Deletes the propertie cache for this node.
 void delRelationsCache()
          Delete the relation cache for this node.
 boolean equals(java.lang.Object o)
           
 void finish()
          Finish the loading of a node
 int getAge()
          Returns the node's age
 java.lang.String getAlias()
          Returns the node's alias.
 java.util.Enumeration getAllRelations()
          Return all the relations of this node.
 boolean getBooleanValue(java.lang.String fieldName)
          Get a value of a certain field.
 MMObjectBuilder getBuilder()
          Returns the actual builder of the node.
 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)
          Get a binary value of a certain field.
 java.util.Vector getChanged()
          Return the names of all persistent fields that were changed.
 java.lang.String getContext(UserContext user)
          Returns the security context for this node
 int getDBState(java.lang.String fieldName)
          Returns the DBState of a field.
 int getDBType(java.lang.String fieldName)
          Returns the DBType of a field.
 double getDoubleValue(java.lang.String fieldName)
          Get a value of a certain field.
 float getFloatValue(java.lang.String fieldName)
          Get a value of a certain field.
 java.lang.Object getFunctionValue(java.lang.String function, java.util.List args)
           
 java.lang.String getGUIIndicator()
          Return the GUI indicator for this node.
 java.lang.Integer getIntegerValue(java.lang.String fieldName)
          Get a value of a certain field.
 int getIntValue(java.lang.String fieldName)
          Get a value of a certain field.
 long getLongValue(java.lang.String fieldName)
          Get a value of a certain field.
 java.lang.String getName()
          Return the buildername of this node
 MMObjectNode getNodeValue(java.lang.String fieldName)
          Get a value of a certain field.
 int getNumber()
          Retrieve an object's number.
 int getOType()
          Retrieve an object's object type.
 java.util.Set getPossibleContexts(UserContext user)
          Returns the possible new security contexts for this node
 java.util.Hashtable getProperties()
          Return a the properties for this node.
 MMObjectNode getProperty(java.lang.String key)
          Returns a specified property of this node.
 java.util.Vector getRelatedNodes()
          Get all related nodes.
 java.util.Vector getRelatedNodes(java.lang.String type)
          Get the related nodes of a certain type.
 java.util.Vector getRelatedNodes(java.lang.String type, int search_type)
          If you query from this_node_type(type) (typex, insrel, typey where typex == typey) { if the insrel table is directional, use the multirelations.SEARCH_BOTH if the insrel table is not directional, use the multirelations.SEARCH_SOURCE + multirelations.SEARCH_DESTINATION } Otherwise the SEARCH_BOTH will result in an OR on insrel which will never return in (huge) databases.
 java.util.Vector getRelatedNodes(java.lang.String type, java.lang.String role, int search_type)
          If you query from this_node_type(type) (typex, insrel, typey where typex == typey) { if the insrel table is directional, use the multirelations.SEARCH_BOTH if the insrel table is not directional, use the multirelations.SEARCH_SOURCE + multirelations.SEARCH_DESTINATION } Otherwise the SEARCH_BOTH will result in an OR on insrel which will never return in (huge) databases.
static int getRelationCacheHits()
          Deprecated. use RelationsCache.getCache().getHits()
static int getRelationCacheMiss()
          Deprecated. use RelationsCache.getCache().getMisses()
 int getRelationCount()
          Returns the number of relations of this node.
 int getRelationCount(java.lang.String wt)
          Return the number of relations of this node, filtered on a specified type.
protected  java.util.List getRelationNodes()
           
 java.util.Enumeration getRelations()
          Return the relations of this node.
 java.util.Enumeration getRelations(int otype)
          Return the relations of this node, filtered on a specified type.
 java.util.Enumeration getRelations(java.lang.String wantedtype)
          Return the relations of this node, filtered on a specified type.
 java.lang.String getStringValue(java.lang.String fieldName)
          Get a value of a certain field.
 java.lang.String getTableName()
          Deprecated. use getName instead
 java.lang.Object getValue(java.lang.String fieldName)
          Get a value of a certain field.
 java.util.Hashtable getValues()
           
 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.
 int hashCode()
           
 boolean hasRelations()
          Returns whether this node has relations.
 int insert(java.lang.String userName)
          Insert this node into the storage
 int insert(UserContext user)
          Insert this node into the database or other storage system.
 int insertDone(EditState ed)
          Deprecated. This method doesn't seem to fit here, as it references a gui/html object (EditState), endangering the separation between content and layout, and has an undefined return value.
 boolean isChanged()
          Tests whether one of the values of this node was changed since the last commit/insert.
 boolean isVirtual()
          Determines whether the node is virtual.
 int preEdit(EditState ed)
          Deprecated. This method doesn't seem to fit here, as it references a gui/html object (EditState), endangering the separation between content and layout. It also has an undefined return value (as well as a confusing name).
 void putProperty(MMObjectNode node)
          Sets a specified property for this node.
 void remove(UserContext user)
          Remove this node from the storage
 void removeRelations()
          Remove the relations of the node.
 java.lang.Object retrieveValue(java.lang.String fieldName)
          Retrieves a value from the values hashtable.
 boolean sendFieldChangeSignal(java.lang.String fieldName)
          Sends a field-changed signal.
 void setAlias(java.lang.String alias)
          Sets the node's alias.
 void setContext(UserContext user, java.lang.String context, boolean now)
          Sets the security context for this node
 boolean setValue(java.lang.String fieldName, boolean fieldValue)
          Sets a key/value pair in the main values of this node.
 boolean setValue(java.lang.String fieldName, double fieldValue)
          Sets a key/value pair in the main values of this node.
 boolean setValue(java.lang.String fieldName, int fieldValue)
          Sets a key/value pair in the main values of this node.
 boolean setValue(java.lang.String fieldName, int type, java.lang.String value)
          Deprecated. This one will be moved/replaced soon... Testing of db types will be moved to the DB specific classes
 boolean setValue(java.lang.String fieldName, long fieldValue)
          Sets a key/value pair in the main values of this node.
 boolean setValue(java.lang.String fieldName, java.lang.Object fieldValue)
          Sets a key/value pair in the main values of this node.
 void start()
          Start the loading of a node
 void storeValue(java.lang.String fieldName, java.lang.Object fieldValue)
          Stores a value in the values hashtable.
 void testValidData()
          Tests whether the data in a node is valid (throws an exception if this is not the case).
 java.lang.String toString()
          Returns the core of this node in a string.
 java.lang.String toXML()
          Return the node as a string in XML format.
protected  org.w3c.dom.Document toXML(java.lang.Object value, java.lang.String fieldName)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VALUE_NULL

public static final java.lang.Object VALUE_NULL
You cannot store real 'null's in a hashtable, so this constant can be used for this.

Since:
MMBase-1.7

VALUE_SHORTED

public static final java.lang.String VALUE_SHORTED
Large fields (blobs) are loaded 'lazily', so only on explicit request. Until the first exlicit request this value is stored in such fields. It can be set back into the field with storeValue(java.lang.String, java.lang.Object), to unload the field again.

Since:
MMBase-1.7.4
See Also:
Constant Field Values

relatedCache

protected static RelatedNodesCache relatedCache
Results of getRelatedNodes

Since:
1.7

relationsCache

protected static RelationsCache relationsCache
objectNumber -> List of all relation nodes

Since:
MMBase-1.7

values

public java.util.Hashtable values
Holds the name - value pairs of this node (the node's fields). Most nodes will have a 'number' and an 'otype' field, and fields which will differ by builder. This collection should not be directly queried or changed - use the SetValue and getXXXValue methods instead.

Warning: Scope will be changed to:
private
To Do:
As suggested by keesj, should be changed to HashMap, which will allow for null values. It should then be made private, and methods that change the map (storeValue) be made synchronized. Note: To avoid synchronisation conflicts, we can't really change the type until the property is made private.

initializing

protected boolean initializing
Determines whether the node is being initialized (typically when it is loaded from the database). Use #start()) to start initializing, use #finish()) to end.

Since:
MMBase-1.7

properties

public java.util.Hashtable properties
Holds the 'extra' name-value pairs (the node's properties) which are retrieved from the 'properties' table.

Warning: Scope will be changed to:
private

changed

public java.util.Vector changed
Vector which stores the keys of the fields that were changed since the last commit.

Warning: Scope will be changed to:
private, and should be a Set, not a Vector

parent

public MMObjectBuilder parent
Pointer to the parent builder that is responsible for this node. Note: this may on occasion (due to optimization) duffer for the node's original builder. Use getBuilder() instead.

Warning: Scope will be changed to:
private

prefix

public java.lang.String prefix
Used to make fields from multiple nodes (for multilevel for example) possible. This is a 'default' value. XXX: specifying the prefix in the fieldName SHOULD override this field. MM: The function of this variable is not very clear. I think a Node should either be not a clusternode, in which case it does not need prefixed fields, or it should be a clusternode and then fields might be prefixed, but anyway it should be implemented in ClusterNode itself. Also in the comments of getStringValue someone said something about this prefix not being needed.

Warning: Scope will be changed to:
private

virtual

protected boolean virtual
Determines whether this node is virtual. A virtual node is not persistent (that is, not stored in a table).

Warning: Scope will be changed to:
private

alias

protected java.lang.String alias
Alias name of this node. XXX: nodes can have multiple aliases.

Warning: Scope will be changed to:
private
Constructor Detail

MMObjectNode

public MMObjectNode(MMObjectBuilder parent)
Main constructor.

Parameters:
parent - the node's parent, an instance of the node's builder.
Method Detail

getRelationCacheHits

public static int getRelationCacheHits()
Deprecated. use RelationsCache.getCache().getHits()


getRelationCacheMiss

public static int getRelationCacheMiss()
Deprecated. use RelationsCache.getCache().getMisses()


getBuilder

public MMObjectBuilder getBuilder()
Returns the actual builder of the node. Note that it is possible that, due to optimization, a node is currently associated with another (parent) builder, i.e. a posrel node may be associated with a insrel builder. This method returns the actual builder. The node may miss vital information (not retrieved from the database) to act as a node of such a builder - if you need actual status you need to reload it.

Returns:
the builder of this node
Since:
MMBase-1.6

start

public void start()
Start the loading of a node

Since:
MMBase-1.7

finish

public void finish()
Finish the loading of a node

Since:
MMBase-1.7

testValidData

public void testValidData()
                   throws InvalidDataException
Tests whether the data in a node is valid (throws an exception if this is not the case).

Throws:
InvalidDataException - If the data was unrecoverably invalid (the references did not point to existing objects)

commit

public boolean commit()
Commit the node to the database or other storage system. This can only be done on a existing (inserted) node. It will use the changed Vector as its base of what to commit/change.

Returns:
true if the commit was succesfull, false is it failed

insert

public int insert(java.lang.String userName)
Insert this node into the storage

Returns:
the new node key (number field), or -1 if the insert failed

insert

public int insert(UserContext user)
Insert this node into the database or other storage system.

Parameters:
user - the user who inserts the node. Used to set security-related information
Returns:
the new node key (number field), or -1 if the insert failed
Since:
MMBase-1.7

commit

public boolean commit(UserContext user)
Commit this node to the storage

Parameters:
user - the user who commits the node. Used to set security-related information
Returns:
true if succesful
Since:
MMBase-1.7

remove

public void remove(UserContext user)
Remove this node from the storage

Parameters:
user - the user who removes the node. Used to set security-related information
Since:
MMBase-1.7

setContext

public void setContext(UserContext user,
                       java.lang.String context,
                       boolean now)
Sets the security context for this node

Parameters:
user - the user who changes the context of the node.
context - the new context
now - if true, the context is changed instantly, otherwise it is changed after the node is send to storage.
Since:
MMBase-1.7

getContext

public java.lang.String getContext(UserContext user)
Returns the security context for this node

Parameters:
user - the user who requests the context of the node.
Since:
MMBase-1.7.1

getPossibleContexts

public java.util.Set getPossibleContexts(UserContext user)
Returns the possible new security contexts for this node

Parameters:
user - the user who requests the context of the node.
Since:
MMBase-1.7.1

insertDone

public int insertDone(EditState ed)
Deprecated. This method doesn't seem to fit here, as it references a gui/html object (EditState), endangering the separation between content and layout, and has an undefined return value.

Once an insert is done in the editors, this method is called.

Parameters:
ed - Contains the current edit state (editor info). The main function of this object is to pass 'settings' and 'parameters' - value pairs that have been set during the edit process.
Returns:
An int value. It's meaning is undefined. The basic routine returns -1.

preEdit

public int preEdit(EditState ed)
Deprecated. This method doesn't seem to fit here, as it references a gui/html object (EditState), endangering the separation between content and layout. It also has an undefined return value (as well as a confusing name).

Check and make last changes before calling commit() or insert(java.lang.String). This method is called by the editor. This differs from MMObjectBuilder.preCommit(org.mmbase.module.core.MMObjectNode), which is called by the database system during the call to commit or insert.

Parameters:
ed - Contains the current edit state (editor info). The main function of this object is to pass 'settings' and 'parameters' - value pairs that have been the during the edit process.
Returns:
An int value. It's meaning is undefined. The basic routine returns -1.

toString

public java.lang.String toString()
Returns the core of this node in a string. Used for debugging. For data exchange use toXML() and getDTD().

Returns:
the contents of the node as a string.

toXML

public java.lang.String toXML()
Return the node as a string in XML format. Used for data exchange, though, oddly enough, not by application export. (?)

Returns:
the contents of the node as a xml-formatted string.

storeValue

public void storeValue(java.lang.String fieldName,
                       java.lang.Object fieldValue)
Stores a value in the values hashtable. This is a low-level method that circumvents typechecking and the triggers of extended classes. You should normally call #setValue() to change fields.

Parameters:
fieldName - the name of the field to change
fieldValue - the value to assign
To Do:
This should become a synchronized method, once values becomes a private HashMap instead of a public Hashtable.

retrieveValue

public java.lang.Object retrieveValue(java.lang.String fieldName)
Retrieves a value from the values hashtable. This is a low-level method that circumvents typechecking and the triggers of extended classes. You should normally call #getValue() to load fields.

Parameters:
fieldName - the name of the field to change
Returns:
the value of the field

isVirtual

public boolean isVirtual()
Determines whether the node is virtual. A virtual node is not persistent (that is, stored in a database table).


toXML

protected org.w3c.dom.Document toXML(java.lang.Object value,
                                     java.lang.String fieldName)

setValue

public boolean setValue(java.lang.String fieldName,
                        java.lang.Object fieldValue)
Sets a key/value pair in the main values of this node. Note that if this node is a node in cache, the changes are immediately visible to everyone, even if the changes are not committed. The fieldName is added to the (public) 'changed' vector to track changes.

Parameters:
fieldName - the name of the field to change
fieldValue - the value to assign
Returns:
true When the field was changed, false otherwise.

setValue

public boolean setValue(java.lang.String fieldName,
                        boolean fieldValue)
Sets a key/value pair in the main values of this node. The value to set is of type boolean. Note that if this node is a node in cache, the changes are immediately visible to everyone, even if the changes are not committed. The fieldName is added to the (public) 'changed' vector to track changes.

Parameters:
fieldName - the name of the field to change
fieldValue - the value to assign
Returns:
always true

setValue

public boolean setValue(java.lang.String fieldName,
                        int fieldValue)
Sets a key/value pair in the main values of this node. The value to set is of type int. Note that if this node is a node in cache, the changes are immediately visible to everyone, even if the changes are not committed. The fieldName is added to the (public) 'changed' vector to track changes.

Parameters:
fieldName - the name of the field to change
fieldValue - the value to assign
Returns:
always true

setValue

public boolean setValue(java.lang.String fieldName,
                        long fieldValue)
Sets a key/value pair in the main values of this node. The value to set is of type int. Note that if this node is a node in cache, the changes are immediately visible to everyone, even if the changes are not committed. The fieldName is added to the (public) 'changed' vector to track changes.

Parameters:
fieldName - the name of the field to change
fieldValue - the value to assign
Returns:
always true

setValue

public boolean setValue(java.lang.String fieldName,
                        double fieldValue)
Sets a key/value pair in the main values of this node. The value to set is of type double. Note that if this node is a node in cache, the changes are immediately visible to everyone, even if the changes are not committed. The fieldName is added to the (public) 'changed' vector to track changes.

Parameters:
fieldName - the name of the field to change
fieldValue - the value to assign
Returns:
always true

setValue

public boolean setValue(java.lang.String fieldName,
                        int type,
                        java.lang.String value)
Deprecated. This one will be moved/replaced soon... Testing of db types will be moved to the DB specific classes

Sets a key/value pair in the main values of this node. The value to set is converted to the indicated type. Note that if this node is a node in cache, the changes are immediately visible to everyone, even if the changes are not committed. The fieldName is added to the (public) 'changed' vector to track changes.

Parameters:
fieldName - the name of the field to change
Returns:
false if the value is not of the indicated type, true otherwise

getNumber

public int getNumber()
Retrieve an object's number. In case of a new node that is not committed, this will return -1.

Returns:
the number of the node

getOType

public int getOType()
Retrieve an object's object type. This is a number (an index in the typedef builer), rather than a name.

Returns:
the object type number of the node

getValue

public java.lang.Object getValue(java.lang.String fieldName)
Get a value of a certain field.

Parameters:
fieldName - the name of the field who's data to return
Returns:
the field's value as an Object

getStringValue

public java.lang.String getStringValue(java.lang.String fieldName)
Get a value of a certain field. The value is returned as a String. Non-string values are automatically converted to String. 'null' is converted to an empty string.

Parameters:
fieldName - the name of the field who's data to return
Returns:
the field's value as a String

getFunctionValue

public java.lang.Object getFunctionValue(java.lang.String function,
                                         java.util.List args)
Since:
MMBase-1.6

getXMLValue

public 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. If the value cannot be converted, this method returns null

Parameters:
fieldName - the name of the field to be returned
Returns:
the value of the specified field as a DOM Element or null
Throws:
java.lang.IllegalArgumentException - if the Field is not of type TYPE_XML.
Since:
MMBase-1.6

getByteValue

public byte[] getByteValue(java.lang.String fieldName)
Get a binary value of a certain field.

Parameters:
fieldName - the name of the field who's data to return
Returns:
the field's value as an byte [] (binary/blob field)

getNodeValue

public MMObjectNode getNodeValue(java.lang.String fieldName)
Get a value of a certain field. The value is returned as an MMObjectNode. If the field contains an Numeric value, the method tries to obtrain the object with that number. If it is a String, the method tries to obtain the object with that alias. The only other possible values are those created by certain virtual fields. All remaining situations return null.

Parameters:
fieldName - the name of the field who's data to return
Returns:
the field's value as an int

getIntValue

public int getIntValue(java.lang.String fieldName)
Get a value of a certain field. The value is returned as an int value. Values of non-int, numeric fields are converted if possible. Booelan fields return 0 for false, 1 for true. String fields are parsed to a number, if possible. If a value is an MMObjectNode, it's numberfield is returned. All remaining field values return -1.

Parameters:
fieldName - the name of the field who's data to return
Returns:
the field's value as an int

getBooleanValue

public boolean getBooleanValue(java.lang.String fieldName)
Get a value of a certain field. The value is returned as an boolean value. 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. Note that there is currently no basic MMBase boolean type, but some excecuteFunction calls may return a Boolean result.

Parameters:
fieldName - the name of the field who's data to return
Returns:
the field's value as an int

getIntegerValue

public java.lang.Integer getIntegerValue(java.lang.String fieldName)
Get a value of a certain field. The value is returned as an Integer value. Values of non-Integer, numeric fields are converted if possible. Boolean fields return 0 for false, 1 for true. String fields are parsed to a number, if possible. All remaining field values return -1.

Parameters:
fieldName - the name of the field who's data to return
Returns:
the field's value as an Integer

getLongValue

public long getLongValue(java.lang.String fieldName)
Get a value of a certain field.

Parameters:
fieldName - the name of the field who's data to return
Returns:
the field's value as a long
See Also:
getValue(java.lang.String), Casting.toLong(java.lang.Object, long)

getFloatValue

public float getFloatValue(java.lang.String fieldName)
Get a value of a certain field. The value is returned as a float value. Values of non-float, numeric fields are converted if possible. Boolean fields return 0 for false, 1 for true. String fields are parsed to a number, if possible. All remaining field values return -1.

Parameters:
fieldName - the name of the field who's data to return
Returns:
the field's value as a float

getDoubleValue

public double getDoubleValue(java.lang.String fieldName)
Get a value of a certain field. The value is returned as a double value. Values of non-double, numeric fields are converted if possible. Boolean fields return 0 for false, 1 for true. String fields are parsed to a number, if possible. All remaining field values return -1.

Parameters:
fieldName - the name of the field who's data to return
Returns:
the field's value as a double

getDBType

public int getDBType(java.lang.String fieldName)
Returns the DBType of a field.

Parameters:
fieldName - the name of the field which' type to return
Returns:
the field's DBType

getDBState

public int getDBState(java.lang.String fieldName)
Returns the DBState of a field.

Parameters:
fieldName - the name of the field who's state to return
Returns:
the field's DBState

getChanged

public java.util.Vector getChanged()
Return the names of all persistent fields that were changed. Note that this is a direct reference. Changes (i.e. clearing the vector) will affect the node's status.

To Do:
Should it not return a (unmodifiable) Collection or a Set?, Should this function not be replaced by a more generic 'isChanged(String fieldName)'?

isChanged

public boolean isChanged()
Tests whether one of the values of this node was changed since the last commit/insert.

Returns:
true if changes have been made, false otherwise

clearChanged

public boolean clearChanged()
Clear the 'signal' Vector with the changed keys since last commit/insert. Marks the node as 'unchanged'. Does not affect the values of the fields, nor does it commit the node.

Returns:
always true

delPropertiesCache

public void delPropertiesCache()
Deletes the propertie cache for this node. Forces a reload of the properties on next use.


getValues

public java.util.Hashtable getValues()

getProperties

public java.util.Hashtable getProperties()
Return a the properties for this node.

Returns:
the properties as a Hashtable

getProperty

public MMObjectNode getProperty(java.lang.String key)
Returns a specified property of this node.

Parameters:
key - the name of the property to retrieve
Returns:
the property object as a MMObjectNode

putProperty

public void putProperty(MMObjectNode node)
Sets a specified property for this node. This method does not commit anything - it merely updates the node's propertylist.

Parameters:
node - the property object as a MMObjectNode

getGUIIndicator

public java.lang.String getGUIIndicator()
Return the GUI indicator for this node. The GUI indicator is a string that represents the contents of this node. By default it is the string-representation of the first non-system field of the node. Individual builders can alter this behavior.

Returns:
the GUI iddicator as a String

getName

public java.lang.String getName()
Return the buildername of this node

Returns:
the builder table name

delRelationsCache

public void delRelationsCache()
Delete the relation cache for this node. This means it will be reloaded from the database/storage on next use.


hasRelations

public boolean hasRelations()
Returns whether this node has relations. This includes unidirection relations which would otherwise not be counted.

Returns:
true if any relations exist, false otherwise.

getAllRelations

public java.util.Enumeration getAllRelations()
Return all the relations of this node. Use only to delete the relations of a node. Note that this returns the nodes describing the relation - not the nodes 'related to'.

Returns:
An Enumeration containing the nodes

getRelations

public java.util.Enumeration getRelations()
Return the relations of this node. Note that this returns the nodes describing the relation - not the nodes 'related to'.

Returns:
An Enumeration containing the nodes

getRelationNodes

protected java.util.List getRelationNodes()
Since:
MMBase-1.7
Warning: Scope will be changed to:
public?

removeRelations

public void removeRelations()
Remove the relations of the node.


getRelationCount

public int getRelationCount()
Returns the number of relations of this node.

Returns:
An int indicating the number of nodes found

getRelations

public java.util.Enumeration getRelations(int otype)
Return the relations of this node, filtered on a specified type. Note that this returns the nodes describing the relation - not the nodes 'related to'.

Parameters:
otype - the 'type' of relations to return. The type identifies a relation (InsRel-derived) builder, not a reldef object.
Returns:
An Enumeration containing the nodes

getRelations

public java.util.Enumeration getRelations(java.lang.String wantedtype)
Return the relations of this node, filtered on a specified type. Note that this returns the nodes describing the relation - not the nodes 'related to'.

Parameters:
wantedtype - the 'type' of relations to return. The type identifies a relation (InsRel-derived) builder, not a reldef object.
Returns:
An Enumeration containing the nodes

getRelationCount

public int getRelationCount(java.lang.String wt)
Return the number of relations of this node, filtered on a specified type.

Returns:
An int indicating the number of nodes found

getAge

public int getAge()
Returns the node's age

Returns:
the age in days

getTableName

public java.lang.String getTableName()
Deprecated. use getName instead

Returns the node's builder tablename.

Returns:
the tablename of the builder as a String

sendFieldChangeSignal

public boolean sendFieldChangeSignal(java.lang.String fieldName)
Sends a field-changed signal.

Parameters:
fieldName - the name of the changed field.
Returns:
always true

setAlias

public void setAlias(java.lang.String alias)
Sets the node's alias. The code only sets a (memory) property, it does not actually add the alias to the database. Does not support multiple aliases.


getAlias

public java.lang.String getAlias()
Returns the node's alias. Does not support multiple aliases.

Returns:
the alias as a String

getRelatedNodes

public java.util.Vector getRelatedNodes()
Get all related nodes. The returned nodes are not the nodes directly attached to this node (the relation nodes) but the nodes attached to the relation nodes of this node.

Returns:
a Vector containing MMObjectNodes

getRelatedNodes

public java.util.Vector getRelatedNodes(java.lang.String type)
Get the related nodes of a certain type. The returned nodes are not the nodes directly attached to this node (the relation nodes) but the nodes attached to the relation nodes of this node.

Parameters:
type - the type of objects to be returned
Returns:
a Vector containing MMObjectNodes

getRelatedNodes

public java.util.Vector getRelatedNodes(java.lang.String type,
                                        int search_type)
If you query from this_node_type(type) (typex, insrel, typey where typex == typey) { if the insrel table is directional, use the multirelations.SEARCH_BOTH if the insrel table is not directional, use the multirelations.SEARCH_SOURCE + multirelations.SEARCH_DESTINATION } Otherwise the SEARCH_BOTH will result in an OR on insrel which will never return in (huge) databases.

Parameters:
type - the type of teh realted node to return
search_type - the type of directionality to use
Since:
MMBase-1.6.3

getRelatedNodes

public java.util.Vector getRelatedNodes(java.lang.String type,
                                        java.lang.String role,
                                        int search_type)
If you query from this_node_type(type) (typex, insrel, typey where typex == typey) { if the insrel table is directional, use the multirelations.SEARCH_BOTH if the insrel table is not directional, use the multirelations.SEARCH_SOURCE + multirelations.SEARCH_DESTINATION } Otherwise the SEARCH_BOTH will result in an OR on insrel which will never return in (huge) databases.

Parameters:
type - the type of teh realted node to return
role - the role of the relation (null if no role specified)
search_type - the type of directionality to use
Since:
MMBase-1.6.3

getByteSize

public int getByteSize()
Description copied from interface: SizeMeasurable
Determins the byte-size of this object

Specified by:
getByteSize in interface SizeMeasurable

getByteSize

public int getByteSize(SizeOf sizeof)
Description copied from interface: SizeMeasurable
Determins the byte-size of this object using the given SizeOf instance. A SizeOf instance stores a Set already counted objects. So this method is typically called by SizeOf itself (recursion).

Specified by:
getByteSize in interface SizeMeasurable

hashCode

public int hashCode()
Since:
MMBase-1.6.2

equals

public boolean equals(java.lang.Object o)
Since:
MMBase-1.6.2

defaultEquals

public boolean defaultEquals(MMObjectNode n)
Since:
MMBase-1.6.2


MMBase build 1.7.4.20050922