Package org.eclipse.birt.report.engine.api

Examples of org.eclipse.birt.report.engine.api.IReportEngine


    Map<String,Object> parameters = input.getParameters();
   
    ReportEngineOutput output = new ReportEngineOutput();
    ByteArrayOutputStream out = new ByteArrayOutputStream();     

    IReportEngine engine = BirtProvider
        .getBirtEngine(directoryProvider.getReportDirectory() + "platform");   

    // Set options for task
    HTMLRenderOption renderOption = new HTMLRenderOption();
    renderOption.setOutputStream(out);     
    renderOption.setImageDirectory(directoryProvider.getTempDirectory());
    renderOption.setBaseImageURL("report-images");   
           
    try
    {
      String designFile = directoryProvider.getReportDirectory() + report.getFile();
     
      log.info("Loading BIRT report design: " + report.getFile());
     
      IReportRunnable design = engine.openReportDesign(designFile);     
           
      handleDataSourceOverrides(design);       
     
      if (input.getExportType() == ExportType.PDF)
      {     
        output.setContentType(ReportEngineOutput.CONTENT_TYPE_PDF);
        renderOption.setOutputFormat(IRenderOption.OUTPUT_FORMAT_PDF);       
      }
      else if (input.getExportType() == ExportType.HTML || input.getExportType() == ExportType.HTML_EMBEDDED)
      {     
        output.setContentType(ReportEngineOutput.CONTENT_TYPE_HTML);
        renderOption.setOutputFormat(IRenderOption.OUTPUT_FORMAT_HTML)
       
        if (input.getExportType() == ExportType.HTML_EMBEDDED)
        {
          renderOption.setEmbeddable(true);
        }
      }
      else if (input.getExportType() == ExportType.XLS)
      {     
        output.setContentType(ReportEngineOutput.CONTENT_TYPE_XLS);
        renderOption.setOutputFormat("xls");       
      }
      else
      {
        log.error("Export type not yet implemented: " + input.getExportType());
      }
     
      IRunAndRenderTask task = engine.createRunAndRenderTask(design);         
      task.setRenderOption(renderOption);
      task.setParameterValues(parameters);     
      task.validateParameters();
     
      if (input.getLocale() != null)
View Full Code Here


 
  @Override
  @SuppressWarnings("unchecked")
  public List<ReportParameter> buildParameterList(Report report) throws ProviderException 
  {
    IReportEngine engine = BirtProvider
    .getBirtEngine(directoryProvider.getReportDirectory() + "platform");
   
    String designFile = directoryProvider.getReportDirectory() + report.getFile();
    IReportRunnable design = null;
   
    try
    {
      design = engine.openReportDesign(designFile);
    }
    catch (Throwable e)
    {
      log.error("getParameterNames Exception", e);     
      throw new ProviderException(e.toString());
   
   
    IGetParameterDefinitionTask task = engine
        .createGetParameterDefinitionTask(design);
   
    Collection<IParameterDefnBase> params = task.getParameterDefns(true);
   
    ArrayList<ReportParameter> parameters = new ArrayList<ReportParameter>();
View Full Code Here

                    birtContext.put(BirtWorker.BIRT_IMAGE_DIRECTORY, birtImageDirectory);
                }
                if (birtContentType == null) {
                    birtContentType = "application/pdf";
                }
                IReportEngine engine = BirtContainer.getReportEngine();
                HashMap<String, Object> appContext = UtilGenerics.cast(engine.getConfig().getAppContext());
                appContext.put("delegator", delegator);
                appContext.put("dispatcher", dispatcher);
                appContext.put("security", security);
               
                InputStream reportInputStream = BirtFactory.getReportInputStreamFromLocation(birtReportLocation);
                IReportRunnable design = engine.openReportDesign(reportInputStream);
                Debug.logInfo("Export report as content type:" + birtContentType, module);
                BirtWorker.exportReport(design, context, birtContentType, baos);
                baos.flush();
                baos.close();
View Full Code Here

        }
        if (birtImageDirectory == null) {
             birtImageDirectory = "/";
        }
        Debug.logInfo("Get report engine", module);
        IReportEngine engine = BirtContainer.getReportEngine();

        /*
        --- DISABLE JDBC FEATURE
        // set the jdbc connection
        String delegatorGroupHelperName = BirtContainer.getDelegatorGroupHelperName();
        Delegator delegator = BirtContainer.getDelegator();
        Debug.logInfo("Get the JDBC connection from group helper's name:" + delegatorGroupHelperName, module);
        String helperName = delegator.getGroupHelperName(delegatorGroupHelperName);    // gets the helper (localderby, localmysql, localpostgres, etc.) for your entity group org.ofbiz
        Connection connection = ConnectionFactory.getConnection(helperName);
        engine.getConfig().getAppContext().put("OdaJDBCDriverPassInConnection", connection);
        */

        IRunAndRenderTask task = engine.createRunAndRenderTask(design);
        if (birtLocale != null) {
            Debug.logInfo("Set birt locale:" + birtLocale, module);
            task.setLocale(birtLocale);
        }

View Full Code Here

                    birtContext.put(BirtWorker.BIRT_IMAGE_DIRECTORY, birtImageDirectory);
                }
                if (birtContentType == null) {
                    birtContentType = "application/pdf";
                }
                IReportEngine engine = BirtContainer.getReportEngine();
                InputStream reportInputStream = BirtFactory.getReportInputStreamFromLocation(birtReportLocation);
                IReportRunnable design = engine.openReportDesign(reportInputStream);
                     Debug.logInfo("Export report as content type:" + birtContentType, module);
                     BirtWorker.exportReport(design, context, birtContentType, baos);
                // and generate the PDF
                baos.flush();
                baos.close();
View Full Code Here

    public void render(String name, String page, String info,
            String contentType, String encoding, HttpServletRequest request,
            HttpServletResponse response) throws ViewHandlerException {
        try {
            IReportEngine engine = BirtContainer.getReportEngine();
            // open report design
            IReportRunnable design = null;
            if (page.startsWith("component://")) {
                InputStream reportInputStream = BirtFactory.getReportInputStreamFromLocation(page);
                design = engine.openReportDesign(reportInputStream);
            } else {
                design = engine.openReportDesign(servletContext.getRealPath(page));
            }

             Map<String, Object> context = FastMap.newInstance();
            // set parameters from request
             Map<String, Object> parameters = UtilGenerics.cast(request.getAttribute(BirtWorker.BIRT_PARAMETERS));
View Full Code Here

         Platform.startup( config );
         IReportEngineFactory factory = (IReportEngineFactory) Platform
               .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );

         IReportEngine engine = factory.createReportEngine( config );
         return engine;
      }
      catch (BirtException e)
      {
         throw new RuntimeException("Failed to create birt engine", e);
View Full Code Here

         EngineConfig config = new EngineConfig( );
         Platform.startup( config );
         IReportEngineFactory factory = (IReportEngineFactory) Platform
               .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );

         IReportEngine engine = factory.createReportEngine( config );
         return engine;
      }
      catch (BirtException e)
      {
         throw new RuntimeException("Failed to create birt engine", e);
View Full Code Here

TOP

Related Classes of org.eclipse.birt.report.engine.api.IReportEngine

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.