Package helma.objectmodel
Class TransientNode
- java.lang.Object
-
- helma.objectmodel.TransientNode
-
- All Implemented Interfaces:
IPathElement
,INode
,INodeState
,java.io.Serializable
public class TransientNode extends java.lang.Object implements INode, java.io.Serializable
A transient implementation of INode. An instance of this class can't be made persistent by reachability from a persistent node. To make a persistent-capable object, class helma.objectmodel.db.Node has to be used.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
anonymous
protected long
created
protected java.lang.String
id
protected long
lastmodified
protected java.lang.String
name
protected java.util.Hashtable
nodeMap
protected java.util.Vector
nodes
protected TransientNode
parent
protected java.util.Hashtable
propMap
-
Constructor Summary
Constructors Constructor Description TransientNode(Application app)
Creates a new TransientNode object.TransientNode(Application app, java.lang.String n)
Make a new TransientNode object with a given name
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description INode
addNode(INode elem)
Add a child node to this node.INode
addNode(INode elem, int where)
Add a child node to this node at the given positionvoid
clearCacheNode()
Reset the cache node for this node.int
contains(INode n)
Returns the position of the child or -1.long
created()
Get the node's creation timestamp.INode
createNode()
INode
createNode(int where)
INode
createNode(java.lang.String nm)
Create a new named property with a node valueINode
createNode(java.lang.String nm, int where)
Create a new unnamed child node at the given position.static java.lang.String
generateID()
IProperty
get(java.lang.String propname)
Get a property with the given name.boolean
getBoolean(java.lang.String propname)
Get a boolean property with the given name.INode
getCacheNode()
Get the cache node for this node.IPathElement
getChildElement(java.lang.String name)
Retrieve a child element of this object by name.java.util.Date
getDate(java.lang.String propname)
Get a date property with the given name.DbMapping
getDbMapping()
Get the node'sDbMapping
.java.lang.String
getElementName()
Return the name to be used to get this element from its parentdouble
getFloat(java.lang.String propname)
Get a float property with the given name.java.lang.String
getFullName(INode root)
java.lang.String
getID()
Get the node's ID.long
getInteger(java.lang.String propname)
Get an integer property with the given name.java.lang.Object
getJavaObject(java.lang.String propname)
Get a Java object property with the given name.java.lang.String
getName()
Get the node's name.INode
getNode(java.lang.String propname)
Get a node property with the given name.INode
getParent()
Get the node's parent node.IPathElement
getParentElement()
Return the parent element of this object.java.lang.String
getPath()
Get the node's path.java.lang.String
getPrototype()
Return the node's prototype name.int
getState()
Get the node's state flag.java.lang.String
getString(java.lang.String propname)
Get a string property with the given name.java.lang.String
getString(java.lang.String propname, java.lang.String defaultValue)
INode
getSubnode(java.lang.String name)
Get a named child node with the given name or id.INode
getSubnodeAt(int index)
GEt an unnamed child node at the given positionjava.lang.String
getSubnodeRelation()
Get the node's explicit subnode select clause if one was set, or nulljava.util.Enumeration
getSubnodes()
Get an enumeration of this node's unnamed child nodesboolean
isAnonymous()
Returns true if this node is an unnamed node.long
lastModified()
Get the node's last modification timestamp.int
numberOfNodes()
Get the number the node's direct child nodes.java.util.Enumeration
properties()
property-relatedprotected void
releaseNode(INode node)
"Physically" remove a subnode from the subnodes table.boolean
remove()
Remove this node from the database.void
removeNode(INode node)
Remove the given node from this node's child nodes.void
setBoolean(java.lang.String propname, boolean value)
Set the property with the given name to the given boolean value.void
setDate(java.lang.String propname, java.util.Date value)
Set the property with the given name to the given date value.void
setDbMapping(DbMapping dbmap)
Set the node'sDbMapping
.void
setFloat(java.lang.String propname, double value)
Set the property with the given name to the given float value.void
setInteger(java.lang.String propname, long value)
Set the property with the given name to the given integer value.void
setJavaObject(java.lang.String propname, java.lang.Object value)
Set the property with the given name to the given Java object value.void
setName(java.lang.String name)
Set the node's name.void
setNode(java.lang.String propname, INode value)
Set the property with the given name to the given node value.void
setPrototype(java.lang.String proto)
Set the node's prototype name.void
setState(int s)
Set the node's state flag.void
setString(java.lang.String propname, java.lang.String value)
Set the property with the given name to the given string value.void
setSubnodeRelation(java.lang.String rel)
Set an explicit select clause for the node's subnodesjava.lang.String
toString()
void
unset(java.lang.String propname)
Unset the property with the given name..
-
-
-
Field Detail
-
propMap
protected java.util.Hashtable propMap
-
nodeMap
protected java.util.Hashtable nodeMap
-
nodes
protected java.util.Vector nodes
-
parent
protected TransientNode parent
-
created
protected long created
-
lastmodified
protected long lastmodified
-
id
protected java.lang.String id
-
name
protected java.lang.String name
-
anonymous
protected boolean anonymous
-
-
Constructor Detail
-
TransientNode
public TransientNode(Application app)
Creates a new TransientNode object.
-
TransientNode
public TransientNode(Application app, java.lang.String n)
Make a new TransientNode object with a given name
-
-
Method Detail
-
generateID
public static java.lang.String generateID()
-
setDbMapping
public void setDbMapping(DbMapping dbmap)
Description copied from interface:INode
Set the node'sDbMapping
.- Specified by:
setDbMapping
in interfaceINode
-
getDbMapping
public DbMapping getDbMapping()
Description copied from interface:INode
Get the node'sDbMapping
.- Specified by:
getDbMapping
in interfaceINode
-
getID
public java.lang.String getID()
Description copied from interface:INode
Get the node's ID.
-
isAnonymous
public boolean isAnonymous()
Description copied from interface:INode
Returns true if this node is an unnamed node.- Specified by:
isAnonymous
in interfaceINode
-
getName
public java.lang.String getName()
Description copied from interface:INode
Get the node's name.
-
getElementName
public java.lang.String getElementName()
Description copied from interface:IPathElement
Return the name to be used to get this element from its parent- Specified by:
getElementName
in interfaceIPathElement
-
getState
public int getState()
Description copied from interface:INode
Get the node's state flag.- Specified by:
getState
in interfaceINode
- Returns:
- one of the constants defined in the
INodeState
interface.
-
setState
public void setState(int s)
Description copied from interface:INode
Set the node's state flag.- Specified by:
setState
in interfaceINode
- Parameters:
s
- one of the constants defined in theINodeState
interface.
-
getPath
public java.lang.String getPath()
Description copied from interface:INode
Get the node's path.
-
getFullName
public java.lang.String getFullName(INode root)
-
setName
public void setName(java.lang.String name)
Description copied from interface:INode
Set the node's name.
-
getPrototype
public java.lang.String getPrototype()
Description copied from interface:INode
Return the node's prototype name.- Specified by:
getPrototype
in interfaceINode
- Specified by:
getPrototype
in interfaceIPathElement
-
setPrototype
public void setPrototype(java.lang.String proto)
Description copied from interface:INode
Set the node's prototype name.- Specified by:
setPrototype
in interfaceINode
-
getParent
public INode getParent()
Description copied from interface:INode
Get the node's parent node.
-
setSubnodeRelation
public void setSubnodeRelation(java.lang.String rel)
Description copied from interface:INode
Set an explicit select clause for the node's subnodes- Specified by:
setSubnodeRelation
in interfaceINode
-
getSubnodeRelation
public java.lang.String getSubnodeRelation()
Description copied from interface:INode
Get the node's explicit subnode select clause if one was set, or null- Specified by:
getSubnodeRelation
in interfaceINode
-
numberOfNodes
public int numberOfNodes()
Description copied from interface:INode
Get the number the node's direct child nodes.- Specified by:
numberOfNodes
in interfaceINode
-
addNode
public INode addNode(INode elem)
Description copied from interface:INode
Add a child node to this node.
-
addNode
public INode addNode(INode elem, int where)
Description copied from interface:INode
Add a child node to this node at the given position
-
createNode
public INode createNode()
-
createNode
public INode createNode(int where)
-
createNode
public INode createNode(java.lang.String nm)
Description copied from interface:INode
Create a new named property with a node value- Specified by:
createNode
in interfaceINode
-
createNode
public INode createNode(java.lang.String nm, int where)
Description copied from interface:INode
Create a new unnamed child node at the given position.- Specified by:
createNode
in interfaceINode
-
getParentElement
public IPathElement getParentElement()
Description copied from interface:IPathElement
Return the parent element of this object.- Specified by:
getParentElement
in interfaceIPathElement
-
getChildElement
public IPathElement getChildElement(java.lang.String name)
Description copied from interface:IPathElement
Retrieve a child element of this object by name.- Specified by:
getChildElement
in interfaceIPathElement
-
getSubnode
public INode getSubnode(java.lang.String name)
Description copied from interface:INode
Get a named child node with the given name or id.- Specified by:
getSubnode
in interfaceINode
-
getSubnodeAt
public INode getSubnodeAt(int index)
Description copied from interface:INode
GEt an unnamed child node at the given position- Specified by:
getSubnodeAt
in interfaceINode
-
contains
public int contains(INode n)
Description copied from interface:INode
Returns the position of the child or -1.
-
remove
public boolean remove()
Description copied from interface:INode
Remove this node from the database.
-
removeNode
public void removeNode(INode node)
Description copied from interface:INode
Remove the given node from this node's child nodes.- Specified by:
removeNode
in interfaceINode
-
releaseNode
protected void releaseNode(INode node)
"Physically" remove a subnode from the subnodes table. the logical stuff necessary for keeping data consistent is done elsewhere (in removeNode).
-
getSubnodes
public java.util.Enumeration getSubnodes()
Description copied from interface:INode
Get an enumeration of this node's unnamed child nodes- Specified by:
getSubnodes
in interfaceINode
- Returns:
- ...
-
properties
public java.util.Enumeration properties()
property-related- Specified by:
properties
in interfaceINode
-
get
public IProperty get(java.lang.String propname)
Description copied from interface:INode
Get a property with the given name.
-
getString
public java.lang.String getString(java.lang.String propname, java.lang.String defaultValue)
-
getString
public java.lang.String getString(java.lang.String propname)
Description copied from interface:INode
Get a string property with the given name.
-
getInteger
public long getInteger(java.lang.String propname)
Description copied from interface:INode
Get an integer property with the given name.- Specified by:
getInteger
in interfaceINode
-
getFloat
public double getFloat(java.lang.String propname)
Description copied from interface:INode
Get a float property with the given name.
-
getDate
public java.util.Date getDate(java.lang.String propname)
Description copied from interface:INode
Get a date property with the given name.
-
getBoolean
public boolean getBoolean(java.lang.String propname)
Description copied from interface:INode
Get a boolean property with the given name.- Specified by:
getBoolean
in interfaceINode
-
getNode
public INode getNode(java.lang.String propname)
Description copied from interface:INode
Get a node property with the given name.
-
getJavaObject
public java.lang.Object getJavaObject(java.lang.String propname)
Description copied from interface:INode
Get a Java object property with the given name.- Specified by:
getJavaObject
in interfaceINode
-
setString
public void setString(java.lang.String propname, java.lang.String value)
Description copied from interface:INode
Set the property with the given name to the given string value.
-
setInteger
public void setInteger(java.lang.String propname, long value)
Description copied from interface:INode
Set the property with the given name to the given integer value.- Specified by:
setInteger
in interfaceINode
-
setFloat
public void setFloat(java.lang.String propname, double value)
Description copied from interface:INode
Set the property with the given name to the given float value.
-
setBoolean
public void setBoolean(java.lang.String propname, boolean value)
Description copied from interface:INode
Set the property with the given name to the given boolean value.- Specified by:
setBoolean
in interfaceINode
-
setDate
public void setDate(java.lang.String propname, java.util.Date value)
Description copied from interface:INode
Set the property with the given name to the given date value.
-
setJavaObject
public void setJavaObject(java.lang.String propname, java.lang.Object value)
Description copied from interface:INode
Set the property with the given name to the given Java object value.- Specified by:
setJavaObject
in interfaceINode
-
setNode
public void setNode(java.lang.String propname, INode value)
Description copied from interface:INode
Set the property with the given name to the given node value.
-
unset
public void unset(java.lang.String propname)
Description copied from interface:INode
Unset the property with the given name..
-
lastModified
public long lastModified()
Description copied from interface:INode
Get the node's last modification timestamp.- Specified by:
lastModified
in interfaceINode
-
created
public long created()
Description copied from interface:INode
Get the node's creation timestamp.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getCacheNode
public INode getCacheNode()
Get the cache node for this node. This can be used to store transient cache data per node from Javascript.- Specified by:
getCacheNode
in interfaceINode
-
clearCacheNode
public void clearCacheNode()
Reset the cache node for this node.- Specified by:
clearCacheNode
in interfaceINode
-
-