Package org.pentaho.metadata.query.model.util

Examples of org.pentaho.metadata.query.model.util.QueryXmlHelper


  private Query parseQuery(final String query) throws ReportDataFactoryException
  {
    final String xmlHelperClass = configuration.getConfigProperty
        ("org.pentaho.reporting.engine.classic.extensions.datasources.pmd.XmlHelperClass");

    final QueryXmlHelper helper =
        (QueryXmlHelper) ObjectUtilities.loadAndInstantiate(xmlHelperClass, SimplePmdDataFactory.class, QueryXmlHelper.class);
    if (helper == null)
    {
      throw new ReportDataFactoryException("Failed to create XmlHelper: " + xmlHelperClass);//$NON-NLS-1$
    }


    try
    {
      // never returns null
      return helper.fromXML(getDomainRepository(), query);
    }
    catch (ReportDataFactoryException e)
    {
      throw e;
    }
View Full Code Here


  protected Query parseQuery(final String query) throws ReportDataFactoryException
  {
    final String xmlHelperClass = getConfiguration().getConfigProperty
        ("org.pentaho.reporting.engine.classic.extensions.datasources.pmd.XmlHelperClass");

    final QueryXmlHelper helper =
        ObjectUtilities.loadAndInstantiate(xmlHelperClass, SimplePmdDataFactory.class, QueryXmlHelper.class);
    if (helper == null)
    {
      throw new ReportDataFactoryException("Failed to create XmlHelper: " + xmlHelperClass);//$NON-NLS-1$
    }

    try
    {
      // never returns null
      return helper.fromXML(getDomainRepository(), query);
    }
    catch (final ReportDataFactoryException e)
    {
      throw e;
    }
View Full Code Here

  }

  public boolean execute() {

    // get the xml parser
    QueryXmlHelper helper = null;
    try {
      helper = createQueryXmlHelper();
    } catch ( Exception e ) {
      logger.error( "error", e ); //$NON-NLS-1$
      return false;
    }

    // parse the metadata query
    IMetadataDomainRepository repo = PentahoSystem.get( IMetadataDomainRepository.class, null );

    if ( queryObject == null ) {
      // there is no query model, so create one from the query string
      // apply templates to the query
      String templatedQuery = null;
      if ( inputs != null ) {
        Properties properties = new Properties();
        for ( String name : inputs.keySet() ) {
          if ( !( inputs.get( name ) == null ) ) {
            properties.put( name, inputs.get( name ).toString() );
          }
        }
        templatedQuery = TemplateUtil.applyTemplate( query, properties, null );
      } else {
        templatedQuery = query;
      }

      try {
        queryObject = helper.fromXML( repo, templatedQuery );
      } catch ( Exception e ) {
        logger.error( "error", e ); //$NON-NLS-1$
        return false;
      }
    }
View Full Code Here

TOP

Related Classes of org.pentaho.metadata.query.model.util.QueryXmlHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.