org.outerj.xreporter.report.definition
Class DatabaseOutputDefinition

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.outerj.xreporter.report.definition.DatabaseOutputDefinition
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled, OutputDefinition

public class DatabaseOutputDefinition
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements OutputDefinition

OutputDefinition implementation for generating output from a database.


Nested Class Summary
 class DatabaseOutputDefinition.AbsoluteNavigationStrategy
           
 class DatabaseOutputDefinition.LoopingNavigationStrategy
           
static interface DatabaseOutputDefinition.ResultSetNavigationStrategy
           
 
Field Summary
protected static java.lang.String CHUNK_INFO_EL
           
protected  java.util.List columnDefinitions
           
protected  java.util.Map columnDefinitionsById
           
protected static java.lang.String COLUMNS_EL
           
protected  OrderByDefinition defaultOrderByDefinition
           
protected static java.lang.String ERROR_EL
           
protected static java.lang.String FIELD_EL
           
protected static java.lang.String GROUP_EL
           
protected  GroupDefinition[] groupDefinitions
          Array containing the GroupDefinitions.
protected static java.lang.String GROUPS_EL
           
protected static java.lang.String INFO_EL
           
protected  java.util.List linkDefinitions
          Links to other reports, not associated with any column.
protected static java.lang.String NAME_ATT
           
protected  DatabaseOutputDefinition.ResultSetNavigationStrategy navigationStrategy
           
protected  java.util.List orderByDefinitions
           
protected  java.util.Map orderByDefinitionsById
           
protected static java.lang.String OUTPUT_EL
           
protected  QbeDefinition qbeDefinition
           
protected static java.lang.String REPORT_DEFINITION_ID_ATTR
           
protected static java.lang.String REPORT_INSTANCE_ID_ATTR
           
protected  ReportDefinition reportDefinition
           
protected static java.lang.String RESULTSET_EL
           
protected static java.lang.String ROW_EL
           
protected  SqlDefinition sqlDefinition
           
 
Constructor Summary
DatabaseOutputDefinition(ReportDefinition reportDefinition, java.lang.String resultSetNavigationStrategy)
           
 
Method Summary
 void addColumnDefinition(ColumnDefinition columnDefinition)
           
 void addLinkDefinition(LinkDefinition linkDefinition)
           
protected  void addOrderByDefinition(OrderByDefinition orderByDefinition)
           
 void generateBasicOutputSaxFragment(org.xml.sax.ContentHandler resultHandler, int chunkOffset, int chunkLength, ExecutionContext executionContext, ResourceHandle resourceHandle)
           
 void generateGroupedOutputSaxFragment(org.xml.sax.ContentHandler resultHandler, ExecutionContext executionContext, ResourceHandle resourceHandle)
           
 void generateOutputSaxFragment(org.xml.sax.ContentHandler resultHandler, int chunkOffset, int chunkLength, ExecutionContext executionContext, ResourceHandle resourceHandle)
          Generate the output of the report as SAX-events, withouth startDocument and endDocument calls.
 ColumnDefinition getColumnDefinition(java.lang.String id)
           
 java.util.List getColumnDefinitions()
           
 OrderByDefinition getDefaultOrderByDefinition()
          Returns the default orderby definition, possibly null.
 GroupDefinition[] getGroupDefinition()
           
 java.util.List getLinkDefinitions()
           
 java.util.List getNonGroupingColumnDefinitions()
          Returns a list of all column definitions, except those on which a grouping is performed.
 OrderByDefinition getOrderByDefinitionById(java.lang.String id)
           
 java.util.List getOrderByDefinitions()
           
 QbeDefinition getQbeDefinition()
           
 SqlDefinition getSqlDefinition()
           
protected  void logOutputEvent(java.lang.String user, java.lang.String customer, long startTime, long endTime, java.lang.String chunkOffset, java.lang.String chunkRowCount, java.lang.String totalRowCount, java.lang.String reportId, java.lang.String reportDefinitionId, java.lang.String dataSourceId, java.lang.String error)
           
