Package org.jfree.report

Examples of org.jfree.report.ReportDataFactoryException


    catch(DataSourceException dse)
    {
        String message = dse.getMessage();
        if ( message.length() == 0 )
            message = "Failed to create report data wrapper";
      throw new ReportDataFactoryException(message,dse);
    }
    catch (org.jfree.report.DataSourceException e)
    {
        String message = e.getMessage();
        if ( message.length() == 0 )
            message = "Failed to query data";
      throw new ReportDataFactoryException(message);
    }
  }
View Full Code Here


            String message = dse.getMessage();
            if (message.length() == 0)
            {
                message = "Failed to create report data wrapper";
            }
            throw new ReportDataFactoryException(message, dse);
        }
        catch (org.jfree.report.DataSourceException e)
        {
            String message = e.getMessage();
            if (message.length() == 0)
            {
                message = "Failed to query data";
            }
            throw new ReportDataFactoryException(message);
        }
    }
View Full Code Here

      }
    }
    catch (DataSourceException e)
    {
      e.printStackTrace();
      throw new ReportDataFactoryException("Failed to query data", e);
    }
  }
View Full Code Here

      throw new NullPointerException("Query is null.");
    }
    final String realQuery = getQuery(query);
    if (realQuery == null)
    {
      throw new ReportDataFactoryException("Query '" + query + "' is not recognized.");
    }
    return super.queryData(realQuery, parameters);
  }
View Full Code Here

      throw new NullPointerException("Query is null.");
    }
    final String realQuery = getQuery(query);
    if (realQuery == null)
    {
      throw new ReportDataFactoryException("Query '" + query + "' is not recognized.");
    }
    return super.queryData(realQuery, parameters);
  }
View Full Code Here

    final int methodSeparatorIdx = query.indexOf('#');

    if ((methodSeparatorIdx + 1) >= query.length())
    {
      // If we have a method separator, then it cant be at the end of the text.
      throw new ReportDataFactoryException("Malformed query: " + query);
    }

    if (methodSeparatorIdx == -1)
    {
      // we have no method. So this query must be a reference to a tablemodel
      // instance.
      final String[] parameterNames;
      final int parameterStartIdx = query.indexOf('(');
      final String constructorName;
      if (parameterStartIdx == -1)
      {
        parameterNames = new String[0];
        constructorName = query;
      }
      else
      {
        parameterNames = createParameterList(query, parameterStartIdx);
        constructorName = query.substring(0, parameterStartIdx);
      }

      try
      {
        Constructor c = findDirectConstructor(constructorName, parameterNames.length);

        Object[] params = new Object[parameterNames.length];
        for (int i = 0; i < parameterNames.length; i++)
        {
          final String name = parameterNames[i];
          params[i] = DataSetUtility.getByName(parameters, name);
        }
        final Object o = c.newInstance(params);
        if (o instanceof TableModel)
        {
          return new TableReportData ((TableModel) o);
        }

        return (ReportData) o;
      }
      catch (Exception e)
      {
        throw new ReportDataFactoryException
                ("Unable to instantiate class for non static call.", e);
      }
    }

    return createComplexTableModel
View Full Code Here

      }
      return (ReportData) data;
    }
    catch (Exception e)
    {
      throw new ReportDataFactoryException
              ("Unable to instantiate class for non static call.");
    }
  }
View Full Code Here

      final ClassLoader classLoader = getClassLoader();
      final Class c = classLoader.loadClass(className);
      final Object o = c.newInstance();
      if (o == null)
      {
        throw new ReportDataFactoryException
                ("Unable to instantiate class for non static call.");
      }
      final Object data = m.invoke(o, params);
      if (data instanceof TableModel)
      {
        return new TableReportData((TableModel) data);
      }
      return (ReportData) data;
    }
    catch (ReportDataFactoryException rdfe)
    {
      throw rdfe;
    }
    catch (Exception e)
    {
      throw new ReportDataFactoryException
              ("Something went terribly wrong: ", e);
    }
  }
View Full Code Here

          throws ReportDataFactoryException
  {
    final int parameterEndIdx = query.lastIndexOf(')');
    if (parameterEndIdx < parameterStartIdx)
    {
      throw new ReportDataFactoryException("Malformed query: " + query);
    }
    final String parameterText =
            query.substring(parameterStartIdx + 1, parameterEndIdx);
    final CSVTokenizer tokenizer = new CSVTokenizer(parameterText);
    final int size = tokenizer.countTokens();
View Full Code Here

  {
    ClassLoader classLoader = getClassLoader();

    if (classLoader == null)
    {
      throw new ReportDataFactoryException("No classloader!");
    }
    try
    {
      Class c = classLoader.loadClass(className);
      if (Modifier.isAbstract(c.getModifiers()))
      {
        throw new ReportDataFactoryException("Abstract class cannot be handled!");
      }

      Method[] methods = c.getMethods();
      for (int i = 0; i < methods.length; i++)
      {
        final Method method = methods[i];
        if (Modifier.isPublic(method.getModifiers()) == false)
        {
          continue;
        }
        if (method.getName().equals(methodName) == false)
        {
          continue;
        }
        final Class returnType = method.getReturnType();
        if (method.getParameterTypes().length != paramCount)
        {
          continue;
        }
        if (TableModel.class.isAssignableFrom(returnType) ||
            ReportData.class.isAssignableFrom(returnType))
        {
          return method;
        }
      }
    }
    catch (ClassNotFoundException e)
    {
      throw new ReportDataFactoryException("No such Class", e);
    }
    throw new ReportDataFactoryException("No such Method: " + className + "#" + methodName);
  }
View Full Code Here

TOP

Related Classes of org.jfree.report.ReportDataFactoryException

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.