Java Code Examples for org.pentaho.reporting.engine.classic.core.MasterReport#getContentBase()
The following examples show how to use
org.pentaho.reporting.engine.classic.core.MasterReport#getContentBase() .
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: ResourceWriter.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public static boolean isEmbeddedKey( final MasterReport report, final ResourceKey resourceKey ) { final ResourceKey contentBase = report.getContentBase(); if ( contentBase == null ) { return false; } ResourceKey bundleKey = contentBase.getParent(); while ( bundleKey != null ) { if ( bundleKey.equals( resourceKey.getParent() ) ) { return true; } bundleKey = bundleKey.getParent(); } return false; }
Example 2
Source File: AbstractReportProcessor.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
protected DefaultProcessingContext createProcessingContext() throws ReportProcessingException { final OutputProcessorMetaData metaData = getOutputProcessorMetaData(); final MasterReport report = getReport(); final DocumentMetaData documentMetaData; final DocumentBundle bundle = report.getBundle(); if ( bundle != null ) { documentMetaData = bundle.getMetaData(); } else { documentMetaData = new MemoryDocumentMetaData(); } final Integer compatibilityLevel = report.getCompatibilityLevel(); final int cLevel; if ( compatibilityLevel == null ) { cLevel = -1; } else { cLevel = compatibilityLevel; } return new DefaultProcessingContext( metaData, report.getResourceBundleFactory(), report.getConfiguration(), report .getResourceManager(), report.getContentBase(), documentMetaData, report.getReportEnvironment(), cLevel ); }
Example 3
Source File: LoadRepositoryRunnable.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
private IMetadataDomainRepository buildDomainRepository() { try { final AbstractReportDefinition report = context.getReport(); final MasterReport masterReport = DesignTimeUtil.getMasterReport( report ); final ResourceKey contentBase; if ( masterReport == null ) { contentBase = null; } else { contentBase = masterReport.getContentBase(); } final ResourceManager resourceManager = DesignTimeUtil.getResourceManager( report ); return new PmdConnectionProvider() .getMetadataDomainRepository( domainId, resourceManager, contentBase, fileName ); } catch ( Exception e ) { context.error( e ); } return new InMemoryMetadataDomainRepository(); }
Example 4
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 5
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 6
Source File: DefaultParameterContext.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public DefaultParameterContext( final MasterReport report, final ReportParameterValues parameterValues ) throws ReportProcessingException { if ( report == null ) { throw new NullPointerException( "Report parameter must not be null" ); } if ( parameterValues == null ) { throw new NullPointerException( "ParameterValues parameter must not be null" ); } this.configuration = report.getConfiguration(); this.resourceBundleFactory = MasterReport.computeAndInitResourceBundleFactory( report.getResourceBundleFactory(), report .getReportEnvironment() ); this.contentBase = report.getContentBase(); this.resourceManager = report.getResourceManager(); this.reportEnvironment = report.getReportEnvironment(); final Object dataCacheEnabledRaw = report.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.DATA_CACHE ); final boolean dataCacheEnabled = Boolean.FALSE.equals( dataCacheEnabledRaw ) == false; this.dataFactory = new CachingDataFactory( report.getDataFactory(), dataCacheEnabled ); final DocumentBundle bundle = report.getBundle(); if ( bundle != null ) { this.documentMetaData = bundle.getMetaData(); } this.dataFactory.initialize( new DesignTimeDataFactoryContext( configuration, resourceManager, contentBase, resourceBundleFactory, dataFactory ) ); final ReportEnvironmentDataRow envDataRow = new ReportEnvironmentDataRow( reportEnvironment ); this.parameterValues = new CompoundDataRow( envDataRow, parameterValues ); }
Example 7
Source File: ReportWriter.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Builds a default configuration from a given report definition object. * <p/> * This will only create a valid definition, if the report has a valid content base object set. * * @param report * the report for which to create the writer configuration. * @return the generated configuration. */ public static Configuration createDefaultConfiguration( final MasterReport report ) { final ModifiableConfiguration repConf = new HierarchicalConfiguration( report.getReportConfiguration() ); final ResourceKey contentBase = report.getContentBase(); if ( contentBase != null ) { final ResourceManager resourceManager = report.getResourceManager(); final URL value = resourceManager.toURL( contentBase ); if ( value != null ) { repConf.setConfigProperty( AbstractXmlResourceFactory.CONTENTBASE_KEY, value.toExternalForm() ); } } return repConf; }
Example 8
Source File: DefaultProcessingContext.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public DefaultProcessingContext( final MasterReport report, final OutputProcessorMetaData metaData ) throws ReportProcessingException { this( metaData, report.getResourceBundleFactory(), report.getConfiguration(), report.getResourceManager(), report .getContentBase(), report.getBundle().getMetaData(), report.getReportEnvironment(), -1 ); final Integer comLev = report.getCompatibilityLevel(); if ( comLev != null ) { compatibilityLevel = comLev; } }
Example 9
Source File: SimpleMondrianDataSourceEditor.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
private String lookupSchemaName() { final AbstractReportDefinition report = context.getReport(); final MasterReport masterReport = DesignTimeUtil.getMasterReport( report ); final ResourceManager resourceManager = masterReport.getResourceManager(); final ResourceKey contextKey = masterReport.getContentBase(); final String designTimeFile = filenameField.getText(); return MondrianUtil.parseSchemaName( resourceManager, contextKey, designTimeFile ); }
Example 10
Source File: MondrianDataSourceEditor.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
private String lookupSchemaName() { final AbstractReportDefinition report = context.getReport(); final MasterReport masterReport = DesignTimeUtil.getMasterReport( report ); final ResourceManager resourceManager = masterReport.getResourceManager(); final ResourceKey contextKey = masterReport.getContentBase(); final String designTimeFile = filenameField.getText(); return MondrianUtil.parseSchemaName( resourceManager, contextKey, designTimeFile ); }
Example 11
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; }
Example 12
Source File: DesignTimeDataFactoryContext.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public DesignTimeDataFactoryContext( final MasterReport report ) { this( report.getConfiguration(), report.getResourceManager(), report.getContentBase(), MasterReport .computeAndInitResourceBundleFactory( report.getResourceBundleFactory(), report.getReportEnvironment() ), report.getDataFactory() ); }