Class 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
    • 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 position
      void 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 value
      INode 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's DbMapping.
      java.lang.String getElementName()
      Return the name to be used to get this element from its parent
      double 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 position
      java.lang.String getSubnodeRelation()
      Get the node's explicit subnode select clause if one was set, or null
      java.util.Enumeration getSubnodes()
      Get an enumeration of this node's unnamed child nodes
      boolean 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-related
      protected 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's DbMapping.
      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 subnodes
      java.lang.String toString()  
      void unset​(java.lang.String propname)
      Unset the property with the given name..
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • propMap

        protected java.util.Hashtable propMap
      • nodeMap

        protected java.util.Hashtable nodeMap
      • nodes

        protected java.util.Vector nodes
      • 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()
      • getID

        public java.lang.String getID()
        Description copied from interface: INode
        Get the node's ID.
        Specified by:
        getID in interface INode
      • isAnonymous

        public boolean isAnonymous()
        Description copied from interface: INode
        Returns true if this node is an unnamed node.
        Specified by:
        isAnonymous in interface INode
      • getName

        public java.lang.String getName()
        Description copied from interface: INode
        Get the node's name.
        Specified by:
        getName in interface INode
      • 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 interface IPathElement
      • getState

        public int getState()
        Description copied from interface: INode
        Get the node's state flag.
        Specified by:
        getState in interface INode
        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 interface INode
        Parameters:
        s - one of the constants defined in the INodeState interface.
      • getPath

        public java.lang.String getPath()
        Description copied from interface: INode
        Get the node's path.
        Specified by:
        getPath in interface INode
      • 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.
        Specified by:
        setName in interface INode
      • getPrototype

        public java.lang.String getPrototype()
        Description copied from interface: INode
        Return the node's prototype name.
        Specified by:
        getPrototype in interface INode
        Specified by:
        getPrototype in interface IPathElement
      • setPrototype

        public void setPrototype​(java.lang.String proto)
        Description copied from interface: INode
        Set the node's prototype name.
        Specified by:
        setPrototype in interface INode
      • getParent

        public INode getParent()
        Description copied from interface: INode
        Get the node's parent node.
        Specified by:
        getParent in interface INode
      • 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 interface INode
      • 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 interface INode
      • numberOfNodes

        public int numberOfNodes()
        Description copied from interface: INode
        Get the number the node's direct child nodes.
        Specified by:
        numberOfNodes in interface INode
      • addNode

        public INode addNode​(INode elem)
        Description copied from interface: INode
        Add a child node to this node.
        Specified by:
        addNode in interface INode
      • addNode

        public INode addNode​(INode elem,
                             int where)
        Description copied from interface: INode
        Add a child node to this node at the given position
        Specified by:
        addNode in interface INode
      • 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 interface INode
      • 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 interface INode
      • 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 interface INode
      • getSubnodeAt

        public INode getSubnodeAt​(int index)
        Description copied from interface: INode
        GEt an unnamed child node at the given position
        Specified by:
        getSubnodeAt in interface INode
      • contains

        public int contains​(INode n)
        Description copied from interface: INode
        Returns the position of the child or -1.
        Specified by:
        contains in interface INode
      • remove

        public boolean remove()
        Description copied from interface: INode
        Remove this node from the database.
        Specified by:
        remove in interface INode
      • 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 interface INode
      • 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 interface INode
        Returns:
        ...
      • properties

        public java.util.Enumeration properties()
        property-related
        Specified by:
        properties in interface INode
      • get

        public IProperty get​(java.lang.String propname)
        Description copied from interface: INode
        Get a property with the given name.
        Specified by:
        get in interface INode
      • 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.
        Specified by:
        getString in interface INode
      • 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 interface INode
      • getFloat

        public double getFloat​(java.lang.String propname)
        Description copied from interface: INode
        Get a float property with the given name.
        Specified by:
        getFloat in interface INode
      • getDate

        public java.util.Date getDate​(java.lang.String propname)
        Description copied from interface: INode
        Get a date property with the given name.
        Specified by:
        getDate in interface INode
      • 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 interface INode
      • getNode

        public INode getNode​(java.lang.String propname)
        Description copied from interface: INode
        Get a node property with the given name.
        Specified by:
        getNode in interface INode
      • 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 interface INode
      • 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.
        Specified by:
        setString in interface INode
      • 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 interface INode
      • 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.
        Specified by:
        setFloat in interface INode
      • 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 interface INode
      • 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.
        Specified by:
        setDate in interface INode
      • 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 interface INode
      • 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.
        Specified by:
        setNode in interface INode
      • unset

        public void unset​(java.lang.String propname)
        Description copied from interface: INode
        Unset the property with the given name..
        Specified by:
        unset in interface INode
      • lastModified

        public long lastModified()
        Description copied from interface: INode
        Get the node's last modification timestamp.
        Specified by:
        lastModified in interface INode
      • created

        public long created()
        Description copied from interface: INode
        Get the node's creation timestamp.
        Specified by:
        created in interface INode
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.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 interface INode
      • clearCacheNode

        public void clearCacheNode()
        Reset the cache node for this node.
        Specified by:
        clearCacheNode in interface INode