|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecthelma.objectmodel.db.Node
public final class Node
An implementation of INode that can be stored in the internal database or an external relational database.
| Field Summary | |
|---|---|
protected boolean |
anonymous
|
protected long |
created
|
protected long |
lastmodified
|
protected NodeHandle |
parentHandle
|
protected short |
version
|
| Fields inherited from interface helma.objectmodel.INodeState |
|---|
CLEAN, DELETED, INVALID, MODIFIED, NEW, TRANSIENT, VIRTUAL |
| Constructor Summary | |
|---|---|
protected |
Node()
Creates an empty, uninitialized Node. |
protected |
Node(long timestamp)
Creates an empty, uninitialized Node with the given create and modify time. |
|
Node(Node home,
java.lang.String propname,
WrappedNodeManager nmgr,
java.lang.String prototype)
Constructor used for virtual nodes. |
|
Node(java.lang.String name,
java.lang.String id,
java.lang.String prototype,
WrappedNodeManager nmgr)
Creates a new Node with the given name. |
|
Node(java.lang.String name,
java.lang.String id,
java.lang.String prototype,
WrappedNodeManager nmgr,
long created,
long lastmodified)
Constructor used to create a Node with a given name from a embedded database. |
|
Node(java.lang.String name,
java.lang.String prototype,
WrappedNodeManager nmgr)
Creates a new Node with the given name. |
| Method Summary | |
|---|---|
INode |
addNode(INode elem)
INode-related |
INode |
addNode(INode elem,
int where)
Add a node to this Node's subnodes, making the added node persistent if it hasn't been before and this Node is already persistent. |
void |
clearCacheNode()
Reset the cache node for this node. |
int |
contains(INode n)
Check if the given node is contained in this node's child list. |
long |
created()
|
INode |
createNode()
|
INode |
createNode(int where)
|
INode |
createNode(java.lang.String nm)
|
INode |
createNode(java.lang.String nm,
int where)
|
SubnodeList |
createSubnodeList()
Retrieve an empty subnodelist. |
protected void |
deepRemoveNode()
Delete the node from the db. |
void |
dump()
|
IProperty |
get(java.lang.String propname)
|
boolean |
getBoolean(java.lang.String propname)
|
Node |
getCachedParent()
Get parent, using cached info if it exists. |
INode |
getCacheNode()
Get the cache node for this node. |
IPathElement |
getChildElement(java.lang.String name)
This implements the getChildElement() method of the IPathElement interface |
java.util.Date |
getDate(java.lang.String propname)
|
DbMapping |
getDbMapping()
|
java.lang.String |
getElementName()
Get something to identify this node within a URL. |
double |
getFloat(java.lang.String propname)
|
java.lang.String |
getFullName()
|
java.lang.String |
getFullName(INode root)
|
protected Node |
getGroupbySubnode(java.lang.String sid,
boolean create)
|
NodeHandle |
getHandle()
|
java.lang.String |
getID()
Get the ID of this Node. |
long |
getInteger(java.lang.String propname)
|
java.lang.Object |
getJavaObject(java.lang.String propname)
|
Key |
getKey()
|
java.lang.String |
getName()
Return this node' name, which may or may not have some meaning |
INode |
getNode(java.lang.String propname)
|
Node |
getNonVirtualParent()
This method walks down node path to the first non-virtual node and return it. |
INode |
getParent()
Get parent, retrieving it if necessary. |
IPathElement |
getParentElement()
This implements the getParentElement() method of the IPathElement interface |
java.lang.String |
getParentInfo()
|
protected Property |
getProperty(java.lang.String propname)
|
java.util.Hashtable |
getPropMap()
|
java.lang.String |
getPrototype()
Get the name of the prototype to be used for this object. |
int |
getState()
Gets this node's stateas defined in the INode interface |
java.lang.String |
getString(java.lang.String propname)
|
INode |
getSubnode(java.lang.String subid)
|
INode |
getSubnodeAt(int index)
|
SubnodeList |
getSubnodeList()
Return this Node's subnode list |
java.lang.String |
getSubnodeRelation()
|
java.util.Enumeration |
getSubnodes()
|
int |
hashCode()
We overwrite hashCode to make it dependant from the prototype. |
void |
init(DbMapping dbm,
java.lang.String id,
java.lang.String name,
java.lang.String prototype,
java.util.Hashtable propMap,
WrappedNodeManager nmgr)
Initializer used for nodes being instanced from an embedded or relational database. |
void |
invalidate()
Mark node as invalid so it is re-fetched from the database |
void |
invalidateNode(java.lang.String key)
Check for a child mapping and evict the object specified by key from the cache |
boolean |
isAnonymous()
Returns true if this node is accessed by id from its aprent, false if it is accessed by name |
boolean |
isNullNode()
Instances of this class may be used to mark an entry in the object cache as null. |
boolean |
isParentOf(Node n)
Check if the given node is contained in this node's child list. |
boolean |
isRelational()
Tell whether this node is stored inside a relational db. |
long |
lastModified()
|
void |
loadNodes()
Make sure the subnode index is loaded for subnodes stored in a relational data source. |
void |
markSubnodesChanged()
Called by the transactor on registered parent nodes to mark the child index as changed |
int |
numberOfNodes()
Count the subnodes of this node. |
void |
persist()
Public method to make a node persistent. |
void |
prefetchChildren(int startIndex,
int length)
|
void |
prefetchChildren(Key[] keys)
|
java.util.Enumeration |
properties()
Get all properties of this node. |
protected void |
releaseNode(Node node)
"Locally" remove a subnode from the subnodes table. |
boolean |
remove()
|
void |
removeNode(INode node)
|
protected void |
set(java.lang.String propname,
java.lang.Object value,
int type)
Directly set a property on this node |
void |
setBoolean(java.lang.String propname,
boolean value)
|
void |
setDate(java.lang.String propname,
java.util.Date value)
|
void |
setDbMapping(DbMapping dbmap)
|
void |
setFloat(java.lang.String propname,
double value)
|
void |
setInteger(java.lang.String propname,
long value)
|
void |
setJavaObject(java.lang.String propname,
java.lang.Object value)
|
void |
setName(java.lang.String name)
|
void |
setNode(java.lang.String propname,
INode value)
|
void |
setParent(Node parent)
Set this node's parent node. |
void |
setParentHandle(NodeHandle parent)
Set this node's parent node to the node referred to by the NodeHandle. |
void |
setPropMap(java.util.Hashtable propMap)
used by Xml deserialization |
void |
setPrototype(java.lang.String proto)
|
void |
setState(int s)
Sets this node's state as defined in the INode interface |
void |
setString(java.lang.String propname,
java.lang.String value)
|
void |
setSubnodeRelation(java.lang.String rel)
|
void |
setSubnodes(SubnodeList subnodes)
used by Xml deserialization |
void |
setWrappedNodeManager(WrappedNodeManager nmgr)
|
java.lang.String |
toString()
Return a string representation for this node. |
void |
unset(java.lang.String propname)
Remove a property. |
int |
updateSubnodes()
This method get's called from the JavaScript environment (HopObject.updateSubnodes() or HopObject.collection.updateSubnodes())) The subnode-collection will be updated with a selectstatement getting all Nodes having a higher id than the highest id currently contained within this Node's subnoderelation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected NodeHandle parentHandle
protected long created
protected long lastmodified
protected boolean anonymous
protected short version
| Constructor Detail |
|---|
protected Node()
protected Node(long timestamp)
timestamp -
public Node(java.lang.String name,
java.lang.String id,
java.lang.String prototype,
WrappedNodeManager nmgr)
public Node(java.lang.String name,
java.lang.String id,
java.lang.String prototype,
WrappedNodeManager nmgr,
long created,
long lastmodified)
public Node(Node home,
java.lang.String propname,
WrappedNodeManager nmgr,
java.lang.String prototype)
public Node(java.lang.String name,
java.lang.String prototype,
WrappedNodeManager nmgr)
| Method Detail |
|---|
public void init(DbMapping dbm,
java.lang.String id,
java.lang.String name,
java.lang.String prototype,
java.util.Hashtable propMap,
WrappedNodeManager nmgr)
public void setPropMap(java.util.Hashtable propMap)
public void setSubnodes(SubnodeList subnodes)
public void markSubnodesChanged()
public int getState()
getState in interface INodepublic void setState(int s)
setState in interface INodes - this node's new statepublic void invalidate()
public void invalidateNode(java.lang.String key)
public java.lang.String getID()
getID in interface INodepublic boolean isAnonymous()
isAnonymous in interface INodepublic java.lang.String getName()
getName in interface INodepublic java.lang.String getElementName()
getElementName in interface IPathElementpublic java.lang.String getFullName()
getFullName in interface INodepublic java.lang.String getFullName(INode root)
getFullName in interface INoderoot - ...
public java.lang.String getPrototype()
IPathElement
getPrototype in interface IPathElementgetPrototype in interface INodepublic void setPrototype(java.lang.String proto)
setPrototype in interface INodeproto - ...public void setDbMapping(DbMapping dbmap)
setDbMapping in interface INodedbmap - ...public DbMapping getDbMapping()
getDbMapping in interface INodepublic void setWrappedNodeManager(WrappedNodeManager nmgr)
nmgr - public Key getKey()
public NodeHandle getHandle()
public void setSubnodeRelation(java.lang.String rel)
setSubnodeRelation in interface INoderel - ...public java.lang.String getSubnodeRelation()
getSubnodeRelation in interface INodepublic void setName(java.lang.String name)
setName in interface INodename - ...public void setParent(Node parent)
public void setParentHandle(NodeHandle parent)
public INode getParent()
getParent in interface INodepublic Node getCachedParent()
public INode addNode(INode elem)
addNode in interface INodeelem - ...
public INode addNode(INode elem,
int where)
addNode in interface INodeelem - the node to add to this Nodes subnode-listwhere - the index-position where this node has to be added
public INode createNode()
public INode createNode(int where)
where - ...
public INode createNode(java.lang.String nm)
createNode in interface INodenm - ...
public INode createNode(java.lang.String nm,
int where)
createNode in interface INodenm - ...where - ...
public IPathElement getChildElement(java.lang.String name)
getChildElement in interface IPathElementpublic IPathElement getParentElement()
getParentElement in interface IPathElementpublic INode getSubnode(java.lang.String subid)
getSubnode in interface INodesubid - ...
public INode getSubnodeAt(int index)
getSubnodeAt in interface INodeindex - ...
protected Node getGroupbySubnode(java.lang.String sid,
boolean create)
sid - ...create - ...
public boolean remove()
remove in interface INodepublic void removeNode(INode node)
removeNode in interface INodenode - ...protected void releaseNode(Node node)
removeNode(INode).
protected void deepRemoveNode()
public int contains(INode n)
contains in interface INoden - a node
public boolean isParentOf(Node n)
contains(INode) but does not load the
child index for relational nodes.
n - a node
public int numberOfNodes()
numberOfNodes in interface INodepublic void loadNodes()
public SubnodeList createSubnodeList()
public void prefetchChildren(int startIndex,
int length)
throws java.lang.Exception
startIndex - ...length - ...
java.lang.Exception - ...
public void prefetchChildren(Key[] keys)
throws java.lang.Exception
java.lang.Exceptionpublic java.util.Enumeration getSubnodes()
getSubnodes in interface INodepublic SubnodeList getSubnodeList()
public java.util.Enumeration properties()
properties in interface INodepublic java.util.Hashtable getPropMap()
public IProperty get(java.lang.String propname)
get in interface INodepropname - ...
public java.lang.String getParentInfo()
protected Property getProperty(java.lang.String propname)
propname - ...
public java.lang.String getString(java.lang.String propname)
getString in interface INodepropname - ...
public long getInteger(java.lang.String propname)
getInteger in interface INodepropname - ...
public double getFloat(java.lang.String propname)
getFloat in interface INodepropname - ...
public java.util.Date getDate(java.lang.String propname)
getDate in interface INodepropname - ...
public boolean getBoolean(java.lang.String propname)
getBoolean in interface INodepropname - ...
public INode getNode(java.lang.String propname)
getNode in interface INodepropname - ...
public java.lang.Object getJavaObject(java.lang.String propname)
getJavaObject in interface INodepropname - ...
protected void set(java.lang.String propname,
java.lang.Object value,
int type)
propname - ...value - ...
public void setString(java.lang.String propname,
java.lang.String value)
setString in interface INodepropname - ...value - ...
public void setInteger(java.lang.String propname,
long value)
setInteger in interface INodepropname - ...value - ...
public void setFloat(java.lang.String propname,
double value)
setFloat in interface INodepropname - ...value - ...
public void setBoolean(java.lang.String propname,
boolean value)
setBoolean in interface INodepropname - ...value - ...
public void setDate(java.lang.String propname,
java.util.Date value)
setDate in interface INodepropname - ...value - ...
public void setJavaObject(java.lang.String propname,
java.lang.Object value)
setJavaObject in interface INodepropname - ...value - ...
public void setNode(java.lang.String propname,
INode value)
setNode in interface INodepropname - ...value - ...public void unset(java.lang.String propname)
unset in interface INodepropname - ...public long lastModified()
lastModified in interface INodepublic long created()
created in interface INodepublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isRelational()
public void persist()
public INode getCacheNode()
getCacheNode in interface INodepublic void clearCacheNode()
clearCacheNode in interface INodepublic Node getNonVirtualParent()
public boolean isNullNode()
public int hashCode()
hashCode in class java.lang.Objectpublic void dump()
public int updateSubnodes()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||