cug.ptree
Class PTreeBuilder

java.lang.Object
  |
  +--cug.ptree.PTreeBuilder

public class PTreeBuilder
extends java.lang.Object

builder for ptree incl. jdbc based persistence layer


Field Summary
(package private)  PTreeAttsTable atable
           
private  java.util.List attList
          list of attributes (ptree#, key, value) (contents of PTreeAttsTable) ??
(package private) static Category cat
           
private  java.util.List members
          list of all membershiprecords (ptree#, person#, role) (contents of PTreeMemberTable)
(package private)  PTreeMemberTable mtable
           
(package private)  PersonTable ptable
           
(package private)  PTreeTable pttable
           
private  java.util.List treeList
          list of all PTree roots held by builder
private  java.util.Map treeMap
          map of all nodes held by builder; code -> PTree if builder uses tables to build: contentsMap of PTreeTable
 
Constructor Summary
PTreeBuilder()
           
PTreeBuilder(DataSource ds)
          connect to default tables on param DataSource
PTreeBuilder(PersonTable ptable, PTreeTable pttable, PTreeMemberTable mtable, PTreeAttsTable atable)
          connect to 4 param tables
 
Method Summary
 void addPTree(PTree root)
          add this PTree if it's a root; (build index)
 void buildFromTables()
           
protected  java.util.Vector getAttributes(PTree root)
           
protected  java.util.Vector getMembership(PTree pt)
           
 PTree getPTree(java.lang.String code)
          lookup PTree in list
 void rebuild()
           
 void removeAll()
           
 void storePersons()
          delete contents of person table and fill with all persons in all trees in treelist
 void storePersons(PTree pt)
           
 void storeTree(PTree t)
          store 1 ptree
 void storeTrees()
          delete contents of ptree-, ptreemember and ptreeatts table and fill with all trees in treeList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ptable

PersonTable ptable

pttable

PTreeTable pttable

mtable

PTreeMemberTable mtable

atable

PTreeAttsTable atable

cat

static Category cat

treeMap

private java.util.Map treeMap
map of all nodes held by builder; code -> PTree if builder uses tables to build: contentsMap of PTreeTable


members

private java.util.List members
list of all membershiprecords (ptree#, person#, role) (contents of PTreeMemberTable)

See Also:
PTreeMemberRec

treeList

private java.util.List treeList
list of all PTree roots held by builder


attList

private java.util.List attList
list of attributes (ptree#, key, value) (contents of PTreeAttsTable) ?? only used in buildPTrees?

See Also:
PTreeAttRec
Constructor Detail

PTreeBuilder

public PTreeBuilder()

PTreeBuilder

public PTreeBuilder(DataSource ds)
connect to default tables on param DataSource


PTreeBuilder

public PTreeBuilder(PersonTable ptable,
                    PTreeTable pttable,
                    PTreeMemberTable mtable,
                    PTreeAttsTable atable)
connect to 4 param tables

Method Detail

removeAll

public void removeAll()

getPTree

public PTree getPTree(java.lang.String code)
lookup PTree in list

Returns:
PTree or null if not found

rebuild

public void rebuild()

addPTree

public void addPTree(PTree root)
add this PTree if it's a root; (build index)


getMembership

protected java.util.Vector getMembership(PTree pt)
Returns:
Vector v; item-type PTreeMemberRec

getAttributes

protected java.util.Vector getAttributes(PTree root)
Returns:
Vector v; item-type PTreeAttRec

storeTree

public void storeTree(PTree t)
               throws java.lang.Exception
store 1 ptree

java.lang.Exception

storeTrees

public void storeTrees()
                throws java.lang.Exception
delete contents of ptree-, ptreemember and ptreeatts table and fill with all trees in treeList

java.lang.Exception

storePersons

public void storePersons()
                  throws java.lang.Exception
delete contents of person table and fill with all persons in all trees in treelist

java.lang.Exception

storePersons

public void storePersons(PTree pt)
                  throws java.lang.Exception
java.lang.Exception

buildFromTables

public void buildFromTables()
                     throws java.lang.Exception
Returns:
List of PTree roots found in table
java.lang.Exception