Package org.pentaho.reporting.engine.classic.core.modules.parser.base

Examples of org.pentaho.reporting.engine.classic.core.modules.parser.base.ReportGenerator


     */
    private MasterReport loadMasterReport(InputStream input) throws ReportException {
        try {
            rmgr.registerDefaults();
            // TODO Figure out a non-deprecated way to load a report from InputStream
            final ReportGenerator generator = ReportGenerator.createInstance();
            final InputSource repDefInputSource = new InputSource(input);
            return generator.parseReport(repDefInputSource, null);
        } catch (Exception ex) {
            throw new ReportException("Unable to load report", ex);
        }
    }
View Full Code Here


      resource = getResource( ( (ActionResource) reportDefinition ).getName() );
    }
    if ( resource != null ) {
      if ( resource.getSourceType() == IActionResource.XML ) {
        String repDef = resource.getAddress();
        ReportGenerator generator = ReportGenerator.createInstance();

        // add the runtime context so that PentahoResourceData class can get access to the solution repo
        // generator.setObject(PentahoResourceData.PENTAHO_RUNTIME_CONTEXT_KEY, getRuntimeContext());

        // Read the encoding from the XML file - see BISERVER-895
        final String encoding = XmlHelper.getEncoding( repDef, null );
        ByteArrayInputStream inStream = new ByteArrayInputStream( repDef.getBytes( encoding ) );
        InputSource repDefInputSource = new InputSource( inStream );
        repDefInputSource.setEncoding( encoding );
        report = generator.parseReport( repDefInputSource, getDefinedResourceURL( null ) );
      } else {
        report = parseReport( resource );
      }
    }
    return report;
View Full Code Here

    return report;
  }

  protected MasterReport createReport( final String reportDefinition ) throws ResourceException, IOException {
    ReportGenerator generator = ReportGenerator.createInstance();

    // add the runtime context so that PentahoResourceData class can get access to the solution repo
    // generator.setObject(PentahoResourceData.PENTAHO_RUNTIME_CONTEXT_KEY, getRuntimeContext());

    URL url = null;
    IPentahoRequestContext requestContext = PentahoRequestContextHolder.getRequestContext();
    try {
      url = new URL( requestContext.getContextPath() ); //$NON-NLS-1$ //$NON-NLS-2$
    } catch ( Exception e ) {
      // a null URL is ok
      warn( Messages.getInstance().getString( "JFreeReportLoadComponent.WARN_COULD_NOT_CREATE_URL" ) ); //$NON-NLS-1$
    }

    // Read the encoding from the XML file - see BISERVER-895
    final String encoding = XmlHelper.getEncoding( reportDefinition, null );
    ByteArrayInputStream inStream = new ByteArrayInputStream( reportDefinition.getBytes( encoding ) );
    InputSource reportDefinitionInputSource = new InputSource( inStream );
    reportDefinitionInputSource.setEncoding( encoding );
    return generator.parseReport( reportDefinitionInputSource, getDefinedResourceURL( url ) );
  }
View Full Code Here

      throw new Exception( Messages.getInstance().getErrorString( "JFreeReport.ERROR_0016_REPORT_RESOURCE_INVALID", //$NON-NLS-1$
          reportLocation, resource.getAddress() ) );
    }

    try {
      ReportGenerator generator = ReportGenerator.getInstance();

      // add the runtime context so that PentahoResourceData class can get access to the solution repo
      // generator.setObject(PentahoResourceData.PENTAHO_RUNTIME_CONTEXT_KEY, getRuntimeContext());

      report = generator.parseReport( resourceUrl, getDefinedResourceURL( resourceUrl ) );
    } catch ( Exception ex ) {
      throw new Exception( Messages.getInstance().getErrorString(
          "JFreeReport.ERROR_0007_COULD_NOT_PARSE", reportLocation ), ex ); //$NON-NLS-1$
    }
    return report;
View Full Code Here

      final IActionSequenceResource resource = getResource(
        AbstractJFreeReportComponent.REPORTGENERATEDEFN_REPORTDEFN );

      if ( resource.getSourceType() == IActionResource.XML ) {
        String repDef = resource.getAddress();
        ReportGenerator generator = ReportGenerator.getInstance();

        report =
            generator.parseReport( new InputSource( new ByteArrayInputStream( repDef.getBytes() ) ),
                getDefinedResourceURL( null ) );
      }
      report = parseReport( resource );
    } else if ( isDefinedInput( AbstractJFreeReportComponent.REPORTLOAD_RESOURCENAME ) ) {
      final String resName = getInputStringValue( AbstractJFreeReportComponent.REPORTLOAD_RESOURCENAME );
View Full Code Here

    if ( isDefinedInput( AbstractJFreeReportComponent.REPORTGENERATEDEFN_REPORTDEFN ) ) {
      IActionParameter o = getInputParameter( AbstractJFreeReportComponent.REPORTGENERATEDEFN_REPORTDEFN );
      if ( o != null ) {
        String repDef = o.getStringValue();
        ReportGenerator generator = ReportGenerator.getInstance();
        IPentahoRequestContext requestContext = PentahoRequestContextHolder.getRequestContext();
        URL url = null;
        try {
          url = new URL( requestContext.getContextPath() );
        } catch ( Exception e ) {
          // a null URL is ok
          warn( Messages.getInstance().getString( "JFreeReportLoadComponent.WARN_COULD_NOT_CREATE_URL" ) ); //$NON-NLS-1$
        }
        report =
            generator
                .parseReport(
                  new InputSource( new ByteArrayInputStream( repDef.getBytes( "UTF-8" ) ) ),
                  getDefinedResourceURL( url ) ); //$NON-NLS-1$
      }
    }
View Full Code Here

      throw new Exception( Messages.getInstance().getErrorString( "JFreeReport.ERROR_0016_REPORT_RESOURCE_INVALID", //$NON-NLS-1$
          reportLocation, resource.getAddress() ) );
    }

    try {
      ReportGenerator generator = ReportGenerator.getInstance();
      report = generator.parseReport( resourceUrl, getDefinedResourceURL( resourceUrl ) );
    } catch ( Exception ex ) {
      throw new Exception( Messages.getInstance().getErrorString(
          "JFreeReport.ERROR_0007_COULD_NOT_PARSE", reportLocation ), ex ); //$NON-NLS-1$
    }
    return report;
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.modules.parser.base.ReportGenerator

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.