Package org.pentaho.reporting.libraries.formula.lvalues

Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair


    if (result == null || result.length() == 0)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    return new TypeValuePair(NumberType.GENERIC_NUMBER, new BigDecimal(result.charAt(0)));
  }
View Full Code Here


      {
        reminder = divided.add(divisor);
      }
    }

    return new TypeValuePair(NumberType.GENERIC_NUMBER, reminder);
  }
View Full Code Here

      encodingResult = "javascript";
    }

    if (encodingResult.equals("xml"))
    {
      return new TypeValuePair(TextType.TYPE, CharacterEntityParser.createXMLEntityParser().encodeEntities(textResult));
    }
    else if (encodingResult.equals("html"))
    {
      return new TypeValuePair(TextType.TYPE, HtmlCharacterEntities.getEntityParser().encodeEntities(textResult));
    }
    else if (encodingResult.equals("formula-string"))
    {
      return new TypeValuePair(TextType.TYPE, FormulaUtil.quoteString(textResult));
    }
    else if (encodingResult.equals("formula-reference"))
    {
      return new TypeValuePair(TextType.TYPE, FormulaUtil.quoteReference(textResult));
    }
    else // javascript
    {
      return new TypeValuePair(TextType.TYPE, saveConvert(textResult));
    }
  }
View Full Code Here

      final String groupName = context.getTypeRegistry().convertToText(parameters.getType(0), parameters.getValue(0));
      groupStart = rfc.getRuntime().getGroupStartRow(groupName);
    }
    final int row = rfc.getRuntime().getCurrentRow();
    //noinspection UnpredictableBigDecimalConstructorCall
    return new TypeValuePair(NumberType.GENERIC_NUMBER, new BigDecimal((double) (row - groupStart)));
  }
View Full Code Here

    final ReportFormulaContext rfc = (ReportFormulaContext) context;
    final boolean value = rfc.isResultSetEmpty();

    if (value)
    {
      return new TypeValuePair(LogicalType.TYPE, Boolean.TRUE);
    }

    return new TypeValuePair(LogicalType.TYPE, Boolean.FALSE);
  }
View Full Code Here

                                final ParameterCallback parameters) throws EvaluationException
  {
    final ReportFormulaContext rfc = (ReportFormulaContext) context;
    if (isDashboardMode(rfc))
    {
      return new TypeValuePair(LogicalType.TYPE, Boolean.TRUE);
    }
    return new TypeValuePair(LogicalType.TYPE, Boolean.FALSE);
  }
View Full Code Here

    final Object value = parameters.getValue(0);
    final ReportFormulaContext rfc = (ReportFormulaContext) context;
    if (value != null && rfc.getExportType().startsWith(String.valueOf(value)))
    {
      return new TypeValuePair(LogicalType.TYPE, Boolean.TRUE);
    }

    return new TypeValuePair(LogicalType.TYPE, Boolean.FALSE);
  }
View Full Code Here

      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE);
    }

    if (s == null)
    {
      return new TypeValuePair(TextType.TYPE, "");
    }
    final String encodingResult;
    if (parameterCount > 1)
    {
      final Object urlEncode = context.getTypeRegistry().convertToLogical(parameters.getType(1), parameters.getValue(1));
      if (Boolean.FALSE.equals(urlEncode))
      {
        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);
        }
      }
      else
      {
        encodingResult = context.getConfiguration().getConfigProperty
          ("org.pentaho.reporting.libraries.formula.URLEncoding", "UTF-8");
      }
    }
    else
    {
      encodingResult = context.getConfiguration().getConfigProperty
        ("org.pentaho.reporting.libraries.formula.URLEncoding", "UTF-8");
    }

    try
    {
      return new TypeValuePair(TextType.TYPE, URLEncoder.encode(s, encodingResult));

    }
    catch(final UnsupportedEncodingException use)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
View Full Code Here

        {
          b.append(s);
        }
      }

      return new TypeValuePair(TextType.TYPE, b.toString());

    }
    catch (final UnsupportedEncodingException use)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
View Full Code Here

    final String fieldName = context.getTypeRegistry().convertToText(parameters.getType(0), parameters.getValue(0));

    final ReportFormulaContext rfc = (ReportFormulaContext) context;
    final ReportEnvironment reportEnvironment = rfc.getProcessingContext().getEnvironment();
    return new TypeValuePair(AnyType.TYPE, reportEnvironment.getEnvironmentProperty(fieldName));
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

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.