Package org.pentaho.reporting.libraries.base.util

Examples of org.pentaho.reporting.libraries.base.util.CSVTokenizer


  }

  private String[] splitLine(final String line, final boolean trim)
  {
    final ArrayList row = new ArrayList();
    final CSVTokenizer tokenizer = new CSVTokenizer(line, getSeparator(), "\"", trim);
    while (tokenizer.hasMoreElements())
    {
      final String o = (String) tokenizer.nextElement();
      if (trim)
      {
        row.add(o.trim());
      }
      else
View Full Code Here


  }

  public void testCSVTokenizer ()
  {
    final String example = "\"Test\"";
    CSVTokenizer tokenizer = new CSVTokenizer(example, ",", "\"");
    assertTrue("Tokenizer has at least one element", tokenizer.hasMoreTokens());
    assertEquals(tokenizer.nextToken(), "Test");
  }
View Full Code Here

      final String s = environment.getEnvironmentProperty(name);
      if (s == null)
      {
        return new String[0];
      }
      final CSVTokenizer csvTokenizer = new CSVTokenizer(s, ",", "\"", false);
      final int length = csvTokenizer.countTokens();
      final String[] rolesArray = new String[length];
      for (int i = 0; i < length; i += 1)
      {
        rolesArray[i] = csvTokenizer.nextToken();
      }
      return rolesArray;
    }
    return environment.getEnvironmentProperty(envName);
  }
View Full Code Here

      final String bootModules =
          getGlobalConfig().getConfigProperty
              ("org.pentaho.reporting.engine.classic.core.boot.Modules"); // NON-NLS
      if (bootModules != null)
      {
        final CSVTokenizer csvToken = new CSVTokenizer(bootModules, ",");
        while (csvToken.hasMoreTokens())
        {
          final String token = csvToken.nextToken();
          getPackageManager().load(token);
        }
      }
    }
    catch (SecurityException se)
View Full Code Here

     * @param name the name of the property to look up.
     * @return the translated value.
     */
    protected String lookupVariable(final String name)
    {
      final CSVTokenizer tokenizer = new CSVTokenizer(name, false);
      if (tokenizer.hasMoreTokens() == false)
      {
        return null;
      }
      final String varName = tokenizer.nextToken();

      final StringBuffer b = new StringBuffer(name.length());
      b.append('{');
      b.append(String.valueOf(fields.size()));
      while (tokenizer.hasMoreTokens())
      {
        b.append(',');
        b.append(tokenizer.nextToken());
      }
      b.append('}');
      final String formatString = b.toString();
      fields.add(varName);
      return formatString;
View Full Code Here

    if (s == null)
    {
      throw new NullPointerException();
    }

    final CSVTokenizer tokenizer = new CSVTokenizer(s, false);
    final ArrayList elements = new ArrayList();
    while (tokenizer.hasMoreTokens())
    {
      final String token = tokenizer.nextToken();
      if (token == null || token.length() == 0)
      {
        elements.add(null);
      }
      else
View Full Code Here

  protected String lookupVariable(final String entity)
  {
    // first, split the entity into separate strings (separator is '.').

    final CSVTokenizer tokenizer = new CSVTokenizer(entity, ".");
    if (tokenizer.hasMoreTokens())
    {
      final String name = tokenizer.nextToken();
      final Object base = performInitialLookup(name);
      try
      {
        if (tokenizer.hasMoreTokens())
        {
          return BeanPropertyLookupParser.continueLookupVariable(tokenizer, base);
        }
        else
        {
View Full Code Here

    {
      throw new ReportDataFactoryException("Malformed query: " + query); //$NON-NLS-1$
    }
    final String parameterText =
        query.substring(parameterStartIdx + 1, parameterEndIdx);
    final CSVTokenizer tokenizer = new CSVTokenizer(parameterText, ",", "\"", false);
    final int size = tokenizer.countTokens();
    final String[] parameterNames = new String[size];
    int i = 0;
    while (tokenizer.hasMoreTokens())
    {
      parameterNames[i] = tokenizer.nextToken();
      i += 1;
    }
    return parameterNames;
  }
View Full Code Here

     * @return the translated value.
     */
    protected String lookupVariable(final String name)
    {

      final CSVTokenizer tokenizer = new CSVTokenizer(name, false);
      if (tokenizer.hasMoreTokens() == false)
      {
        return null;
      }

      final String parameterName = tokenizer.nextToken();
      final Object o = parameters.get(parameterName);
      collectedLists.add(parameterName);

      String subType = null;
      final StringBuffer b = new StringBuffer(name.length() + 4);
      b.append('{');
      b.append("0");
      while (tokenizer.hasMoreTokens())
      {
        b.append(',');
        final String token = tokenizer.nextToken();
        b.append(token);
        if (subType == null)
        {
          subType = token;
        }
View Full Code Here

     * @param name the name of the property to look up.
     * @return the translated value.
     */
    protected String lookupVariable(final String name)
    {
      final CSVTokenizer tokenizer = new CSVTokenizer(name, false);
      if (tokenizer.hasMoreTokens() == false)
      {
        // invalid reference ..
        return null;
      }

      final String parameterName = tokenizer.nextToken();
      collectedParameter.add(parameterName);
      final Object o = parameters.get(parameterName);
      String subType = null;
      final StringBuffer b = new StringBuffer(name.length() + 4);
      b.append('{');
      b.append("0");
      while (tokenizer.hasMoreTokens())
      {
        b.append(',');
        final String token = tokenizer.nextToken();
        b.append(token);
        if (subType == null)
        {
          subType = token;
        }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.base.util.CSVTokenizer

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.