Examples of TypeRegistry


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

    // 0: Configuration-indicator (gives the pattern indirectly) never the pattern itself
    // 1: the report-path
    // 2: the parameter as 2d-array (name value pairs)

    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final String configIndicator = typeRegistry.convertToText(parameters.getType(0), parameters.getValue(0));
    String path;
    try
    {
      path = typeRegistry.convertToText(parameters.getType(1), parameters.getValue(1));
    }
    catch (EvaluationException ee)
    {
      if (LibFormulaErrorValue.ERROR_NA_VALUE.equals(ee.getErrorValue()))
      {
        path = null;
      }
      else
      {
        throw ee;
      }
    }
    final ArrayCallback parameter = typeRegistry.convertToArray(parameters.getType(2), parameters.getValue(2));

    final LinkCustomizer pattern = createLinkCustomizer(configIndicator);
    return new TypeValuePair(TextType.TYPE, pattern.format(context, configIndicator, path,
        computeParameterEntries(parameter, typeRegistry)));
  }
View Full Code Here

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

    }
    if (parameters.getParameterCount() > 3)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final String urlText = typeRegistry.convertToText(parameters.getType(0), parameters.getValue(0));
    if (urlText == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    String tabText = null;
    if (parameters.getParameterCount() > 1)
    {
      tabText = typeRegistry.convertToText(parameters.getType(1), parameters.getValue(1));
    }

    final ReportFormulaContext rfc = (ReportFormulaContext) context;
    if (StringUtils.isEmpty(tabText))
    {
      final DocumentMetaData documentMetaData = rfc.getProcessingContext().getDocumentMetaData();
      tabText = (String) documentMetaData.getBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.TITLE);
      if (StringUtils.isEmpty(tabText))
      {
        final Object o = rfc.getDataRow().get("report.name");
        if (o != null)
        {
          tabText = String.valueOf(o);
        }
      }
      if (StringUtils.isEmpty(tabText))
      {
        final ResourceBundle bundle = ResourceBundle.getBundle
            ("org.pentaho.reporting.engine.classic.extensions.drilldown.messages");
        tabText = bundle.getString("UnnamedTab");
      }
    }

    final boolean tabActive;
    if (parameters.getParameterCount() == 3)
    {
      if (Boolean.FALSE.equals(typeRegistry.convertToLogical(parameters.getType(2), parameters.getValue(2))))
      {
        tabActive = false;
      }
      else
      {
View Full Code Here

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

    if (parameterCount == 0)
    {
      return new TypeValuePair(NumberType.GENERIC_NUMBER, ZERO);
    }

    final TypeRegistry typeRegistry = context.getTypeRegistry();
    BigDecimal last = null;
    for (int paramIdx = 0; paramIdx < parameterCount; paramIdx++)
    {
      final Type type = parameters.getType(paramIdx);
      final Object value = parameters.getValue(paramIdx);
      final Sequence sequence = typeRegistry.convertToNumberSequence(type, value, isStrictSequenceNeeded());

      while (sequence.hasNext())
      {
        final LValue rawValue = sequence.nextRawValue();
        if (rawValue == null)
        {
          throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
        }
        final TypeValuePair nextValue = rawValue.evaluate();
        final Number number = typeRegistry.convertToNumber(nextValue.getType(), nextValue.getValue());
        final BigDecimal next = NumberUtil.getAsBigDecimal(number);
        if (last == null)
        {
          last = next;
        }
View Full Code Here

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

    final int parameterCount = parameters.getParameterCount();
    if (parameterCount < 2 || parameterCount > 3)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    final Type searchType = parameters.getType(0);
    final Object searchValue = parameters.getValue(0);
    final Type textType = parameters.getType(1);
    final Object textValue = parameters.getValue(1);
    Type indexType = null;
    Object indexValue = null;

    if (parameterCount == 3)
    {
      indexType = parameters.getType(2);
      indexValue = parameters.getValue(2);

      if (indexType == null || indexValue == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_MISSING_ARGUMENT_VALUE);
      }
    }

    final String search = typeRegistry.convertToText(searchType, searchValue);
    final String text = typeRegistry.convertToText(textType, textValue);

    if (search == null || text == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }
    int indexFrom = 0;

    if (indexType != null)
    {
      final Number n = typeRegistry.convertToNumber(indexType, indexValue);
      if (n.intValue() >= 1)
      {
        indexFrom = n.intValue() - 1;
      }
      else
View Full Code Here

Examples of org.springsource.loaded.TypeRegistry

    rtypeA.loadNewVersion("2", retrieveRename(top, top + "003"));
    rtypeB.loadNewVersion("2", retrieveRename(bot, bot + "003", top + "003:" + top));

    // Check the registry looks right for Top
    int topId = NameRegistry.getIdFor("superpkg/Top");
    TypeRegistry trTop = TypeRegistry.getTypeRegistryFor(subLoader.getParent());
    assertEquals(0, topId);
    assertEquals(top, trTop.getReloadableType(topId).getName());
    assertEquals(top, trTop.getReloadableType("superpkg/Top").getName());

    int bottomId = NameRegistry.getIdFor("subpkg/Bottom");
    TypeRegistry trBot = TypeRegistry.getTypeRegistryFor(subLoader);
    assertEquals(1, bottomId);
    assertEquals(bot, trBot.getReloadableType(bottomId).getName());
    assertEquals(bot, trBot.getReloadableType("subpkg/Bottom").getName());

    // Now call the m() in the Bottom003 type, which calls super.newMethodOnTop()
    result = runUnguarded(rtypeB.getClazz(), "m");
    assertEquals("newMethodOnTop() running", result.stdout);
  }
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.