Class SimplePmdDataFactory
java.lang.Object
org.pentaho.reporting.engine.classic.core.AbstractDataFactory
org.pentaho.reporting.engine.classic.extensions.datasources.pmd.SimplePmdDataFactory
- All Implemented Interfaces:
Serializable
,Cloneable
,org.pentaho.reporting.engine.classic.core.DataFactory
,org.pentaho.reporting.engine.classic.core.DataFactoryDesignTimeSupport
,org.pentaho.reporting.engine.classic.core.DataFactoryMetaProvider
- Direct Known Subclasses:
PmdDataFactory
public class SimplePmdDataFactory
extends org.pentaho.reporting.engine.classic.core.AbstractDataFactory
Performs MQL queries. A MQL-query usually contains all information needed to connect to the database. However the
platform also allows to override the connection-information and to provide an own connection instead.
We mirror that case by allowing to provide a connection provider. If no connection provider is given, we use whatever
connection information is stored in the MQL data itself.
- Author:
- Thomas Morgner
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
org.pentaho.reporting.engine.classic.core.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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
close()
Closes the data factory and frees all resources held by this instance.protected String
computedQuery
(String queryName, org.pentaho.reporting.engine.classic.core.DataRow parameters) org.pentaho.reporting.engine.classic.core.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 Object
protected org.pentaho.metadata.repository.IMetadataDomainRepository
getQueryHash
(String queryName, org.pentaho.reporting.engine.classic.core.DataRow parameters) String[]
String[]
getReferencedFields
(String query, org.pentaho.reporting.engine.classic.core.DataRow parameter) boolean
isQueryExecutable
(String query, org.pentaho.reporting.engine.classic.core.DataRow parameters) Checks whether the query would be executable by this datafactory.protected org.pentaho.metadata.query.model.Query
parseQuery
(String query) Queries a datasource.queryDesignTimeStructure
(String queryName, org.pentaho.reporting.engine.classic.core.DataRow parameter) void
setConnectionProvider
(IPmdConnectionProvider connectionProvider) void
setDomainId
(String domainId) void
setPasswordField
(String passwordField) void
setUserField
(String userField) void
setXmiFile
(String xmiFile) protected String
translateQuery
(String query) Methods inherited from class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
calculateQueryLimit, calculateQueryTimeOut, clone, getConfiguration, getContextKey, getDataFactoryContext, getDisplayConnectionName, getLocale, getMetaData, getResourceBundleFactory, getResourceManager, initialize
-
Constructor Details
-
SimplePmdDataFactory
public SimplePmdDataFactory()
-
-
Method Details
-
getConnectionProvider
-
setConnectionProvider
-
getDomainId
-
setDomainId
-
getXmiFile
-
setXmiFile
-
getUserField
-
setUserField
-
getPasswordField
-
setPasswordField
-
isQueryExecutable
public boolean isQueryExecutable(String query, org.pentaho.reporting.engine.classic.core.DataRow parameters) Checks whether the query would be executable by this datafactory. This performs a rough check, not a full query.- Parameters:
query
- the query.parameters
- the parameters.- Returns:
- true, if the query would be executable, false if the query is not recognized.
-
getQueryNames
-
getDomainRepository
protected org.pentaho.metadata.repository.IMetadataDomainRepository getDomainRepository() throws org.pentaho.reporting.engine.classic.core.ReportDataFactoryException- Throws:
org.pentaho.reporting.engine.classic.core.ReportDataFactoryException
-
parseQuery
protected org.pentaho.metadata.query.model.Query parseQuery(String query) throws org.pentaho.reporting.engine.classic.core.ReportDataFactoryException - Throws:
org.pentaho.reporting.engine.classic.core.ReportDataFactoryException
-
close
public void close()Closes the data factory and frees all resources held by this instance. -
queryData
public TableModel queryData(String queryName, org.pentaho.reporting.engine.classic.core.DataRow parameters) throws org.pentaho.reporting.engine.classic.core.ReportDataFactoryException 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:
queryName
- the query nameparameters
- the parameters for the query- Returns:
- the result of the query as table model.
- Throws:
org.pentaho.reporting.engine.classic.core.ReportDataFactoryException
- if an error occured while performing the query.
-
queryDesignTimeStructure
public TableModel queryDesignTimeStructure(String queryName, org.pentaho.reporting.engine.classic.core.DataRow parameter) throws org.pentaho.reporting.engine.classic.core.ReportDataFactoryException - Specified by:
queryDesignTimeStructure
in interfaceorg.pentaho.reporting.engine.classic.core.DataFactoryDesignTimeSupport
- Overrides:
queryDesignTimeStructure
in classorg.pentaho.reporting.engine.classic.core.AbstractDataFactory
- Throws:
org.pentaho.reporting.engine.classic.core.ReportDataFactoryException
-
derive
public org.pentaho.reporting.engine.classic.core.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 interfaceorg.pentaho.reporting.engine.classic.core.DataFactory
- Overrides:
derive
in classorg.pentaho.reporting.engine.classic.core.AbstractDataFactory
- Returns:
- a copy of the data factory.
-
cancelRunningQuery
public void cancelRunningQuery()- Specified by:
cancelRunningQuery
in interfaceorg.pentaho.reporting.engine.classic.core.DataFactory
- Overrides:
cancelRunningQuery
in classorg.pentaho.reporting.engine.classic.core.AbstractDataFactory
-
translateQuery
-
computedQuery
protected String computedQuery(String queryName, org.pentaho.reporting.engine.classic.core.DataRow parameters) throws org.pentaho.reporting.engine.classic.core.ReportDataFactoryException - Throws:
org.pentaho.reporting.engine.classic.core.ReportDataFactoryException
-
getReferencedFields
public String[] getReferencedFields(String query, org.pentaho.reporting.engine.classic.core.DataRow parameter) throws org.pentaho.reporting.engine.classic.core.ReportDataFactoryException - Specified by:
getReferencedFields
in interfaceorg.pentaho.reporting.engine.classic.core.DataFactoryMetaProvider
- Overrides:
getReferencedFields
in classorg.pentaho.reporting.engine.classic.core.AbstractDataFactory
- Throws:
org.pentaho.reporting.engine.classic.core.ReportDataFactoryException
-
getQueryHash
public ArrayList<Object> getQueryHash(String queryName, org.pentaho.reporting.engine.classic.core.DataRow parameters) - Specified by:
getQueryHash
in interfaceorg.pentaho.reporting.engine.classic.core.DataFactoryMetaProvider
- Overrides:
getQueryHash
in classorg.pentaho.reporting.engine.classic.core.AbstractDataFactory
-
getContextKeyParentIdentifier
-