Class AbstractScriptableDataFactory
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.AbstractDataFactory
-
- org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.AbstractScriptableDataFactory
-
- All Implemented Interfaces:
Serializable
,Cloneable
,DataFactory
,DataFactoryDesignTimeSupport
,DataFactoryMetaProvider
public abstract class AbstractScriptableDataFactory extends AbstractDataFactory
- 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 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 Modifier Constructor Description protected
AbstractScriptableDataFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
getGlobalScript()
String
getGlobalScriptLanguage()
String
getQuery(String name)
Object
getQueryHash(String query, DataRow parameter)
protected abstract Object
getQueryHashInternal(String realQuery, DataRow parameter)
String[]
getQueryNames()
Returns all known query-names.String[]
getReferencedFields(String query, DataRow parameter)
protected abstract String[]
getReferencedFieldsInternal(String query, DataRow parameters)
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 dataRow)
Checks whether the query would be executable by this datafactory.TableModel
queryData(String query, DataRow parameters)
Queries a datasource.protected abstract TableModel
queryDataInternal(String realQuery, DataRow parameters)
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)
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
calculateQueryLimit, calculateQueryTimeOut, cancelRunningQuery, clone, derive, getConfiguration, getContextKey, getDataFactoryContext, getDisplayConnectionName, getLocale, getMetaData, getResourceBundleFactory, getResourceManager, queryDesignTimeStructure
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pentaho.reporting.engine.classic.core.DataFactory
close
-
-
-
-
Method Detail
-
queryData
public final TableModel queryData(String query, DataRow parameters) throws ReportDataFactoryException
Description copied from interface:DataFactory
Queries a datasource. The string 'query' defines the name of the query. The Parameterset given here may contain more data than actually needed for the query. The parameter-dataset may change between two calls, do not assume anything, and do not hold references to the parameter-dataset or the position of the columns in the dataset.- Parameters:
query
- the query string, never null.parameters
- the parameters for the query, never null.- Returns:
- the result of the query as table model.
- Throws:
ReportDataFactoryException
- if an error occured while performing the query.
-
queryDataInternal
protected abstract TableModel queryDataInternal(String realQuery, DataRow parameters) throws ReportDataFactoryException
- Throws:
ReportDataFactoryException
-
isQueryExecutable
public boolean isQueryExecutable(String query, DataRow dataRow)
Description copied from interface:DataFactory
Checks whether the query would be executable by this datafactory. This performs a rough check, not a full query.- Parameters:
query
- the query, never null.dataRow
- the parameters, never null.- 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.- 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
-
getReferencedFields
public final String[] getReferencedFields(String query, DataRow parameter)
- Specified by:
getReferencedFields
in interfaceDataFactoryMetaProvider
- Overrides:
getReferencedFields
in classAbstractDataFactory
-
getReferencedFieldsInternal
protected abstract String[] getReferencedFieldsInternal(String query, DataRow parameters) throws ReportDataFactoryException
- Throws:
ReportDataFactoryException
-
getQueryHash
public final Object getQueryHash(String query, DataRow parameter)
- Specified by:
getQueryHash
in interfaceDataFactoryMetaProvider
- Overrides:
getQueryHash
in classAbstractDataFactory
-
getQueryHashInternal
protected abstract Object getQueryHashInternal(String realQuery, DataRow parameter) throws ReportDataFactoryException
- Throws:
ReportDataFactoryException
-
-