Package org.pentaho.actionsequence.dom.actions

Examples of org.pentaho.actionsequence.dom.actions.JFreeReportAction


      return defaultValue;
    }
  }

  private boolean initReportConfigParameters( final MasterReport report ) {
    JFreeReportAction jFreeReportAction = (JFreeReportAction) getActionDefinition();
    boolean result = true;
    if ( isDefinedInput( AbstractJFreeReportComponent.DATACOMPONENT_REPORTTEMP_OBJINPUT ) ) {
      Object reportConfigParams = jFreeReportAction.getReportConfig().getValue();
      if ( reportConfigParams != null ) {
        if ( reportConfigParams instanceof IPentahoResultSet ) {
          setReportConfigParameters( report, (IPentahoResultSet) reportConfigParams );
        } else if ( reportConfigParams instanceof Map ) {
          setReportConfigParameters( report, (Map) reportConfigParams );
View Full Code Here


    }
  }

  private boolean initReportInputs( final MasterReport report ) throws CloneNotSupportedException {

    JFreeReportAction jFreeReportAction = (JFreeReportAction) getActionDefinition();
    // Get input parameters, and set them as properties in the report
    // object.
    IActionInput[] actionInputs = jFreeReportAction.getInputs();
    for ( IActionInput element : actionInputs ) {
      String paramName = element.getName();
      Object paramValue = element.getValue();
      if ( ( paramValue == null ) || "".equals( paramValue ) ) { //$NON-NLS-1$
        continue;
View Full Code Here

    return fileExtension;
  }

  private boolean generateReport( final MasterReport report,
                                  final PentahoTableDataFactory factory ) throws IOException {
    JFreeReportAction jFreeReportAction = (JFreeReportAction) getActionDefinition();
    boolean result = false;
    try {
      applyThreadPriority();

      // this might be invalid in case the action is contained in a sub-directory.
      final String baseName = IOUtils.getInstance().stripFileExtension( getActionName() );
      final String path = getSolutionPath();
      final PentahoResourceBundleFactory bundleFactory =
          new PentahoResourceBundleFactory( path, baseName, getSession() );
      report.setResourceBundleFactory( bundleFactory );
      // set the default resourcebundle. This allows users to override the
      // resource-bundle in case they want to keep common strings in a common
      // collection.
      report.getReportConfiguration().setConfigProperty( ResourceBundleFactory.DEFAULT_RESOURCE_BUNDLE_CONFIG_KEY,
          baseName );

      if ( factory != null ) {
        report.setDataFactory( factory );
      }

      String printerName = jFreeReportAction.getPrinterName().getStringValue();
      String outputFormat = jFreeReportAction.getOutputType().getStringValue();

      if ( printerName != null ) {
        result = print( report, getActionTitle(), printerName );
      } else if ( AbstractJFreeReportComponent.REPORTALLCONTENT_OUTPUTTYPE_SWING.equals( outputFormat ) ) {
        if ( GraphicsEnvironment.isHeadless() ) {
          result = writeSwingPreview( report );
        }
        warn( Messages.getInstance().getString( "JFreeReportAllContentComponent.WARN_HEADLESSMODE_ACTIVE" ) ); //$NON-NLS-1$
      } else if ( AbstractJFreeReportComponent.REPORTALLCONTENT_OUTPUTTYPE_HTML.equals( outputFormat )
          || AbstractJFreeReportComponent.REPORTALLCONTENT_OUTPUTTYPE_PDF.equals( outputFormat )
          || AbstractJFreeReportComponent.REPORTALLCONTENT_OUTPUTTYPE_XLS.equals( outputFormat )
          || AbstractJFreeReportComponent.REPORTALLCONTENT_OUTPUTTYPE_CSV.equals( outputFormat )
          || AbstractJFreeReportComponent.REPORTALLCONTENT_OUTPUTTYPE_RTF.equals( outputFormat )
          || AbstractJFreeReportComponent.REPORTALLCONTENT_OUTPUTTYPE_XML.equals( outputFormat ) ) {
        String mimeType = getMimeType( outputFormat );
        String fileExtention = getFileExtension( outputFormat );
        IContentItem contentItem = getContentItem( mimeType, fileExtention );
        OutputStream outputStream = null;
        if ( contentItem != null ) {
          outputStream = contentItem.getOutputStream( getActionName() );
        } else {
          outputStream = getDefaultOutputStream( mimeType );
        }
        result =
            writeReport( outputFormat, report, outputStream, jFreeReportAction.getReportGenerationYieldRate()
                .getIntValue( 0 ), jFreeReportAction.getHtmlContentHandlerUrlPattern().getStringValue() );
        if ( contentItem != null ) {
          contentItem.closeOutputStream();
        }
      } else {
        warn( Messages.getInstance().getString( "JFreeReportAllContentComponent.WARN_NO_PRINTER_GIVEN" ) ); //$NON-NLS-1$
View Full Code Here

          "AbstractGenerateContentComponent.JFreeReport.ERROR_0044_UNABLE_T0_SET_THREAD_PRIORITY" ) ); //$NON-NLS-1$
    }
  }

  protected IContentItem getContentItem( final String mimeType, final String extension ) {
    JFreeReportAction jFreeReportAction = (JFreeReportAction) getActionDefinition();
    // Try to get the output from the action-sequence document.
    IContentItem contentItem = null;
    IActionOutput actionOutput = jFreeReportAction.getOutputReport();
    if ( actionOutput != null ) {
      contentItem = getOutputItem( actionOutput.getName(), mimeType, extension );
      contentItem.setMimeType( mimeType );
    } else if ( getOutputNames().size() == 1 ) {
      String outputName = (String) getOutputNames().iterator().next();
View Full Code Here

TOP

Related Classes of org.pentaho.actionsequence.dom.actions.JFreeReportAction

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.