Package org.pentaho.reporting.libraries.formula.typing

Examples of org.pentaho.reporting.libraries.formula.typing.Type


    if (parameterCount < 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }

    final Type textType = parameters.getType(0);
    final Object textValue = parameters.getValue(0);
    final String query =
        context.getTypeRegistry().convertToText(textType, textValue);

    if (query == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    final String resultColumn;
    if (parameterCount > 1)
    {
      final Type encodingType = parameters.getType(1);
      final Object encodingValue = parameters.getValue(1);
      resultColumn = context.getTypeRegistry().convertToText(encodingType, encodingValue);
      if (resultColumn == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
      }
    }
    else
    {
      resultColumn = null;
    }

    final int queryTimeOut;
    if (parameterCount > 2)
    {
      final Type encodingType = parameters.getType(2);
      final Object encodingValue = parameters.getValue(2);
      final Number number = context.getTypeRegistry().convertToNumber(encodingType, encodingValue);
      if (number == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
      }
      queryTimeOut = number.intValue();
    }
    else
    {
      queryTimeOut = 0;
    }

    final int queryLimit;
    if (parameterCount > 3)
    {
      final Type encodingType = parameters.getType(3);
      final Object encodingValue = parameters.getValue(3);
      final Number number = context.getTypeRegistry().convertToNumber(encodingType, encodingValue);
      if (number == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
View Full Code Here


    final int parameterCount = parameters.getParameterCount();
    if (parameterCount < 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final Type textType = parameters.getType(0);
    final Object textValue = parameters.getValue(0);
    final String textResult =
        context.getTypeRegistry().convertToText(textType, textValue);

    if (textResult == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    final String encodingResult;
    if (parameterCount == 2)
    {
      final Type encodingType = parameters.getType(1);
      final Object encodingValue = parameters.getValue(1);
      encodingResult = context.getTypeRegistry().convertToText(encodingType, encodingValue);
      if (encodingResult == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
View Full Code Here

        return new TypeValuePair(TextType.TYPE, s);
      }

      if(parameterCount == 3)
      {
        final Type encodingType = parameters.getType(2);
        final Object encodingValue = parameters.getValue(2);
        encodingResult = context.getTypeRegistry().convertToText(encodingType, encodingValue);
        if(encodingResult == null)
        {
          throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
View Full Code Here

    if (parameterCount < 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }

    final Type textType = parameters.getType(0);
    final Object textValue = parameters.getValue(0);
    final String query =
        context.getTypeRegistry().convertToText(textType, textValue);

    if (query == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    final String resultColumn;
    if (parameterCount > 1)
    {
      final Type encodingType = parameters.getType(1);
      final Object encodingValue = parameters.getValue(1);
      resultColumn = context.getTypeRegistry().convertToText(encodingType, encodingValue);
      if (resultColumn == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
      }
    }
    else
    {
      resultColumn = null;
    }


    final int queryTimeOut;
    if (parameterCount > 2)
    {
      final Type encodingType = parameters.getType(2);
      final Object encodingValue = parameters.getValue(2);
      final Number number = context.getTypeRegistry().convertToNumber(encodingType, encodingValue);
      if (number == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
View Full Code Here

      urlEncode = !(Boolean.FALSE.equals
          (context.getTypeRegistry().convertToLogical(parameters.getType(2), parameters.getValue(2))));

      if (parameterCount == 4)
      {
        final Type encodingType = parameters.getType(3);
        final Object encodingValue = parameters.getValue(3);
        encodingResult = context.getTypeRegistry().convertToText(encodingType, encodingValue);
        if (encodingResult == null)
        {
          throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
View Full Code Here

      {
        if (i > 0)
        {
          b.append(";");
        }
        final Type type = selectedFunction.getParameterType(i);
        b.append(TypeUtil.getParameterType(type, getLocale()));
      }
      b.append(')');

      try
View Full Code Here

      final TypeValuePair typeValuePair = rootReference.evaluate();
      if (typeValuePair == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
      }
      final Type type = typeValuePair.getType();
      if (type.isFlagSet(Type.ERROR_TYPE))
      {
        logger.debug("Error: " + typeValuePair.getValue());
      }
      else if (type.isFlagSet(Type.ARRAY_TYPE))
      {
        final Object value = typeValuePair.getValue();
        if (value instanceof ArrayCallback)
        {
          return new TypeValuePair(type, new StaticArrayCallback((ArrayCallback) value));
View Full Code Here

                                      final TypeValuePair value1,
                                      final TypeValuePair value2)
      throws EvaluationException
  {
    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final Type type1 = value1.getType();
    final Type type2 = value2.getType();
    final Object value1Raw = value1.getValue();
    final Object value2Raw = value2.getValue();
    if (value1Raw == null || value2Raw == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
View Full Code Here

    if (rawValue == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
    }

    final Type type = value1.getType();
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    if (type.isFlagSet(Type.NUMERIC_TYPE) == false &&
        type.isFlagSet(Type.ANY_TYPE) == false)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    // return the same as zero minus value.
View Full Code Here

    final int parameterCount = parameters.getParameterCount();
    if (parameterCount < 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final Type type1 = parameters.getType(0);
    final Object value1 = parameters.getValue(0);
    final Number result = context.getTypeRegistry().convertToNumber(type1, value1);

    if(result == null)
    {
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.formula.typing.Type

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.