Package org.pentaho.reporting.engine.classic.core

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


    }

    final KettleTransformationProducer producer = queries.get(query);
    if (producer == null)
    {
      throw new ReportDataFactoryException("There is no such query defined: " + query);
    }

    try
    {
      currentlyRunningQuery = producer;
      return producer.performQuery(parameters, queryLimit, resourceManager, contextKey);
    }
    catch (ReportDataFactoryException rdfe)
    {
      throw rdfe;
    }
    catch (Throwable e)
    {
      throw new ReportDataFactoryException("Caught Kettle Exception: Check your configuration", e);
    }
    finally
    {
      currentlyRunningQuery = null;
    }
View Full Code Here


        }
      }
    }
    catch (Exception e)
    {
      throw new ReportDataFactoryException("Failed to query XPath datasource", e);
    }
  }
View Full Code Here

                                   final Map<String, String> extraParameter) throws ReportDataFactoryException
  {
    final String baseURL = getBaseUrl();
    if (StringUtils.isEmpty(baseURL, true))
    {
      throw new ReportDataFactoryException("Base URL is null");
    }
    final String url = createURL(method, extraParameter);
    try
    {
      final GetMethod httpCall = new GetMethod(url);
      this.httpCall = httpCall;
      final HttpClient client = getHttpClient();
      final int status = client.executeMethod(httpCall);
      if (status != 200)
      {
        throw new ReportDataFactoryException("Failed to retrieve data: " + httpCall.getStatusLine());
      }

      final InputStream responseBody = httpCall.getResponseBodyAsStream();
      return CdaResponseParser.performParse(responseBody);
    }
    catch (UnsupportedEncodingException use)
    {
      throw new ReportDataFactoryException("Failed to encode parameter", use);
    }
    catch (Exception e)
    {
      throw new ReportDataFactoryException("Failed to send request : " + url, e);
    }
    finally
    {
      httpCall = null;
    }
View Full Code Here

    }
    if (TYPE_DATE.equals(type))
    {
      if (raw instanceof Date == false && raw instanceof Number == false)
      {
        throw new ReportDataFactoryException("For parameter " + name + " Expected date, but got " + raw.getClass());
      }
      final ResourceBundleFactory resourceBundleFactory = context.getResourceBundleFactory();
      final SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, resourceBundleFactory.getLocale());
      dateFormat.setTimeZone(resourceBundleFactory.getTimeZone());
      return dateFormat.format(raw);
    }
    if (TYPE_INTEGER.equals(type) || TYPE_NUMERIC.equals(type))
    {
      if (raw instanceof Number == false)
      {
        throw new ReportDataFactoryException("For parameter " + name + " Expected number, but got " + raw.getClass());
      }
      return String.valueOf(raw);
    }
    if (TYPE_STRING.equals(type))
    {
      return String.valueOf(raw);
    }
    if (type.endsWith(TYPE_ARRAY_SUFFIX))
    {
      if (raw.getClass().isArray() == false)
      {
        if (raw instanceof String)
        {
          return raw.toString();
        }
        else
        {
          throw new ReportDataFactoryException("For parameter " + name + " Expected array, but got " + raw.getClass());
        }
      }

      final CSVQuoter quoter = new CSVQuoter(';');
      final String arrayType = type.substring(0, type.length() - 5);
      final StringBuilder b = new StringBuilder();
      final int length = Array.getLength(raw);
      for (int i = 0; i < length; i++)
      {
        final Object o = Array.get(raw, i);
        if (i > 0)
        {
          b.append(";");
        }
        final String str = parameterToString(name + "[" + i + "]", arrayType, pattern, o);
        b.append(quoter.doQuoting(str));
      }
      return b.toString();
    }
    throw new ReportDataFactoryException("Unknown type " + type + " for parameter " + name);
  }
View Full Code Here

      return (contentHandler.getResult());
    }
    catch (final ParserConfigurationException e)
    {
      throw new ReportDataFactoryException("Failed to init XML system", e);
    }
    catch (final SAXException e)
    {
      throw new ReportDataFactoryException("Failed to parse document", e);
    }
  }
View Full Code Here

        final DataPreviewDialog previewDialog = new DataPreviewDialog(ScriptableDataSourceEditor.this);

        final ScriptablePreviewWorker worker = new ScriptablePreviewWorker(dataFactory, queryNameTextField.getText());
        previewDialog.showData(worker);

        final ReportDataFactoryException factoryException = worker.getException();
        if (factoryException != null)
        {
          ExceptionDialog.showExceptionDialog(ScriptableDataSourceEditor.this,
              Messages.getString("ScriptableDataSourceEditor.PreviewError.Title"),
              Messages.getString("ScriptableDataSourceEditor.PreviewError.Message"), factoryException);
View Full Code Here

                            final DataFactoryContext dataFactoryContext) throws ReportDataFactoryException
  {
    final String col = getTypedParameter("column", String.class);
    if (col == null)
    {
      throw new ReportDataFactoryException("Column parameter is not defined.");
    }

    final String displayName = getTypedParameter("display-name", String.class, col);
    final Object o = parameters.get(col);
    if (o == null || o.getClass().isArray() == false)
View Full Code Here

                              final DataRow parameters) throws ReportDataFactoryException
  {
    final Sequence sequence = sequences.get(query);
    if (sequence == null)
    {
      throw new ReportDataFactoryException("No such query '" + query + "'");
    }
    return sequence.produce(parameters, getDataFactoryContext());
  }
View Full Code Here

        DataFactoryEditorSupport.configureDataFactoryForPreview(dataFactory, context);

        final MondrianPreviewWorker worker = new MondrianPreviewWorker(dataFactory, query, 0, theMaxRows);
        previewDialog.showData(worker);

        final ReportDataFactoryException factoryException = worker.getException();
        if (factoryException != null)
        {
          ExceptionDialog.showExceptionDialog(MondrianDataSourceEditor.this,
              Messages.getString("MondrianDataSourceEditor.PreviewError.Title"),
              Messages.getString("MondrianDataSourceEditor.PreviewError.Message"), factoryException);
View Full Code Here

  {

    final Integer colDimsRaw = getTypedParameter("column-dimensions", Integer.class, Integer.valueOf(3));
    if (colDimsRaw == null)
    {
      throw new ReportDataFactoryException("Parameter column-dimensions is not defined.");
    }
    if (colDimsRaw < 1)
    {
      throw new ReportDataFactoryException("Parameter column-dimensions has an invalid value.");
    }
    final int colDims = colDimsRaw;
    final Integer[] colCardsRaw = getTypedParameter("column-cardinality", Integer[].class, null);
    final String[] colPatternRaw = getTypedParameter("column-pattern", String[].class, null);

    final Integer rowDimsRaw = getTypedParameter("row-dimensions", Integer.class, Integer.valueOf(3));
    if (rowDimsRaw == null)
    {
      throw new ReportDataFactoryException("Parameter row-dimensions is not defined.");
    }
    if (rowDimsRaw < 1)
    {
      throw new ReportDataFactoryException("Parameter row-dimensions has an invalid value.");
    }
    final int rowDims = rowDimsRaw;
    final Integer[] rowCardsRaw = getTypedParameter("row-cardinality", Integer[].class, null);
    final String[] rowPatternRaw = getTypedParameter("row-pattern", String[].class, null);
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException

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.