Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jbreport.data
Class Query  view Query download Query.java

java.lang.Object
  extended byjbreport.core.AbstractReportElement
      extended byjbreport.data.Query
All Implemented Interfaces:
java.lang.Cloneable, jbreport.ReportElement, jbreport.core.Traversable, jbreport.core.XMLAware, jbreport.core.XMLParsingElement

public class Query
extends jbreport.core.AbstractReportElement
implements jbreport.core.XMLParsingElement

This provides for a named query to be captured from an xml definition. It is executed against a predefined datasource.

Version:
$Revision: 1.1.1.1 $

Field Summary
private  java.lang.String datasourceName
          The name of the datasource that will be used to execute this query
private  java.util.List params
          The bound parameters available for this query
 
Fields inherited from class jbreport.core.AbstractReportElement
attrType, cdata, className, elementType, name
 
Fields inherited from interface jbreport.ReportElement
DEEP, SHALLOW
 
Constructor Summary
Query()
           
 
Method Summary
 void accept(jbreport.core.ReportVisitor visitor, jbreport.core.ReportVisitorState state)
          This defines the operation that the Traversable instance must perform at each node in the traversal.
 QueryResult executeQuery(jbreport.ReportElement elem)
          Execute the query and return the appropriate resultset
 java.util.List getList(java.lang.String property)
          Returns the List instance for the given property name.
private  java.lang.String parseQuery(java.lang.String query, jbreport.ReportElement elem)
          This will do the appropriate substitutions on the query string.
 boolean xmlCanParse()
          Can this element parse xml in this context? This might be false if the class handles more than one type of element in a hierarchy.
 void xmlCData(jbreport.core.XMLHandler handler, java.lang.String cdata)
          This is called to return the embedded character data from the xml element
 void xmlInitialize(java.lang.String localName, org.xml.sax.Attributes attributes)
          This should initialize the instance with data obtained during the traversal of an xml tree.
 void xmlParse(jbreport.core.XMLHandler handler, java.lang.String localName, org.xml.sax.Attributes attributes)
          This is called to parse some sub-element of this particular element.
 
Methods inherited from class jbreport.core.AbstractReportElement
assert, assertNotNull, boundParameters, breakEventNotify, clone, copy, copy, getBoundParamValue, getElement, getFactory, getName, getParent, getRepository, getString, getStylesheet, getType, inOrderIterator, inOrderTraverse, loadData, postOrderIterator, postOrderTraverse, preLoadData, preOrderIterator, preOrderTraverse, setParent, setString, updateData, xmlEnd, xmlEndChild
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

datasourceName

private java.lang.String datasourceName
The name of the datasource that will be used to execute this query


params

private java.util.List params
The bound parameters available for this query

Constructor Detail

Query

public Query()
Method Detail

accept

public void accept(jbreport.core.ReportVisitor visitor,
                   jbreport.core.ReportVisitorState state)
            throws jbreport.ReportException
Description copied from interface: jbreport.core.Traversable
This defines the operation that the Traversable instance must perform at each node in the traversal. It should be coded such that it calls an appropriate method on the ReportVisitor instance. Should an appropriate method not exist, one should be coded.

The accept method should not recurse into its children, it is the contract of the iterator to perform that function.

eg:- For node type Section the method on this node should be as follows.

   public void accept(ReportVisitor visitor, ReportVisitorState state) 
      throws ReportException {
      visitor.visitSection(this, state);
   }

Specified by:
accept in interface jbreport.core.Traversable

getList

public java.util.List getList(java.lang.String property)
Description copied from interface: jbreport.ReportElement
Returns the List instance for the given property name.

Specified by:
getList in interface jbreport.ReportElement

xmlInitialize

public void xmlInitialize(java.lang.String localName,
                          org.xml.sax.Attributes attributes)
                   throws jbreport.ReportException
Description copied from interface: jbreport.ReportElement
This should initialize the instance with data obtained during the traversal of an xml tree. The child-parent relationship is catered for with the xmlEndChild() method.

Specified by:
xmlInitialize in interface jbreport.ReportElement

xmlCanParse

public boolean xmlCanParse()
Description copied from interface: jbreport.core.XMLParsingElement
Can this element parse xml in this context? This might be false if the class handles more than one type of element in a hierarchy.

Specified by:
xmlCanParse in interface jbreport.core.XMLParsingElement

xmlParse

public void xmlParse(jbreport.core.XMLHandler handler,
                     java.lang.String localName,
                     org.xml.sax.Attributes attributes)
Description copied from interface: jbreport.core.XMLParsingElement
This is called to parse some sub-element of this particular element.

Specified by:
xmlParse in interface jbreport.core.XMLParsingElement

xmlCData

public void xmlCData(jbreport.core.XMLHandler handler,
                     java.lang.String cdata)
Description copied from interface: jbreport.core.XMLParsingElement
This is called to return the embedded character data from the xml element

Specified by:
xmlCData in interface jbreport.core.XMLParsingElement

executeQuery

public QueryResult executeQuery(jbreport.ReportElement elem)
                         throws jbreport.ReportException
Execute the query and return the appropriate resultset


parseQuery

private java.lang.String parseQuery(java.lang.String query,
                                    jbreport.ReportElement elem)
This will do the appropriate substitutions on the query string.