protected  void outputRow(org.xml.sax.ContentHandler contentHandler, org.outerj.xreporter.report.definition.DatabaseOutputDefinition.RowValues rowValues, Column[] columns, ExecutionContext executionContext, ResourceHandle resourceHandle, Resources reportResources, LinkDefinition[] linkDefinitions)
           
protected  void setDefaultOrderByDefinition(OrderByDefinition orderByDefinition)
           
protected  void setQbeDefinition(QbeDefinition qbeDefinition)
           
protected  void setSqlDefinition(SqlDefinition sqlDefinition)
           
 boolean supportsColumns(ExecutionContext executionContext)
           
 boolean supportsOrderBy(ExecutionContext executionContext)
           
 boolean supportsQbe(ExecutionContext executionContext)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sqlDefinition

protected SqlDefinition sqlDefinition

reportDefinition

protected ReportDefinition reportDefinition

columnDefinitions

protected java.util.List columnDefinitions

columnDefinitionsById

protected java.util.Map columnDefinitionsById

linkDefinitions

protected java.util.List linkDefinitions
Links to other reports, not associated with any column.


orderByDefinitions

protected java.util.List orderByDefinitions

defaultOrderByDefinition

protected OrderByDefinition defaultOrderByDefinition

orderByDefinitionsById

protected java.util.Map orderByDefinitionsById

qbeDefinition

protected QbeDefinition qbeDefinition

navigationStrategy

protected DatabaseOutputDefinition.ResultSetNavigationStrategy navigationStrategy

groupDefinitions

protected GroupDefinition[] groupDefinitions
Array containing the GroupDefinitions. The first element in the array is an instance of TopLevelGroupDefinition. This is a group that takes the whole table as one group, and is hence not associated with a column. The other elements are instances of GroupDefinition.


RESULTSET_EL

protected static final java.lang.String RESULTSET_EL
See Also:
Constant Field Values

ROW_EL

protected static final java.lang.String ROW_EL
See Also:
Constant Field Values

FIELD_EL

protected static final java.lang.String FIELD_EL
See Also:
Constant Field Values

NAME_ATT

protected static final java.lang.String NAME_ATT
See Also:
Constant Field Values

REPORT_INSTANCE_ID_ATTR

protected static final java.lang.String REPORT_INSTANCE_ID_ATTR
See Also:
Constant Field Values

REPORT_DEFINITION_ID_ATTR

protected static final java.lang.String REPORT_DEFINITION_ID_ATTR
See Also:
Constant Field Values

OUTPUT_EL

protected static final java.lang.String OUTPUT_EL
See Also:
Constant Field Values

COLUMNS_EL

protected static final java.lang.String COLUMNS_EL
See Also:
Constant Field Values

INFO_EL

protected static final java.lang.String INFO_EL
See Also:
Constant Field Values

CHUNK_INFO_EL

protected static final java.lang.String CHUNK_INFO_EL
See Also:
Constant Field Values

ERROR_EL

protected static final java.lang.String ERROR_EL
See Also:
Constant Field Values

GROUPS_EL

protected static final java.lang.String GROUPS_EL
See Also:
Constant Field Values

GROUP_EL

protected static final java.lang.String GROUP_EL
See Also:
Constant Field Values
Constructor Detail

DatabaseOutputDefinition

public DatabaseOutputDefinition(ReportDefinition reportDefinition,
                                java.lang.String resultSetNavigationStrategy)
Method Detail

setSqlDefinition

protected void setSqlDefinition(SqlDefinition sqlDefinition)

addColumnDefinition

public void addColumnDefinition(ColumnDefinition columnDefinition)

getSqlDefinition

public SqlDefinition getSqlDefinition()

getColumnDefinitions

public java.util.List getColumnDefinitions()

getColumnDefinition

public ColumnDefinition getColumnDefinition(java.lang.String id)

addLinkDefinition

public void addLinkDefinition(LinkDefinition linkDefinition)

getLinkDefinitions

public java.util.List getLinkDefinitions()

getNonGroupingColumnDefinitions

