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

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


        currentContext.add(image);
      }
    }
    catch (DocumentException ioe)
    {
      throw new InvalidReportStateException("Failed to extract text", ioe);
    }
    catch (IOException e)
    {
      // double ignore ..
      throw new InvalidReportStateException("Failed to extract text", e);
    }

  }
View Full Code Here


        }
        else if (value instanceof ErrorValue)
        {
          if (failOnErrors)
          {
            throw new InvalidReportStateException(String.format
                ("Failed to evaluate style-expression for key %s on element [%s]",// NON-NLS
                    key.getName(),
                    FunctionUtilities.computeElementLocation(e)));
          }
          style.setStyleProperty(key, null);
        }
        else
        {
          final ValueConverter valueConverter = ConverterRegistry.getInstance().getValueConverter(key.getValueType());
          if (valueConverter != null)
          {
            // try to convert it ..
            final Object o = ConverterRegistry.toPropertyValue(String.valueOf(value), key.getValueType());
            style.setStyleProperty(key, o);
          }
          else
          {
            style.setStyleProperty(key, null);
          }
        }
      }
      catch (InvalidReportStateException exception)
      {
        throw exception;
      }
      catch (Exception exception)
      {
        if (logger.isDebugEnabled())
        {
          logger.debug(String.format
              ("Failed to evaluate style expression for element '%s', style-key %s", // NON-NLS
                  e, key), exception);
        }
        if (failOnErrors)
        {
          throw new InvalidReportStateException(String.format
              ("Failed to evaluate style-expression for key %s on element [%s]",// NON-NLS
                  key.getName(),
                  FunctionUtilities.computeElementLocation(e)), exception);
        }
        // ignored, but we clear the style as we have no valid value anymore.
View Full Code Here

            }
            else if (value instanceof ErrorValue)
            {
              if (failOnErrors)
              {
                throw new InvalidReportStateException(String.format
                    ("Failed to evaluate attribute-expression for attribute %s:%s on element [%s]", // NON-NLS
                        namespace, name,
                        FunctionUtilities.computeElementLocation(e)));
              }
              e.setAttribute(namespace, name, null);
            }
            else
            {

              final PropertyEditor propertyEditor = attribute.getEditor();
              if (propertyEditor != null)
              {
                propertyEditor.setAsText(String.valueOf(value));
                e.setAttribute(namespace, name, propertyEditor.getValue());
              }
              else
              {
                final ValueConverter valueConverter = instance.getValueConverter(type);
                if (type.isAssignableFrom(String.class))
                {
                  // the attribute would allow raw-string values, so copy the element ..
                  e.setAttribute(namespace, name, value);
                }
                else if (valueConverter != null)
                {
                  final Object o = ConverterRegistry.toPropertyValue(String.valueOf(value), type);
                  e.setAttribute(namespace, name, o);
                }
                else
                {
                  // undo any previous computation
                  e.setAttribute(namespace, name, null);
                }
              }
            }
          }
        }
        catch (InvalidReportStateException exception)
        {
          throw exception;
        }
        catch (Exception exception)
        {
          if (logger.isDebugEnabled())
          {
            logger.debug(String.format
                ("Failed to evaluate attribute-expression for attribute %s:%s on element [%s]", // NON-NLS
                    namespace, name,
                    FunctionUtilities.computeElementLocation(e)), exception);
          }
          if (failOnErrors)
          {
            throw new InvalidReportStateException(String.format
                ("Failed to evaluate attribute-expression for attribute %s:%s on element [%s]", // NON-NLS
                    namespace, name,
                    FunctionUtilities.computeElementLocation(e)), exception);
          }
          e.setAttribute(namespace, name, null);
View Full Code Here

      e.setComputedStyle(styleCache.getStyleSheet(styleSheet));
      return true;
    }
    catch (Exception ex)
    {
      throw new InvalidReportStateException("Failed to resolve style.", ex);
    }
  }
View Full Code Here

  {
    if (formulaError != null)
    {
      if (Boolean.TRUE.equals(failOnError))
      {
        throw new InvalidReportStateException(String.format
            ("Previously failed to evaluate formula-expression with error %s",// NON-NLS
                formulaError));
      }
      return LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE;
    }

    if (formulaExpression == null)
    {
      return null;
    }

    try
    {
      if (compiledFormula == null)
      {
        compiledFormula = new Formula(formulaExpression);
      }

      final ExpressionRuntime expressionRuntime = getRuntime();

      final ReportFormulaContext context =
          new ReportFormulaContext(getFormulaContext(), expressionRuntime);
      try
      {
        compiledFormula.initialize(context);
        final Object evaluate = compiledFormula.evaluate();
        if (Boolean.TRUE.equals(failOnError))
        {
          if (evaluate instanceof ErrorValue)
          {
            throw new InvalidReportStateException(String.format
                ("Failed to evaluate formula-expression with error %s",// NON-NLS
                    evaluate));
          }
        }
        return evaluate;
      }
      finally
      {
        context.close();
      }
    }
    catch (Exception e)
    {
      formulaError = e;
      if (FormulaExpression.logger.isDebugEnabled())
      {
        final Configuration config = getReportConfiguration();
        if ("true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.function.LogFormulaFailureCause")))
        {
          FormulaExpression.logger.debug("Failed to compute the regular value [" + formulaExpression + ']', e);
        }
        else
        {
          FormulaExpression.logger.debug("Failed to compute the regular value [" + formulaExpression + ']');
        }
      }
      if (Boolean.TRUE.equals(failOnError))
      {
        throw new InvalidReportStateException(String.format
            ("Failed to evaluate formula-expression with error %s",// NON-NLS
                e.getMessage()), e);
      }
      return LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE;
    }
View Full Code Here

            continue;
          }

          if (content.isCommited() == false)
          {
            throw new InvalidReportStateException("Uncommited content encountered");
          }

          final long contentOffset = contentProducer.getContentOffset(row, col);
          final long colPos = sheetLayout.getXPosition(col);
          final long rowPos = sheetLayout.getYPosition(row);
View Full Code Here

          continue;
        }

        if (content.isCommited() == false)
        {
          throw new InvalidReportStateException("Uncommited content encountered");
        }

        final long contentOffset = contentProducer.getContentOffset(row, col);
        final TableRectangle rectangle = sheetLayout.getTableBounds
            (content.getX(), content.getY() + contentOffset, content.getWidth(), content.getHeight(), null);
View Full Code Here

        return startBox(box, "block");
      }
    }
    catch (IOException e)
    {
      throw new InvalidReportStateException(e.getMessage(), e);
    }
  }
View Full Code Here

      writeElementAttributes(box);
      return true;
    }
    catch (IOException e)
    {
      throw new InvalidReportStateException(e.getMessage(), e);
    }
  }
View Full Code Here

      writeElementAttributes(box);
      return true;
    }
    catch (IOException e)
    {
      throw new InvalidReportStateException(e.getMessage(), e);
    }
  }
View Full Code Here

TOP

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

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.