edu.ucsb.nceas.morpho.query
Class ResultSet

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--edu.ucsb.nceas.morpho.query.ResultSet
All Implemented Interfaces:
org.xml.sax.ContentHandler, java.io.Serializable, javax.swing.table.TableModel
Direct Known Subclasses:
HeadResultSet

public class ResultSet
extends javax.swing.table.AbstractTableModel
implements org.xml.sax.ContentHandler

A ResultSet encapsulates the list of results returned from either a local query or a Metacat query. It contains a reference to its original query, so the result set can be refreshed by re-running the query. Current MetaCat query returns a element for each 'hit' in query. That element has 5 fixed children: , , , , and . Other child elements are determined by query and are returned as elements with a "name" attribute and the value as the content.

See Also:
Serialized Form

Field Summary
protected  java.util.Vector resultsVector
          Store each row of the result set as a row in a Vector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ResultSet(Query query, java.lang.String source, java.io.InputStream resultsXMLStream, ClientFramework cf)
          Construct a ResultSet instance given a query object and a InputStream that represents an XML encoding of the results.
ResultSet(Query query, java.lang.String source, java.util.Vector vec, ClientFramework cf)
          Construct a ResultSet instance from a vector of vectors; for use with LocalQuery
 
Method Summary
 void characters(char[] ch, int start, int length)
          SAX handler callback that is called for character content of an element when parsing an XML document.
 void endDocument()
          Unused SAX handler
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          SAX handler callback that is called upon the end of an element when parsing an XML document.
 void endPrefixMapping(java.lang.String prefix)
          Unused SAX handler
 java.lang.Class getColumnClass(int c)
          Return the Class for each column so that they can be rendered correctly.
 int getColumnCount()
          Return the number of columns in this result set
 java.lang.String getColumnName(int col)
          Determine the name of a column by its index
 java.lang.String getDocIdOfRecord(int row)
          Get the docid for a specific Result record for use in building a list of previous packages
 ClientFramework getFramework()
          Get a reference to the framework
 Query getQuery()
          Get the query that was used to construct these results
 java.util.Vector getResultsVector()
          get the resultsVector
 int getRowCount()
          Return the number of records in this result set
 int getRowHeight()
          Return the correct row height for table rows
 java.lang.Object getValueAt(int row, int col)
          Determine the value of a column by its row and column index
 void ignorableWhitespace(char[] cbuf, int start, int len)
          Unused SAX handler
 void merge(ResultSet r2)
          Merge a ResultSet onto this one using the docid as the join column
 void openResultRecord(int row)
          Open a given row index of the result set using a delegated handler class
protected  void openResultRecord(java.util.Vector rowVector)
          Open a given row of the result set using a delegated handler class
 void processingInstruction(java.lang.String target, java.lang.String data)
          Unused SAX handler
 void setDocumentLocator(org.xml.sax.Locator locator)
          Unused SAX handler
 void setQuery(Query query)
          Set the query that was used to construct these results (for use by LocalQuery)
 void setResultsVector(java.util.Vector rv)
          set the resultsVector
 void skippedEntity(java.lang.String name)
          Unused SAX handler
 void startDocument()
          SAX handler callback that is called when an XML document is initially parsed.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          SAX handler callback that is called upon the start of an element when parsing an XML document.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Unused SAX handler
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resultsVector

protected java.util.Vector resultsVector
Store each row of the result set as a row in a Vector
Constructor Detail

ResultSet

public ResultSet(Query query,
                 java.lang.String source,
                 java.io.InputStream resultsXMLStream,
                 ClientFramework cf)
Construct a ResultSet instance given a query object and a InputStream that represents an XML encoding of the results.

ResultSet

public ResultSet(Query query,
                 java.lang.String source,
                 java.util.Vector vec,
                 ClientFramework cf)
Construct a ResultSet instance from a vector of vectors; for use with LocalQuery
Method Detail

getResultsVector

public java.util.Vector getResultsVector()
get the resultsVector

setResultsVector

public void setResultsVector(java.util.Vector rv)
set the resultsVector

getColumnCount

public int getColumnCount()
Return the number of columns in this result set
Overrides:
getColumnCount in class javax.swing.table.AbstractTableModel

getRowCount

public int getRowCount()
Return the number of records in this result set
Overrides:
getRowCount in class javax.swing.table.AbstractTableModel

getRowHeight

public int getRowHeight()
Return the correct row height for table rows

getColumnName

public java.lang.String getColumnName(int col)
Determine the name of a column by its index
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Determine the value of a column by its row and column index
Overrides:
getValueAt in class javax.swing.table.AbstractTableModel

getColumnClass

public java.lang.Class getColumnClass(int c)
Return the Class for each column so that they can be rendered correctly.
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
SAX handler callback that is called upon the start of an element when parsing an XML document.
Specified by:
startElement in interface org.xml.sax.ContentHandler

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
SAX handler callback that is called upon the end of an element when parsing an XML document.
Specified by:
endElement in interface org.xml.sax.ContentHandler

characters

public void characters(char[] ch,
                       int start,
                       int length)
SAX handler callback that is called for character content of an element when parsing an XML document.
Specified by:
characters in interface org.xml.sax.ContentHandler

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
SAX handler callback that is called when an XML document is initially parsed.
Specified by:
startDocument in interface org.xml.sax.ContentHandler

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Unused SAX handler
Specified by:
endDocument in interface org.xml.sax.ContentHandler

ignorableWhitespace

public void ignorableWhitespace(char[] cbuf,
                                int start,
                                int len)
Unused SAX handler
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws org.xml.sax.SAXException
Unused SAX handler
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Unused SAX handler
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Unused SAX handler
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Unused SAX handler
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Unused SAX handler
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler

getQuery

public Query getQuery()
Get the query that was used to construct these results

setQuery

public void setQuery(Query query)
Set the query that was used to construct these results (for use by LocalQuery)

openResultRecord

public void openResultRecord(int row)
Open a given row index of the result set using a delegated handler class

openResultRecord

protected void openResultRecord(java.util.Vector rowVector)
Open a given row of the result set using a delegated handler class

getDocIdOfRecord

public java.lang.String getDocIdOfRecord(int row)
Get the docid for a specific Result record for use in building a list of previous packages

merge

public void merge(ResultSet r2)
Merge a ResultSet onto this one using the docid as the join column

getFramework

public ClientFramework getFramework()
Get a reference to the framework


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.