Class 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:
    Serialized Form
    • Constructor Detail

      • SimplePmdDataFactory

        public SimplePmdDataFactory()
    • Method Detail

      • getDomainId

        public String getDomainId()
      • setDomainId

        public void setDomainId​(String domainId)
      • getXmiFile

        public String getXmiFile()
      • setXmiFile

        public void setXmiFile​(String xmiFile)
      • getUserField

        public String getUserField()
      • setUserField

        public void setUserField​(String userField)
      • getPasswordField

        public String getPasswordField()
      • setPasswordField

        public void setPasswordField​(String passwordField)
      • 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

        public String[] 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 name
        parameters - 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 interface org.pentaho.reporting.engine.classic.core.DataFactoryDesignTimeSupport
        Overrides:
        queryDesignTimeStructure in class org.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 interface org.pentaho.reporting.engine.classic.core.DataFactory
        Overrides:
        derive in class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
        Returns:
        a copy of the data factory.
      • cancelRunningQuery

        public void cancelRunningQuery()
        Specified by:
        cancelRunningQuery in interface org.pentaho.reporting.engine.classic.core.DataFactory
        Overrides:
        cancelRunningQuery in class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
      • translateQuery

        protected String translateQuery​(String query)
      • 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 interface org.pentaho.reporting.engine.classic.core.DataFactoryMetaProvider
        Overrides:
        getReferencedFields in class org.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 interface org.pentaho.reporting.engine.classic.core.DataFactoryMetaProvider
        Overrides:
        getQueryHash in class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
      • getContextKeyParentIdentifier

        protected Object getContextKeyParentIdentifier()