org.pentaho.platform.plugin.action.jfreereport.helper
Class PentahoTableDataFactory

java.lang.Object
  extended by org.pentaho.platform.plugin.action.jfreereport.helper.PentahoTableDataFactory
All Implemented Interfaces:
Serializable, Cloneable, org.pentaho.reporting.engine.classic.core.DataFactory

public class PentahoTableDataFactory
extends Object
implements org.pentaho.reporting.engine.classic.core.DataFactory, Cloneable

The PentahoTableDataFactory class implements JFreeReport's data factory and manages the TableModels provided to JFreeReport. The primary difference between this class and JFreeReport's standard TableDataFactory is the "getTableIterator" method, which allows the Platform to clean up and table model resources after their use. Also, we support Pentaho's IPreparedComponent interface which allows a prepared component to generate a result set when requested.

Author:
Will Gorman
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.pentaho.reporting.engine.classic.core.DataFactory
QUERY_LIMIT, QUERY_TIMEOUT
 
Constructor Summary
PentahoTableDataFactory()
          default constructor
PentahoTableDataFactory(String name, TableModel tableModel)
          constructor with one time call to addTable for convenience.
 
Method Summary
 void addPreparedComponent(String name, IPreparedComponent component)
          add a prepared component to the map
 void addTable(String name, TableModel tableModel)
          add a table to the map
 void cancelRunningQuery()
           
 Object clone()
           
 void close()
           
 org.pentaho.reporting.engine.classic.core.DataFactory derive()
          Derives a freshly initialized report data factory, which is independend of the original data factory.
 void finalize()
           
 String[] getQueryNames()
           
 boolean isQueryExecutable(String query, org.pentaho.reporting.engine.classic.core.DataRow parameters)
           
 void open()
           
 TableModel queryData(String query, org.pentaho.reporting.engine.classic.core.DataRow parameters)
          Queries a datasource.
 void removeTable(String name)
          remove a table from the map
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PentahoTableDataFactory

public PentahoTableDataFactory()
default constructor


PentahoTableDataFactory

public PentahoTableDataFactory(String name,
                               TableModel tableModel)
constructor with one time call to addTable for convenience.

Parameters:
name - table name
tableModel - instance of table model
Method Detail

addTable

public void addTable(String name,
                     TableModel tableModel)
add a table to the map

Parameters:
name - table name
tableModel - instance of table model

addPreparedComponent

public void addPreparedComponent(String name,
                                 IPreparedComponent component)
add a prepared component to the map

Parameters:
name - prepared component name
component - instance of prepared component

removeTable

public void removeTable(String name)
remove a table from the map

Parameters:
name - table name

queryData

public TableModel queryData(String query,
                            org.pentaho.reporting.engine.classic.core.DataRow parameters)
Queries a datasource. The string 'query' defines the name of the query. The Parameterset given here may contain more data than actually needed.

The dataset may change between two calls, do not assume anything!

Specified by:
queryData in interface org.pentaho.reporting.engine.classic.core.DataFactory
Parameters:
query - the name of the table.
parameters - are ignored for this factory.
Returns:
the report data or null.

open

public void open()
Specified by:
open in interface org.pentaho.reporting.engine.classic.core.DataFactory

close

public void close()
Specified by:
close in interface org.pentaho.reporting.engine.classic.core.DataFactory

finalize

public void finalize()
Overrides:
finalize in class Object

derive

public org.pentaho.reporting.engine.classic.core.DataFactory derive()
                                                             throws org.pentaho.reporting.engine.classic.core.ReportDataFactoryException
Derives a freshly initialized report data factory, which is independend of the original data factory. Opening or Closing one data factory must not affect the other factories.

Specified by:
derive in interface org.pentaho.reporting.engine.classic.core.DataFactory
Returns:
Throws:
org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

getQueryNames

public String[] getQueryNames()
Specified by:
getQueryNames in interface org.pentaho.reporting.engine.classic.core.DataFactory

isQueryExecutable

public boolean isQueryExecutable(String query,
                                 org.pentaho.reporting.engine.classic.core.DataRow parameters)
Specified by:
isQueryExecutable in interface org.pentaho.reporting.engine.classic.core.DataFactory

cancelRunningQuery

public void cancelRunningQuery()
Specified by:
cancelRunningQuery in interface org.pentaho.reporting.engine.classic.core.DataFactory