Java Code Examples for org.pentaho.reporting.engine.classic.core.MasterReport#getAttribute()
The following examples show how to use
org.pentaho.reporting.engine.classic.core.MasterReport#getAttribute() .
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: SortOrderReportPreProcessorTest.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
@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 ) ); }
Example 2
Source File: PublishToServerTask.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
private void readBundleMetaData( final MasterReport report, final DocumentMetaData metaData, final SelectFileForPublishTask selectFileForPublishTask ) { final String oldDescription = (String) metaData.getBundleAttribute( ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.DESCRIPTION ); final String oldTitle = (String) metaData.getBundleAttribute( ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.TITLE ); final boolean oldLockOutput = Boolean.TRUE.equals( report.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.LOCK_PREFERRED_OUTPUT_TYPE ) ); final String oldExportType = (String) report.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.PREFERRED_OUTPUT_TYPE ); selectFileForPublishTask.setDescription( oldDescription ); selectFileForPublishTask.setReportTitle( oldTitle ); selectFileForPublishTask.setLockOutputType( oldLockOutput ); selectFileForPublishTask.setExportType( oldExportType ); }
Example 3
Source File: WizardProcessorUtil.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public static MasterReport materialize( final MasterReport report, final WizardProcessor processor ) throws ReportProcessingException { final PerformanceMonitorContext performanceMonitorContext = ClassicEngineBoot.getInstance().getObjectFactory().get( PerformanceMonitorContext.class ); try { final DefaultProcessingContext processingContext = new DefaultProcessingContext( report ); final DataSchemaDefinition definition = report.getDataSchemaDefinition(); final DefaultFlowController flowController = new DefaultFlowController( processingContext, definition, StateUtilities.computeParameterValueSet( report ), performanceMonitorContext ); final CachingDataFactory dataFactory = new CachingDataFactory( report.getDataFactory(), isCacheEnabled( report ) ); dataFactory.initialize( new ProcessingDataFactoryContext( processingContext, dataFactory ) ); try { final DefaultFlowController postQueryFlowController = flowController.performDesignTimeQuery ( dataFactory, report.getQuery(), report.getQueryLimit(), report.getQueryTimeout(), flowController.getMasterRow().getResourceBundleFactory() ); final Object originalEnable = report.getAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE ); report.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, Boolean.TRUE ); final MasterReport masterReport = processor.performPreProcessing( report, postQueryFlowController ); masterReport.setAttribute( AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, originalEnable ); masterReport.setName( null ); DesignTimeUtil.resetDocumentMetaData( masterReport ); return masterReport; } finally { dataFactory.close(); } } finally { performanceMonitorContext.close(); } }
Example 4
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 5
Source File: BundleMetaFileWriter.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public String writeReport( final WriteableDocumentBundle bundle, final BundleWriterState state ) throws IOException, BundleWriterException { if ( state == null ) { throw new NullPointerException(); } if ( bundle == null ) { throw new NullPointerException(); } final WriteableDocumentMetaData writeableMetaData = bundle.getWriteableDocumentMetaData(); final String version = ClassicEngineInfo.getInstance().getName() + ' ' + ClassicEngineInfo.getInstance().getVersion(); writeableMetaData.setBundleAttribute( ODFMetaAttributeNames.Meta.NAMESPACE, ODFMetaAttributeNames.Meta.GENERATOR, version ); final Date currentDate = new Date(); if ( writeableMetaData.getBundleAttribute( ODFMetaAttributeNames.Meta.NAMESPACE, ODFMetaAttributeNames.Meta.CREATION_DATE ) == null ) { writeableMetaData.setBundleAttribute( ODFMetaAttributeNames.Meta.NAMESPACE, ODFMetaAttributeNames.Meta.CREATION_DATE, currentDate ); } writeableMetaData.setBundleAttribute( ODFMetaAttributeNames.DublinCore.NAMESPACE, 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" ); } else { writeableMetaData.setBundleAttribute( ClassicEngineBoot.METADATA_NAMESPACE, "visible", "true" ); } writeVersionMarker( writeableMetaData, masterReport ); return null; }
Example 6
Source File: SortOrderReportPreProcessorTest.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
@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 ) ); }
Example 7
Source File: PublishToServerTask.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
private String extractLastFileName( final MasterReport report ) { final Object lastFilenameAttr = report.getAttribute( ReportDesignerBoot.DESIGNER_NAMESPACE, ReportDesignerBoot.LAST_FILENAME ); final String oldName; if ( lastFilenameAttr != null ) { oldName = (String) lastFilenameAttr; } else { oldName = null; } return oldName; }
Example 8
Source File: PreviewSwingAction.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Invoked when an action occurs. */ public void actionPerformed( final ActionEvent e ) { if ( getActiveContext() == null ) { return; } final MasterReport reportElement = getActiveContext().getContextRoot(); final Component parent = getReportDesignerContext().getView().getParent(); final Window window = LibSwingUtil.getWindowAncestor( parent ); final PreviewDialog dialog; if ( window instanceof JDialog ) { dialog = new PreviewDialog( (JDialog) window ); } else if ( window instanceof JFrame ) { dialog = new PreviewDialog( (JFrame) window ); } else { dialog = new PreviewDialog(); } dialog.addWindowListener( new PreviewSizeMonitor( reportElement ) ); dialog.setReportJob( reportElement ); dialog.pack(); final Object attribute = reportElement.getAttribute ( ReportDesignerBoot.DESIGNER_NAMESPACE, "preview-dialog-bounds" );//$NON-NLS-1$ if ( attribute instanceof String ) { final Rectangle rectangle = LibSwingUtil.parseRectangle( attribute.toString() ); if ( rectangle != null ) { if ( LibSwingUtil.safeRestoreWindow( dialog, rectangle ) ) { dialog.setVisible( true ); return; } } } dialog.setSize( 700, 700 ); LibSwingUtil.centerDialogInParent( dialog ); dialog.setVisible( true ); }