public java.util.List getNonGroupingColumnDefinitions()
Returns a list of all column definitions, except those on which a grouping is performed. This list is constructed when requested.


getGroupDefinition

public GroupDefinition[] getGroupDefinition()

generateOutputSaxFragment

public void generateOutputSaxFragment(org.xml.sax.ContentHandler resultHandler,
                                      int chunkOffset,
                                      int chunkLength,
                                      ExecutionContext executionContext,
                                      ResourceHandle resourceHandle)
                               throws SqlGenerationException,
                                      java.sql.SQLException,
                                      org.xml.sax.SAXException,
                                      WrongStateException,
                                      ExecuteException,
                                      java.lang.Exception
Description copied from interface: OutputDefinition
Generate the output of the report as SAX-events, withouth startDocument and endDocument calls.

Specified by:
generateOutputSaxFragment in interface OutputDefinition
Throws:
SqlGenerationException
java.sql.SQLException
org.xml.sax.SAXException
WrongStateException
ExecuteException
java.lang.Exception

generateBasicOutputSaxFragment

public void generateBasicOutputSaxFragment(org.xml.sax.ContentHandler resultHandler,
                                           int chunkOffset,
                                           int chunkLength,
                                           ExecutionContext executionContext,
                                           ResourceHandle resourceHandle)
                                    throws SqlGenerationException,
                                           java.sql.SQLException,
                                           org.xml.sax.SAXException,
                                           WrongStateException,
                                           ExecuteException,
                                           java.lang.Exception
Throws:
SqlGenerationException
java.sql.SQLException
org.xml.sax.SAXException
WrongStateException
ExecuteException
java.lang.Exception

outputRow

protected void outputRow(org.xml.sax.ContentHandler contentHandler,
                         org.outerj.xreporter.report.definition.DatabaseOutputDefinition.RowValues rowValues,
                         Column[] columns,
                         ExecutionContext executionContext,
                         ResourceHandle resourceHandle,
                         Resources reportResources,
                         LinkDefinition[] linkDefinitions)
                  throws java.sql.SQLException,
                         org.apache.commons.httpclient.URIException,
                         org.xml.sax.SAXException
Throws:
java.sql.SQLException
org.apache.commons.httpclient.URIException
org.xml.sax.SAXException

generateGroupedOutputSaxFragment

public void generateGroupedOutputSaxFragment(org.xml.sax.ContentHandler resultHandler,
                                             ExecutionContext executionContext,
                                             ResourceHandle resourceHandle)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

logOutputEvent

protected void logOutputEvent(java.lang.String user,
                              java.lang.String customer,
                              long startTime,
                              long endTime,
                              java.lang.String chunkOffset,
                              java.lang.String chunkRowCount,
                              java.lang.String totalRowCount,
                              java.lang.String reportId,
                              java.lang.String reportDefinitionId,
                              java.lang.String dataSourceId,
                              java.lang.String error)

supportsOrderBy

public boolean supportsOrderBy(ExecutionContext executionContext)
Specified by:
supportsOrderBy in interface OutputDefinition

supportsQbe

public boolean supportsQbe(ExecutionContext executionContext)
Specified by:
supportsQbe in interface OutputDefinition

supportsColumns

public boolean supportsColumns(ExecutionContext executionContext)
Specified by:
supportsColumns in interface OutputDefinition

getOrderByDefinitions

public java.util.List getOrderByDefinitions()

getOrderByDefinitionById

public OrderByDefinition getOrderByDefinitionById(java.lang.String id)

getDefaultOrderByDefinition

public OrderByDefinition getDefaultOrderByDefinition()
Returns the default orderby definition, possibly null.


addOrderByDefinition

protected void addOrderByDefinition(OrderByDefinition orderByDefinition)

setDefaultOrderByDefinition

protected void setDefaultOrderByDefinition(OrderByDefinition orderByDefinition)

setQbeDefinition

protected void setQbeDefinition(QbeDefinition qbeDefinition)

getQbeDefinition

public QbeDefinition getQbeDefinition()