Examples of ReportDataFactoryException


Examples of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

        connection = mondrianConnectionProvider.createConnection(computeProperties(parameters), dataSourceProvider.getDataSource());
      }
    }
    catch (SQLException e)
    {
      throw new ReportDataFactoryException("Failed to create datasource:" + e.getLocalizedMessage(), e);
    }
    catch (MondrianException e)
    {
      throw new ReportDataFactoryException("Failed to create datasource:" + e.getLocalizedMessage(), e);
    }

    try
    {
      if (connection == null)
      {
        throw new ReportDataFactoryException("Factory is closed.");
      }
      final LinkedHashSet<String> parameter = new LinkedHashSet<String>();

      final MDXCompiler compiler = new MDXCompiler(parameters, locale);
      final String mdxQuery = compiler.translateAndLookup(rawMdxQuery, parameters);
      parameter.addAll(compiler.getCollectedParameter());
      // Alternatively, JNDI is possible. Maybe even more ..
      final Query query = connection.parseQuery(mdxQuery);
      final Parameter[] queryParameters = query.getParameters();
      for (int i = 0; i < queryParameters.length; i++)
      {
        final Parameter queryParameter = queryParameters[i];
        parameter.add(queryParameter.getName());
      }
      if (jdbcUserField != null)
      {
        parameter.add(jdbcUserField);
      }
      if (roleField != null)
      {
        parameter.add(roleField);
      }
      parameter.add(DataFactory.QUERY_LIMIT);
      return parameter.toArray(new String[parameter.size()]);
    }
    catch (MondrianException e)
    {
      throw new ReportDataFactoryException("Failed to create datasource:" + e.getLocalizedMessage(), e);
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

                                 final ResourceKey resourceKey)
      throws KettleException, ReportDataFactoryException
  {
    if (getStepName() == null)
    {
      throw new ReportDataFactoryException("No step name defined.");
    }

    final String[] params = fillArguments(parameters);

    // Sadly Kettle always insists on creating a log-file. There is no way around it (yet).
    final LogWriter logWriter = LogWriter.getInstance("Kettle-reporting-datasource", false);
    try
    {
      final Repository repository = connectToRepository(logWriter);
      try
      {
        final TransMeta transMeta = loadTransformation(repository, resourceManager, resourceKey);
        transMeta.setArguments(params);
        final Trans trans = new Trans(transMeta);
        for (int i = 0; i < definedVariableNames.length; i++)
        {
          final ParameterMapping mapping = definedVariableNames[i];
          final String sourceName = mapping.getName();
          final String variableName = mapping.getAlias();
          final Object value = parameters.get(sourceName);
          if (value != null)
          {
            trans.setParameterValue(variableName, String.valueOf(value));
          }
        }

        transMeta.setInternalKettleVariables();
        trans.prepareExecution(transMeta.getArguments());

        TableProducer tableProducer = null;
        final List stepList = trans.getSteps();
        for (int i = 0; i < stepList.size(); i++)
        {
          final StepMetaDataCombi metaDataCombi = (StepMetaDataCombi) stepList.get(i);
          if (stepName.equals(metaDataCombi.stepname) == false)
          {
            continue;
          }
          final RowMetaInterface row = transMeta.getStepFields(stepName);
          tableProducer = new TableProducer(row, queryLimit, stopOnError);
          metaDataCombi.step.addRowListener(tableProducer);
          break;
        }

        if (tableProducer == null)
        {
          throw new ReportDataFactoryException("Cannot find the specified transformation step " + stepName);
        }

        currentlyRunningTransformation = trans;
        trans.startThreads();
        trans.waitUntilFinished();
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

      final QueryResultWrapper cellSet = performQuery(queryName, parameters);
      return new BandedMDXTableModel(cellSet, extractQueryLimit(parameters));
    }
    catch (SQLException sqE)
    {
      throw new ReportDataFactoryException("Failed to execute query", sqE);
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

      throws ReportDataFactoryException, OlapException
  {
    final String query = queryMappings.get(queryName);
    if (query == null)
    {
      throw new ReportDataFactoryException("No such query: " + queryName);
    }
    return super.getStatement(query, dataRow);
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

      final QueryResultWrapper cellSet = performQuery(queryName, parameters);
      return new BandedMDXTableModel(cellSet, extractQueryLimit(parameters));
    }
    catch (SQLException sqE)
    {
      throw new ReportDataFactoryException("Failed to execute query", sqE);
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

      final QueryResultWrapper cellSet = performQuery(queryName, parameters);
      return new DenormalizedMDXTableModel(cellSet);
    }
    catch (SQLException sqE)
    {
      throw new ReportDataFactoryException("Failed to execute query", sqE);
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

      final QueryResultWrapper cellSet = performQuery(queryName, parameters);
      return new DenormalizedMDXTableModel(cellSet);
    }
    catch (SQLException sqE)
    {
      throw new ReportDataFactoryException("Failed to execute query", sqE);
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

    this.resultSet = resultWrapper.getCellSet();

    final int axisCount = resultSet.getAxes().size();
    if (axisCount > 2)
    {
      throw new ReportDataFactoryException("Cannot handle results with more than two axes.");
    }
    this.rowHeaders = createRowHeaders();
    this.columnHeaders = createColumnHeaders();

    if (rowHeaders.getRowCount() > 0)
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

    this.resultSet = resultSet;
    final Axis[] axes = resultSet.getAxes();
    final int axisCount = axes.length;
    if (axisCount > 2)
    {
      throw new ReportDataFactoryException("Cannot handle results with more than two axes.");
    }
    this.rowHeaders = createRowHeaders();
    this.columnHeaders = createColumnHeaders();

    if (rowHeaders.getRowCount() > 0)
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

      throw new NullPointerException("Query is null.");
    }
    final String realQuery = getQuery(query);
    if (realQuery == null)
    {
      throw new ReportDataFactoryException("Query '" + query + "' is not recognized.");
    }
    return super.queryData(realQuery, parameters);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.