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$