Java Code Examples for org.pentaho.reporting.engine.classic.core.MasterReport#setBundle()
The following examples show how to use
org.pentaho.reporting.engine.classic.core.MasterReport#setBundle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LookAndFeelStep.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
private AbstractReportDefinition loadDefinitionFromFile( final File filename ) { try { final ResourceKey selectedFile = resourceManager.createKey( filename ); final Resource directly = resourceManager.create( selectedFile, null, new Class[] { MasterReport.class } ); final MasterReport resource = (MasterReport) directly.getResource(); final DocumentBundle bundle = resource.getBundle(); if ( bundle == null ) { // Ok, that should not happen if we work with the engine's parsers, but better safe than sorry. final MemoryDocumentBundle documentBundle = new MemoryDocumentBundle( resource.getContentBase() ); documentBundle.getWriteableDocumentMetaData().setBundleType( ClassicEngineBoot.BUNDLE_TYPE ); resource.setBundle( documentBundle ); resource.setContentBase( documentBundle.getBundleMainKey() ); } else { final MemoryDocumentBundle mem = new MemoryDocumentBundle( resource.getContentBase() ); BundleUtilities.copyStickyInto( mem, bundle ); BundleUtilities.copyMetaData( mem, bundle ); resource.setBundle( mem ); resource.setContentBase( mem.getBundleMainKey() ); } return (AbstractReportDefinition) resource.derive(); } catch ( Exception ex ) { getDesignTimeContext().error( ex ); return null; } }
Example 2
Source File: Prd4542Test.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public static MasterReport loadReport( final Object selectedFile, final ResourceManager resourceManager ) throws ResourceException, IOException { final Resource directly = resourceManager.createDirectly( selectedFile, MasterReport.class ); final MasterReport resource = (MasterReport) directly.getResource(); final DocumentBundle bundle = resource.getBundle(); if ( bundle == null ) { // Ok, that should not happen if we work with the engine's parsers, but better safe than sorry. final MemoryDocumentBundle documentBundle = new MemoryDocumentBundle( resource.getContentBase() ); documentBundle.getWriteableDocumentMetaData().setBundleType( ClassicEngineBoot.BUNDLE_TYPE ); resource.setBundle( documentBundle ); resource.setContentBase( documentBundle.getBundleMainKey() ); } else { final MemoryDocumentBundle mem = new MemoryDocumentBundle( resource.getContentBase() ); BundleUtilities.copyStickyInto( mem, bundle ); BundleUtilities.copyMetaData( mem, bundle ); resource.setBundle( mem ); resource.setContentBase( mem.getBundleMainKey() ); } final Object visible = resource.getBundle().getMetaData().getBundleAttribute( ClassicEngineBoot.METADATA_NAMESPACE, "visible" );//NON-NLS if ( "true".equals( visible ) )//NON-NLS { resource.setAttribute( AttributeNames.Pentaho.NAMESPACE, "visible", Boolean.TRUE );//NON-NLS } else if ( "false".equals( visible ) )//NON-NLS { resource.setAttribute( AttributeNames.Pentaho.NAMESPACE, "visible", Boolean.FALSE );//NON-NLS } return resource; }
Example 3
Source File: Prd3319IT.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * This method does what the report designer does on save. * * @param report * @param file * @throws Exception */ private void saveReport( final MasterReport report, final File file ) throws Exception { BundleWriter.writeReportToZipFile( report, file ); final ResourceManager resourceManager = report.getResourceManager(); final Resource bundleResource = resourceManager.createDirectly( file, DocumentBundle.class ); final DocumentBundle bundle = (DocumentBundle) bundleResource.getResource(); final ResourceKey bundleKey = bundle.getBundleKey(); final MemoryDocumentBundle mem = new MemoryDocumentBundle(); BundleUtilities.copyStickyInto( mem, bundle ); BundleUtilities.copyMetaData( mem, bundle ); report.setBundle( mem ); report.setContentBase( mem.getBundleMainKey() ); report.setDefinitionSource( bundleKey ); }
Example 4
Source File: Prd3159IT.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * This method does what the report designer does on save. * * @param report * @param file * @throws Exception */ private void saveReport( final MasterReport report, final File file ) throws Exception { BundleWriter.writeReportToZipFile( report, file ); final ResourceManager resourceManager = report.getResourceManager(); final Resource bundleResource = resourceManager.createDirectly( file, DocumentBundle.class ); final DocumentBundle bundle = (DocumentBundle) bundleResource.getResource(); final ResourceKey bundleKey = bundle.getBundleKey(); final MemoryDocumentBundle mem = new MemoryDocumentBundle(); BundleUtilities.copyStickyInto( mem, bundle ); BundleUtilities.copyMetaData( mem, bundle ); report.setBundle( mem ); report.setContentBase( mem.getBundleMainKey() ); report.setDefinitionSource( bundleKey ); }
Example 5
Source File: Prd3795IT.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * This method does what the report designer does on save. */ private void saveReport( final MasterReport report, final File file ) throws Exception { BundleWriter.writeReportToZipFile( report, file ); final ResourceManager resourceManager = report.getResourceManager(); final Resource bundleResource = resourceManager.createDirectly( file, DocumentBundle.class ); final DocumentBundle bundle = (DocumentBundle) bundleResource.getResource(); final ResourceKey bundleKey = bundle.getBundleKey(); final MemoryDocumentBundle mem = new MemoryDocumentBundle(); BundleUtilities.copyStickyInto( mem, bundle ); BundleUtilities.copyMetaData( mem, bundle ); report.setBundle( mem ); report.setContentBase( mem.getBundleMainKey() ); report.setDefinitionSource( bundleKey ); }
Example 6
Source File: OpenReportAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public static MasterReport loadReport( final Object selectedFile, final ResourceManager resourceManager ) throws ResourceException, IOException { final Resource directly = resourceManager.createDirectly( selectedFile, MasterReport.class ); final MasterReport resource = (MasterReport) directly.getResource(); final DocumentBundle bundle = resource.getBundle(); if ( bundle == null ) { // Ok, that should not happen if we work with the engine's parsers, but better safe than sorry. final MemoryDocumentBundle documentBundle = new MemoryDocumentBundle( resource.getContentBase() ); documentBundle.getWriteableDocumentMetaData().setBundleType( ClassicEngineBoot.BUNDLE_TYPE ); resource.setBundle( documentBundle ); resource.setContentBase( documentBundle.getBundleMainKey() ); } else { final MemoryDocumentBundle mem = new MemoryDocumentBundle( resource.getContentBase() ); BundleUtilities.copyStickyInto( mem, bundle ); BundleUtilities.copyMetaData( mem, bundle ); resource.setBundle( mem ); resource.setContentBase( mem.getBundleMainKey() ); } final Object visible = resource.getBundle().getMetaData().getBundleAttribute( ClassicEngineBoot.METADATA_NAMESPACE, "visible" );//NON-NLS if ( "true".equals( visible ) )//NON-NLS { resource.setAttribute( AttributeNames.Pentaho.NAMESPACE, "visible", Boolean.TRUE );//NON-NLS } else if ( "false".equals( visible ) )//NON-NLS { resource.setAttribute( AttributeNames.Pentaho.NAMESPACE, "visible", Boolean.FALSE );//NON-NLS } return resource; }