org.erif.util
Class DbTree

java.lang.Object
  |
  +--org.erif.util.DbTree

public class DbTree
extends java.lang.Object


Field Summary
protected  long depth
           
protected  long forestid
           
protected  long id
           
protected  long left
           
protected  long right
           
protected  long treeid
           
 
Constructor Summary
DbTree()
           
 
Method Summary
 DbTree addNode(long id, java.sql.Connection conn)
           
static DbTree create(long id, java.sql.Connection conn)
           
static DbTree create(long forestid, long id, java.sql.Connection conn)
           
 boolean equals(java.lang.Object o)
           
 DbTree[] getChildren(java.sql.Connection conn)
          returns all nodes "below" the given node
 long getChildrenCount()
           
 long getDepth()
           
 DbTree[] getDirectChildren(java.sql.Connection conn)
          returns all nodes "below" the given node
 long getForestId()
           
 long getId()
           
 long getLeft()
           
 DbTree[] getParents(java.sql.Connection conn)
          returns all nodes "above" the given node
static long[] getRefIds(DbTree[] treenodes)
           
static java.util.Hashtable getReverseHash(DbTree[] treenodes)
          returns a hash from refid to the actual DbTree node
 long getRight()
           
static DbTree[] getThread(long treeid, java.sql.Connection conn)
          returns the thread of treeid in the default forest
static DbTree[] getThread(long forestid, long treeid, java.sql.Connection conn)
          returns the thread of treeid in the given forest
static DbTree[] getTopLevel(java.sql.Connection conn)
           
static DbTree[] getTopLevel(long forestid, java.sql.Connection conn)
           
static DbTree getTopOfThread(long id, java.sql.Connection conn)
          returns the "top" treenode for the given refid for the default forest
static DbTree getTopOfThread(long forestid, long id, java.sql.Connection conn)
          returns the "top" treenode for the given refid and forest
static DbTree getTree(long id, java.sql.Connection conn)
          returns treenode for the given refid for the default forest
static DbTree getTree(long forestid, long id, java.sql.Connection conn)
          returns treenode for the given refid and forest
 long getTreeId()
           
 void init(java.sql.ResultSet rs)
           
 void remove(java.sql.Connection conn)
          removes the given node (nodes need to be unique to their tree, else ALL references will be removed when one is, and things won't update properly).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

forestid

protected long forestid

treeid

protected long treeid

id

protected long id

left

protected long left

right

protected long right

depth

protected long depth
Constructor Detail

DbTree

public DbTree()
Method Detail

getForestId

public long getForestId()

getTreeId

public long getTreeId()

getDepth

public long getDepth()

getLeft

public long getLeft()

getRight

public long getRight()

getId

public long getId()

getChildrenCount

public long getChildrenCount()

getParents

public DbTree[] getParents(java.sql.Connection conn)
                    throws java.sql.SQLException
returns all nodes "above" the given node

getDirectChildren

public DbTree[] getDirectChildren(java.sql.Connection conn)
                           throws java.sql.SQLException
returns all nodes "below" the given node

getChildren

public DbTree[] getChildren(java.sql.Connection conn)
                     throws java.sql.SQLException
returns all nodes "below" the given node

remove

public void remove(java.sql.Connection conn)
            throws java.sql.SQLException
removes the given node (nodes need to be unique to their tree, else ALL references will be removed when one is, and things won't update properly). Ideally this would roll back if more than one thing was deleted.

create

public static DbTree create(long id,
                            java.sql.Connection conn)
                     throws java.sql.SQLException

create

public static DbTree create(long forestid,
                            long id,
                            java.sql.Connection conn)
                     throws java.sql.SQLException

addNode

public DbTree addNode(long id,
                      java.sql.Connection conn)
               throws java.sql.SQLException

init

public void init(java.sql.ResultSet rs)
          throws java.sql.SQLException

getTree

public static DbTree getTree(long id,
                             java.sql.Connection conn)
                      throws java.sql.SQLException
returns treenode for the given refid for the default forest

getTree

public static DbTree getTree(long forestid,
                             long id,
                             java.sql.Connection conn)
                      throws java.sql.SQLException
returns treenode for the given refid and forest

getTopOfThread

public static DbTree getTopOfThread(long id,
                                    java.sql.Connection conn)
                             throws java.sql.SQLException
returns the "top" treenode for the given refid for the default forest

getTopOfThread

public static DbTree getTopOfThread(long forestid,
                                    long id,
                                    java.sql.Connection conn)
                             throws java.sql.SQLException
returns the "top" treenode for the given refid and forest

getThread

public static DbTree[] getThread(long treeid,
                                 java.sql.Connection conn)
                          throws java.sql.SQLException
returns the thread of treeid in the default forest

getThread

public static DbTree[] getThread(long forestid,
                                 long treeid,
                                 java.sql.Connection conn)
                          throws java.sql.SQLException
returns the thread of treeid in the given forest

getTopLevel

public static DbTree[] getTopLevel(java.sql.Connection conn)
                            throws java.sql.SQLException

getTopLevel

public static DbTree[] getTopLevel(long forestid,
                                   java.sql.Connection conn)
                            throws java.sql.SQLException

getRefIds

public static long[] getRefIds(DbTree[] treenodes)

getReverseHash

public static java.util.Hashtable getReverseHash(DbTree[] treenodes)
returns a hash from refid to the actual DbTree node

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright © 2003 - kaolin fire