Class StaticDataFactory
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.AbstractDataFactory
-
- org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.StaticDataFactory
-
- All Implemented Interfaces:
Serializable
,Cloneable
,DataFactory
,DataFactoryDesignTimeSupport
,DataFactoryMetaProvider
- Direct Known Subclasses:
NamedStaticDataFactory
public class StaticDataFactory extends AbstractDataFactory
This report data factory uses introspection to search for a report data source. The query can have the following formats: <full-qualified-classname>#methodName(Parameters) <full-qualified-classname>(constructorparams) #methodName(Parameters) <full-qualified-classname>(constructorparams)- Author:
- Thomas Morgner
- 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 Constructor Description StaticDataFactory()
DefaultConstructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the data factory and frees all resources held by this instance.DataFactory
derive()
Returns a copy of the data factory that is not affected by its anchestor and holds no connection to the anchestor anymore.protected ClassLoader
getClassLoader()
Returns the current classloader.String[]
getParameterFields(String query)
String[]
getQueryNames()
Returns all known query-names.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.String
translateQuery(String queryName)
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
calculateQueryLimit, calculateQueryTimeOut, cancelRunningQuery, clone, getConfiguration, getContextKey, getDataFactoryContext, getDisplayConnectionName, getLocale, getMetaData, getQueryHash, getReferencedFields, getResourceBundleFactory, getResourceManager, initialize, queryDesignTimeStructure
-
-
-
-
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.- Parameters:
query
-parameters
-- Returns:
-
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!- Parameters:
query
- the method call.parameters
- the set of parameters.- Returns:
- the tablemodel from the executed method call, never null.
- Throws:
ReportDataFactoryException
- if an error occured while performing the query.
-
getParameterFields
public String[] getParameterFields(String query) throws ReportDataFactoryException
- Throws:
ReportDataFactoryException
-
getClassLoader
protected ClassLoader getClassLoader()
Returns the current classloader.- Returns:
- the current classloader.
-
derive
public DataFactory derive()
Returns a copy of the data factory that is not affected by its anchestor and holds no connection to the anchestor anymore. A data-factory will be derived at the beginning of the report processing.- Specified by:
derive
in interfaceDataFactory
- Overrides:
derive
in classAbstractDataFactory
- Returns:
- a copy of the data factory.
-
close
public void close()
Closes the data factory and frees all resources held by this instance. This method is empty.
-
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.
-
-