uk.ac.ic.doc.automed.p2p.tree
Class TreeNode

java.lang.Object
  extended by uk.ac.ic.doc.automed.p2p.tree.TreeNode
Direct Known Subclasses:
AutoMedObject, CollectionSet, Field, MainObjectClasses, ObjectCollection, Root, Value

public abstract class TreeNode
extends java.lang.Object

Author:
Charis TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Field Summary
protected  java.util.Map children
           
static java.lang.String CLASS
           
static java.lang.String COLLECTION
           
static java.lang.String COLLECTION_SET
           
static java.lang.String FIELD
           
static java.lang.String GLOBAL
           
protected  java.lang.Object id
           
static java.lang.String ID
           
static java.lang.String LIST
           
static java.lang.String MAIN_OBJECT_CLASSES
           
static java.lang.String OBJECT
           
static java.lang.String OBJECT_DEFINITION
           
static java.lang.String OBJECT_LIST
           
protected  TreeNode parent
           
static java.lang.String REF
           
static java.lang.String VALUE
           
 
Constructor Summary
TreeNode(java.lang.Object id)
           
 
Method Summary
 void addChild(TreeNode child)
           
protected static AutoMedObject createObjectNode(PersistentObject po)
           
static Root createTree(PersistentObject po)
           
static Root createTree(PersistentObject[] persistentObjects)
           
 TreeNode getChild(java.lang.Object id)
           
 java.util.List getChildren()
           
 java.lang.Object getId()
           
private static Value getValueNode(java.lang.Object value)
           
 org.w3c.dom.Document getXMLDocument()
          Build a simple XML document for this node.
protected abstract  org.w3c.dom.Node getXMLNode(org.w3c.dom.Document document)
           
 java.lang.String getXMLString()
          Similar to getXMLDocument() but returns the XML string of the document
protected abstract  boolean isValidChild(TreeNode child)
           
protected  void placeChild(TreeNode child)
           
protected  void setId(java.lang.String id)
           
protected  void setParent(TreeNode parent)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OBJECT_DEFINITION

public static final java.lang.String OBJECT_DEFINITION
See Also:
Constant Field Values

COLLECTION_SET

public static final java.lang.String COLLECTION_SET
See Also:
Constant Field Values

MAIN_OBJECT_CLASSES

public static final java.lang.String MAIN_OBJECT_CLASSES
See Also:
Constant Field Values

COLLECTION

public static final java.lang.String COLLECTION
See Also:
Constant Field Values

LIST

public static final java.lang.String LIST
See Also:
Constant Field Values

OBJECT

public static final java.lang.String OBJECT
See Also:
Constant Field Values

ID

public static final java.lang.String ID
See Also:
Constant Field Values

FIELD

public static final java.lang.String FIELD
See Also:
Constant Field Values

CLASS

public static final java.lang.String CLASS
See Also:
Constant Field Values

GLOBAL

public static final java.lang.String GLOBAL
See Also:
Constant Field Values

REF

public static final java.lang.String REF
See Also:
Constant Field Values

VALUE

public static final java.lang.String VALUE
See Also:
Constant Field Values

OBJECT_LIST

public static final java.lang.String OBJECT_LIST
See Also:
Constant Field Values

children

protected java.util.Map children

id

protected java.lang.Object id

parent

protected TreeNode parent
Constructor Detail

TreeNode

public TreeNode(java.lang.Object id)
Method Detail

getChildren

public java.util.List getChildren()

getId

public java.lang.Object getId()

setId

protected void setId(java.lang.String id)

setParent

protected void setParent(TreeNode parent)

addChild

public void addChild(TreeNode child)
              throws AutoMedTreeException
Throws:
AutoMedTreeException

placeChild

protected void placeChild(TreeNode child)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getChild

public TreeNode getChild(java.lang.Object id)

createObjectNode

protected static AutoMedObject createObjectNode(PersistentObject po)
                                         throws AutoMedTreeException
Throws:
AutoMedTreeException

createTree

public static Root createTree(PersistentObject po)
                       throws AutoMedTreeException
Throws:
AutoMedTreeException

createTree

public static Root createTree(PersistentObject[] persistentObjects)
                       throws AutoMedTreeException
Throws:
AutoMedTreeException

getValueNode

private static Value getValueNode(java.lang.Object value)
                           throws AutoMedTreeException
Throws:
AutoMedTreeException

isValidChild

protected abstract boolean isValidChild(TreeNode child)

getXMLNode

protected abstract org.w3c.dom.Node getXMLNode(org.w3c.dom.Document document)

getXMLDocument

public org.w3c.dom.Document getXMLDocument()
Build a simple XML document for this node. This is useful in cases where we are only interested in XML representation of only a part (e.g. ObjectCollection) of a XML document tree


getXMLString

public java.lang.String getXMLString()
Similar to getXMLDocument() but returns the XML string of the document