org.greenstone.gs3client.data
Class ClassifierNodeData

java.lang.Object
  extended by org.greenstone.gs3client.data.NodeData
      extended by org.greenstone.gs3client.data.ClassifierNodeData

public class ClassifierNodeData
extends NodeData

ClassifierNodeData represents the information that can be stored in a <classifierNode> element. A ClassifierNode may have children and further descendents of type NodeData: either of type DocumentNodeData or type ClassifierNodeData.

Author:
ak19

Field Summary
(package private)  NodeData[] childnodes
          Children (of this NodeData) as given in a nodeStructure, which can be ClassifierNodeData or DocumentNodeData.
 
Fields inherited from class org.greenstone.gs3client.data.NodeData
hasChildren, nodeID, nodeMetadata, nodeTag
 
Constructor Summary
ClassifierNodeData(org.w3c.dom.Element classifierNodeTag)
          Constructor that given a classifierNode element creates a ClassifierNodeData instance to parse and store its data.
 
Method Summary
 NodeData[] getChildren()
          Gets the children of this node, but does not guarantee that *their* children are set.
 void setChildren(java.util.Map idsToNodes_map)
          Given a map of nodeIdsToNodes, this method instantiates any children this ClassifierNodeData object might have.
 void setTitle(java.lang.String name)
          This method is mainly useful for setting the top-level/root classifierNode's name.
 java.lang.String show()
           
 
Methods inherited from class org.greenstone.gs3client.data.NodeData
getMetadataList, getTitle, setChildren, setMetadataList, showMeta, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

childnodes

NodeData[] childnodes
Children (of this NodeData) as given in a nodeStructure, which can be ClassifierNodeData or DocumentNodeData.

Constructor Detail

ClassifierNodeData

public ClassifierNodeData(org.w3c.dom.Element classifierNodeTag)
Constructor that given a classifierNode element creates a ClassifierNodeData instance to parse and store its data. A classifierNodeData <classifierNode> contains just a nodeID and can contain children. When a response for a classifierNode's children is returned in a <nodeStructure>, this can be used to set the children. This classifierNodeData object is constructed from the data encapsulated in a <classifierNode> element

Parameters:
classifierNodeTag - is the <classifierNode> element in a Greenstone3 response XML message
Method Detail

setTitle

public void setTitle(java.lang.String name)
This method is mainly useful for setting the top-level/root classifierNode's name. Otherwise, can use method setMetadataList to set the various metadata (name, values) associated with a classifierNode. Adds a new title to nodeMetadata as long as it is not the same as the previous title added.

Parameters:
name - is the previous title added

setChildren

public void setChildren(java.util.Map idsToNodes_map)
Given a map of nodeIdsToNodes, this method instantiates any children this ClassifierNodeData object might have. This method will set member childnodes (or leave it at none) and update idsToNodes_map as necessary.

Parameters:
idsToNodes_map - is a Hashmap of all the Node IDs to Node objects being maintained (Classifier- or DocumentNode)

getChildren

public NodeData[] getChildren()
Gets the children of this node, but does not guarantee that *their* children are set. Will return null either if this NodeData has no children or if this node's children are not set yet.

Specified by:
getChildren in class NodeData
Returns:
an array of all the child Nodes of this ClassifierNode (as per its hierarchical structure) or null if these are not yet set or if it has no children

show

public java.lang.String show()
Overrides:
show in class NodeData
Returns:
a string representation of the values stored in this ClassifierNodeData object: outputs the nodeID and calls show() on any children NodeData objects. It's mainly useful for debugging purposes.