org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql
Class SQLReportDataFactory

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SimpleSQLReportDataFactory
      extended by org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SQLReportDataFactory
All Implemented Interfaces:
Serializable, Cloneable, DataFactory

public class SQLReportDataFactory
extends SimpleSQLReportDataFactory

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.pentaho.reporting.engine.classic.core.DataFactory
QUERY_LIMIT, QUERY_TIMEOUT
 
Constructor Summary
SQLReportDataFactory(Connection connection)
           
SQLReportDataFactory(ConnectionProvider connectionProvider)
           
 
Method Summary
 Object clone()
           
 String getGlobalScript()
           
 String getGlobalScriptLanguage()
           
 String getQuery(String name)
           
 ArrayList<Object> getQueryHash(String queryName, DataRow parameter)
           
 String[] getQueryNames()
          Returns all known query-names.
 String[] getReferencedFields(String query, DataRow parameter)
           
 String getScript(String name)
           
 String getScriptingLanguage(String name)
           
 void initialize(org.pentaho.reporting.libraries.base.config.Configuration configuration, org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager, org.pentaho.reporting.libraries.resourceloader.ResourceKey contextKey, ResourceBundleFactory resourceBundleFactory)
          Initializes the data factory and provides new context information.
 boolean isQueryExecutable(String query, DataRow parameters)
          Checks whether the query would be executable by this datafactory.
 TableModel queryData(String query, DataRow parameters)
          Queries a datasource.
 void remove(String name)
           
 void setGlobalScript(String globalScript)
           
 void setGlobalScriptLanguage(String scriptLanguage)
           
 void setQuery(String name, String queryString)
          Deprecated. use the full version instead. Use "removeQuery" to remove an existing query instead of setting the query string to null.
 void setQuery(String name, String queryString, String queryScriptLanguage, String queryScript)
           
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SimpleSQLReportDataFactory
cancelRunningQuery, close, derive, getConnectionProvider, getPasswordField, getUserField, isExpandArrayParameterNeeded, isLabelMapping, open, setConnectionProvider, setLabelMapping, setPasswordField, setUserField
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLReportDataFactory

public SQLReportDataFactory(Connection connection)

SQLReportDataFactory

public SQLReportDataFactory(ConnectionProvider connectionProvider)
Method Detail

isQueryExecutable

public boolean isQueryExecutable(String query,
                                 DataRow parameters)
Checks whether the query would be executable by this datafactory. This performs a rough check, not a full query.

Specified by:
isQueryExecutable in interface DataFactory
Overrides:
isQueryExecutable in class SimpleSQLReportDataFactory
Parameters:
query - the query.
parameters - the parameters.
Returns:
true, if the query would be executable, false if the query is not recognized.

setQuery

public void setQuery(String name,
                     String queryString)
Deprecated. use the full version instead. Use "removeQuery" to remove an existing query instead of setting the query string to null.

Parameters:
name -
queryString -

setQuery

public void setQuery(String name,
                     String queryString,
                     String queryScriptLanguage,
                     String queryScript)

remove

public void remove(String name)

getGlobalScriptLanguage

public String getGlobalScriptLanguage()

setGlobalScriptLanguage

public void setGlobalScriptLanguage(String scriptLanguage)

getGlobalScript

public String getGlobalScript()

setGlobalScript

public void setGlobalScript(String globalScript)

getScriptingLanguage

public String getScriptingLanguage(String name)

getScript

public String getScript(String name)

getQuery

public String getQuery(String name)

getQueryNames

public String[] getQueryNames()
Description copied from interface: DataFactory
Returns all known query-names. A data-factory may accept more than the query-names returned here.

Specified by:
getQueryNames in interface DataFactory
Overrides:
getQueryNames in class SimpleSQLReportDataFactory
Returns:
the known query names.

initialize

public void initialize(org.pentaho.reporting.libraries.base.config.Configuration configuration,
                       org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager,
                       org.pentaho.reporting.libraries.resourceloader.ResourceKey contextKey,
                       ResourceBundleFactory resourceBundleFactory)
                throws ReportDataFactoryException
Description copied from class: SimpleSQLReportDataFactory
Initializes the data factory and provides new context information. Initialize is always called before the datafactory has been opened by calling DataFactory#open.

Specified by:
initialize in interface DataFactory
Overrides:
initialize in class SimpleSQLReportDataFactory
Parameters:
configuration - the current report configuration.
resourceManager - the report's resource manager.
contextKey - the report's context key to access resources relative to the report location.
resourceBundleFactory - the report's resource-bundle factory to access localization information.
Throws:
ReportDataFactoryException

queryData

public TableModel queryData(String query,
                            DataRow parameters)
                     throws ReportDataFactoryException
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 DataFactory
Overrides:
queryData in class SimpleSQLReportDataFactory
Parameters:
query -
parameters -
Returns:
Throws:
ReportDataFactoryException - if an error occured while performing the query.

getReferencedFields

public String[] getReferencedFields(String query,
                                    DataRow parameter)
                             throws ReportDataFactoryException
Overrides:
getReferencedFields in class SimpleSQLReportDataFactory
Throws:
ReportDataFactoryException

getQueryHash

public ArrayList<Object> getQueryHash(String queryName,
                                      DataRow parameter)
Overrides:
getQueryHash in class SimpleSQLReportDataFactory

clone

public Object clone()
Specified by:
clone in interface DataFactory
Overrides:
clone in class SimpleSQLReportDataFactory