org.greenstone.gs3client.data
Class BrowseResponseData

java.lang.Object
  extended by org.greenstone.gs3client.data.ResponseData
      extended by org.greenstone.gs3client.data.BrowseResponseData

public class BrowseResponseData
extends ResponseData

Stores the data contained in an XML response message to a request for the classification Browse structure. An object of this class can be reused after instatiation by calling setResponseData() with a new browse response XML message. This will first call clear() to clear/release its references to all the old data.

Author:
ak19

Field Summary
protected  ClassifierNodeData rootClassifierNode
          Reference to the root browse classifier, which may contain further descendent classifierNodes or documentNodes.
 
Fields inherited from class org.greenstone.gs3client.data.ResponseData
nodeIDsToNodes
 
Constructor Summary
BrowseResponseData()
          Default constructor
 
Method Summary
 void clear()
          Resets the internal data members of this BrowseResponseData object of their values so that this BrowseResponseData can be reused for the next Browse response message.
 java.util.Map getIDToNodeMapping()
           
 ClassifierNodeData getRootClassifier()
           
 boolean setMetadataForClassifiers(org.w3c.dom.Element messageTag)
          Given the response message element to a metadata request on <classifierNode>s;, this method sets those classifierNodes' metadata.
 void setResponseData(org.w3c.dom.Element responseMsgTag)
          Given an XML responseMessage to a request for the classification Browse structure, this method sets its nodeIDsToNodes member variable by instantiating classifierNodeData and/or documentNodeData objects as given in the responseMessageTag.
 java.lang.String show()
          Overloaded method to produce a String output of the data contained in this BrowseResponseMessage.
 
Methods inherited from class org.greenstone.gs3client.data.ResponseData
getNodeForID, setContentForDocs, setMetadataForDocuments, setMetadataForNodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootClassifierNode

protected ClassifierNodeData rootClassifierNode
Reference to the root browse classifier, which may contain further descendent classifierNodes or documentNodes.

Constructor Detail

BrowseResponseData

public BrowseResponseData()
Default constructor

Method Detail

clear

public void clear()
Resets the internal data members of this BrowseResponseData object of their values so that this BrowseResponseData can be reused for the next Browse response message.

Overrides:
clear in class ResponseData

setResponseData

public void setResponseData(org.w3c.dom.Element responseMsgTag)
Given an XML responseMessage to a request for the classification Browse structure, this method sets its nodeIDsToNodes member variable by instantiating classifierNodeData and/or documentNodeData objects as given in the responseMessageTag. This method will not process all descendents of a classifierNode, but only those that are children of the top level classifierNode. The responseMessageTag contains *all the descendents* in one go. But we don't set all the descendents, just the children of the rootClassifierNode. However, as we store the responseMsgTag in pieces (each child NodeData stores the bit relevant to it), we will work out the children of each child etc as needed.

Specified by:
setResponseData in class ResponseData
Parameters:
responseMsgTag - is the the XML DOM Element representing a browse response XML message.

setMetadataForClassifiers

public boolean setMetadataForClassifiers(org.w3c.dom.Element messageTag)
Given the response message element to a metadata request on <classifierNode>s;, this method sets those classifierNodes' metadata. It merely calls the the superclass' setMetadataForDocuments(messageTag, tagName) method to parse out data for the tagName=<classifierNode>.

Parameters:
messageTag - - the response message Element to a metadata request on <classifierNode>s

getRootClassifier

public ClassifierNodeData getRootClassifier()
Returns:
the ClassifierNode representing the top-level/root <classifierNode> in the Browse response.

getIDToNodeMapping

public java.util.Map getIDToNodeMapping()
Overrides:
getIDToNodeMapping in class ResponseData
Returns:
the hashMap of mappings from nodeIDs to DocumentNodeData object references

show

public java.lang.String show()
Overloaded method to produce a String output of the data contained in this BrowseResponseMessage. It merely calls rootClassifierNode.show()

Returns:
a String representation of the data in this BrowseResponseMessage