Class SQLReportDataFactory
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.AbstractDataFactory
-
- org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SimpleSQLReportDataFactory
-
- org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SQLReportDataFactory
-
- All Implemented Interfaces:
Serializable
,Cloneable
,DataFactory
,DataFactoryDesignTimeSupport
,DataFactoryMetaProvider
public class SQLReportDataFactory extends SimpleSQLReportDataFactory
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
AbstractDataFactory.DataRowWrapper
-
-
Field Summary
-
Fields inherited from class org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SimpleSQLReportDataFactory
globalConfig
-
Fields inherited from interface org.pentaho.reporting.engine.classic.core.DataFactory
QUERY_LIMIT, QUERY_SORT, QUERY_TIMEOUT
-
Fields inherited from interface org.pentaho.reporting.engine.classic.core.DataFactoryDesignTimeSupport
DESIGN_TIME
-
-
Constructor Summary
Constructors Constructor Description SQLReportDataFactory(Connection connection)
SQLReportDataFactory(ConnectionProvider connectionProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SQLReportDataFactory
clone()
protected String
computedQuery(String queryName, DataRow parameters)
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(DataFactoryContext dataFactoryContext)
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)
Sets a query that uses no scripting for customization.void
setQuery(String name, String queryString, String queryScriptLanguage, String queryScript)
protected String
translateQuery(String query)
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SimpleSQLReportDataFactory
cancelRunningQuery, close, getBestResultSetType, getConnection, getConnectionProvider, getPasswordField, getUserField, isExpandArrayParameterNeeded, isExpandArrays, parametrizeAndQuery, performQuery, setConnectionProvider, setPasswordField, setUserField
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
calculateQueryLimit, calculateQueryTimeOut, derive, getConfiguration, getContextKey, getDataFactoryContext, getDisplayConnectionName, getLocale, getMetaData, getResourceBundleFactory, getResourceManager, queryDesignTimeStructure
-
-
-
-
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 interfaceDataFactory
- Overrides:
isQueryExecutable
in classSimpleSQLReportDataFactory
- 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)
Sets a query that uses no scripting for customization.- Parameters:
name
- the logical namequeryString
- the SQL string that will be executed.
-
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)
-
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 interfaceDataFactory
- Overrides:
getQueryNames
in classSimpleSQLReportDataFactory
- Returns:
- the known query names.
-
initialize
public void initialize(DataFactoryContext dataFactoryContext) throws ReportDataFactoryException
Description copied from interface:DataFactory
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 interfaceDataFactory
- Overrides:
initialize
in classAbstractDataFactory
- Parameters:
dataFactoryContext
- the current data-factory context, holding the configuration, resource-manager, context-key and resource-bundle-factory.- 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 interfaceDataFactory
- Overrides:
queryData
in classSimpleSQLReportDataFactory
- Parameters:
query
-parameters
-- Returns:
- Throws:
ReportDataFactoryException
- if an error occured while performing the query.
-
getReferencedFields
public String[] getReferencedFields(String query, DataRow parameter) throws ReportDataFactoryException
- Specified by:
getReferencedFields
in interfaceDataFactoryMetaProvider
- Overrides:
getReferencedFields
in classSimpleSQLReportDataFactory
- Throws:
ReportDataFactoryException
-
getQueryHash
public ArrayList<Object> getQueryHash(String queryName, DataRow parameter)
- Specified by:
getQueryHash
in interfaceDataFactoryMetaProvider
- Overrides:
getQueryHash
in classSimpleSQLReportDataFactory
-
clone
public SQLReportDataFactory clone()
- Specified by:
clone
in interfaceDataFactory
- Overrides:
clone
in classSimpleSQLReportDataFactory
-
computedQuery
protected String computedQuery(String queryName, DataRow parameters) throws ReportDataFactoryException
- Overrides:
computedQuery
in classSimpleSQLReportDataFactory
- Throws:
ReportDataFactoryException
-
translateQuery
protected String translateQuery(String query)
- Overrides:
translateQuery
in classSimpleSQLReportDataFactory
-
-