public Integer getCompatibilityLevel() { final Object definedCompatLevel = getAttribute( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.COMAPTIBILITY_LEVEL ); if ( definedCompatLevel instanceof Integer ) { return (Integer) definedCompatLevel; } return null; }
processedReport.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.DATA_CACHE ); final boolean dataCacheEnabled = designtime == false && Boolean.FALSE.equals( dataCacheEnabledRaw ) == false;
public DocumentBundle getBundle() { final Object o = getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.BUNDLE ); if ( o instanceof DocumentBundle ) { return (DocumentBundle) o; } return null; }
public ElementStyleDefinition getStyleDefinition() { return (ElementStyleDefinition) getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.STYLE_SHEET ); }
public ResourceKey getStyleSheetReference() { return (ResourceKey) getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.STYLE_SHEET_REFERENCE ); }
public String getContentCacheKey() { return (String) getAttribute( AttributeNames.Pentaho.NAMESPACE, AttributeNames.Pentaho.CONTENT_CACHE_KEY ); }
/** * Returns the logical page definition for this report. * * @return the page definition. */ public PageDefinition getPageDefinition() { final PageDefinition pageDefinition = (PageDefinition) getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.PAGE_DEFINITION ); if ( pageDefinition == null ) { return createDefaultPageDefinition(); } return pageDefinition; }
private Configuration mapStaticMetaData( final Configuration configuration, final MasterReport report ) { HierarchicalConfiguration hc = new HierarchicalConfiguration( configuration ); setConfigurationIfDefined( hc, "org.pentaho.reporting.engine.classic.core.layout.fontrenderer.ComplexTextLayout", report.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.COMPLEX_TEXT ) ); setConfigurationIfDefined( hc, "org.pentaho.reporting.engine.classic.core.WatermarkPrintedOnTopOfContent", report.getWatermark() .getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.WATERMARK_PRINTED_ON_TOP ) ); return hc; }
report.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.AUTO_SUBMIT_PARAMETER ); final boolean showAutoSubmitCheckbox; final boolean autoSubmitDefault; showAutoSubmitCheckbox = true; autoSubmitDefault = Boolean.FALSE.equals( report.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.AUTO_SUBMIT_DEFAULT ) ) == false; } else {
ODFMetaAttributeNames.DublinCore.DATE, currentDate ); final MasterReport masterReport = state.getMasterReport(); final Object visibleFlag = masterReport.getAttribute( AttributeNames.Pentaho.NAMESPACE, "visible" ); if ( Boolean.FALSE.equals( visibleFlag ) ) { writeableMetaData.setBundleAttribute( ClassicEngineBoot.METADATA_NAMESPACE, "visible", "false" );
@Test public void testUnconfiguredDoesNotCrash() throws ReportProcessingException { BSFReportPreProcessor p = new BSFReportPreProcessor(); MasterReport preData = materializePreData( new MasterReport(), p ); MasterReport postData = materialize( new MasterReport(), p ); Assert.assertNull( preData.getAttribute( "test", "test" ) ); Assert.assertNull( postData.getAttribute( "test", "test" ) ); }
@Test public void testReportIsConfigured() throws ReportProcessingException { ReportPreProcessor p = create(); MasterReport preData = materializePreData( new MasterReport(), p ); MasterReport postData = materialize( new MasterReport(), p ); Assert.assertEquals( "pre-data-script", preData.getAttribute( "test", "test" ) ); Assert.assertEquals( "script", postData.getAttribute( "test", "test" ) ); } }
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 ); }
@Test public void testSortOrderCalculationRelational() throws ReportProcessingException { DesignTimeDataSchemaModel model = new DesignTimeDataSchemaModel( new MasterReport() ); RelationalReportBuilder builder = new RelationalReportBuilder( model ); builder.addGroup( "Group-A" ); builder.addGroup( "Group-B" ); builder.addGroup( "Group-C" ); MasterReport report = builder.createReport(); report.setAutoSort( Boolean.TRUE ); ReportPreProcessor reportPreProcessor = create(); MasterReport materialized = materializePreData( report, reportPreProcessor ); Object attribute = materialized .getAttribute( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.COMPUTED_SORT_CONSTRAINTS ); Assert.assertTrue( attribute instanceof List ); List<SortConstraint> sc = (List<SortConstraint>) attribute; Assert.assertEquals( 3, sc.size() ); Assert.assertEquals( new SortConstraint( "Group-A", true ), sc.get( 0 ) ); Assert.assertEquals( new SortConstraint( "Group-B", true ), sc.get( 1 ) ); Assert.assertEquals( new SortConstraint( "Group-C", true ), sc.get( 2 ) ); }
@Test public void testSortOrderCalculationCrosstab() throws ReportProcessingException { ContextAwareDataSchemaModel model = new DesignTimeDataSchemaModel( new MasterReport() ); CrosstabBuilder builder = new CrosstabBuilder( model ); builder.addDetails( "Details", null ); builder.addRowDimension( "Row-A" ); builder.addRowDimension( "Row-B" ); builder.addOtherDimension( "Other-A" ); builder.addOtherDimension( "Other-B" ); builder.addColumnDimension( "Col-A" ); builder.addColumnDimension( "Col-B" ); MasterReport report = builder.createReport(); report.setAutoSort( Boolean.TRUE ); ReportPreProcessor reportPreProcessor = create(); MasterReport materialized = materializePreData( report, reportPreProcessor ); Object attribute = materialized .getAttribute( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.COMPUTED_SORT_CONSTRAINTS ); Assert.assertTrue( attribute instanceof List ); List<SortConstraint> sc = (List<SortConstraint>) attribute; Assert.assertEquals( 6, sc.size() ); Assert.assertEquals( new SortConstraint( "Other-A", true ), sc.get( 0 ) ); Assert.assertEquals( new SortConstraint( "Other-B", true ), sc.get( 1 ) ); Assert.assertEquals( new SortConstraint( "Row-A", true ), sc.get( 2 ) ); Assert.assertEquals( new SortConstraint( "Row-B", true ), sc.get( 3 ) ); Assert.assertEquals( new SortConstraint( "Col-A", true ), sc.get( 4 ) ); Assert.assertEquals( new SortConstraint( "Col-B", true ), sc.get( 5 ) ); } }
this.contentBase = report.getContentBase(); 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().derive(), dataCacheEnabled );