Java Code Examples for org.pentaho.reporting.engine.classic.core.MasterReport#getDataSchemaDefinition()
The following examples show how to use
org.pentaho.reporting.engine.classic.core.MasterReport#getDataSchemaDefinition() .
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: DataSchemaWriter.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Writes a certain aspect into a own file. The name of file inside the bundle is returned as string. The file name * returned is always absolute and can be made relative by using the IOUtils of LibBase. If the writer-handler did not * generate a file on its own, it should return null. * * @param bundle * the bundle where to write to. * @param state * the writer state to hold the current processing information. * @return the name of the newly generated file or null if no file was created. * @throws IOException * if any error occured * @throws BundleWriterException * if a bundle-management error occured. */ public String writeReport( final WriteableDocumentBundle bundle, final BundleWriterState state ) throws IOException, BundleWriterException { if ( bundle == null ) { throw new NullPointerException(); } if ( state == null ) { throw new NullPointerException(); } final BundleWriterState contentState = new BundleWriterState( state, state.getReport(), "dataschema.xml" ); final OutputStream outputStream = new BufferedOutputStream( bundle.createEntry( contentState.getFileName(), "text/xml" ) ); final MasterReport report = state.getMasterReport(); final DataSchemaDefinition definition = report.getDataSchemaDefinition(); final StandaloneDataSchemaWriter dataSchemaWriter = new StandaloneDataSchemaWriter(); dataSchemaWriter.write( definition, outputStream, "UTF-8" ); outputStream.close(); return contentState.getFileName(); }
Example 2
Source File: MasterReportProcessPreprocessor.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public MasterReport invokePreProcessing( final MasterReport report ) throws ReportProcessingException { flowController = startFlowController; processors = StateUtilities.getAllPreProcessors( report, designtime ); DataSchemaDefinition fullDefinition = report.getDataSchemaDefinition(); MasterReport fullReport = report; for ( int i = 0; i < processors.length; i++ ) { final ReportPreProcessor processor = processors[i]; fullReport = processor.performPreProcessing( fullReport, flowController ); if ( fullReport.getDataSchemaDefinition() != fullDefinition ) { fullDefinition = fullReport.getDataSchemaDefinition(); flowController = flowController.updateDataSchema( fullDefinition ); } } return fullReport; }
Example 3
Source File: PreProcessorTestBase.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Helper method to invoke a pre-processor outside of the report processing. This is strictly for unit-testing only. * * @param report * @param processor * @return * @throws org.pentaho.reporting.engine.classic.core.ReportProcessingException */ protected MasterReport materialize( final MasterReport report, final ReportPreProcessor processor ) throws ReportProcessingException { final PerformanceMonitorContext pmc = new NoOpPerformanceMonitorContext(); final DefaultProcessingContext processingContext = new DefaultProcessingContext( report ); final DataSchemaDefinition definition = report.getDataSchemaDefinition(); final DefaultFlowController flowController = new DefaultFlowController( processingContext, definition, StateUtilities.computeParameterValueSet( report ), pmc ); final CachingDataFactory dataFactory = new CachingDataFactory( report.getDataFactory(), false ); dataFactory.initialize( new ProcessingDataFactoryContext( processingContext, dataFactory ) ); try { final DefaultFlowController postQueryFlowController = flowController.performQuery( dataFactory, report.getQuery(), report.getQueryLimit(), report.getQueryTimeout(), flowController.getMasterRow().getResourceBundleFactory(), Collections.<SortConstraint>emptyList() ); return processor.performPreProcessing( report, postQueryFlowController ); } finally { dataFactory.close(); } }
Example 4
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 5
Source File: MasterReportProcessPreprocessor.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public MasterReport invokePreDataProcessing( final MasterReport report ) throws ReportProcessingException { flowController = startFlowController; processors = StateUtilities.getAllPreProcessors( report, designtime ); DataSchemaDefinition fullDefinition = report.getDataSchemaDefinition(); MasterReport fullReport = report; for ( int i = 0; i < processors.length; i++ ) { final ReportPreProcessor processor = processors[i]; fullReport = processor.performPreDataProcessing( fullReport, flowController ); if ( fullReport.getDataSchemaDefinition() != fullDefinition ) { fullDefinition = fullReport.getDataSchemaDefinition(); flowController = flowController.updateDataSchema( fullDefinition ); } } return fullReport; }
Example 6
Source File: AbstractDesignTimeDataSchemaModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
protected DataSchemaDefinition createDataSchemaDefinition( final MasterReport masterReportElement ) { DataSchemaDefinition dataSchemaDefinition = masterReportElement.getDataSchemaDefinition(); if ( dataSchemaDefinition == null ) { return DataSchemaUtility.parseDefaults( masterReportElement.getResourceManager() ); } return dataSchemaDefinition; }
Example 7
Source File: PreProcessorTestBase.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
protected MasterReport materializePreData( MasterReport report, ReportPreProcessor reportPreProcessor ) throws ReportProcessingException { final PerformanceMonitorContext pmc = new NoOpPerformanceMonitorContext(); final DefaultProcessingContext processingContext = new DefaultProcessingContext( report ); final DataSchemaDefinition definition = report.getDataSchemaDefinition(); final DefaultFlowController flowController = new DefaultFlowController( processingContext, definition, StateUtilities.computeParameterValueSet( report ), pmc ); return reportPreProcessor.performPreDataProcessing( report, flowController ); }
Example 8
Source File: TemporaryDataSchemaModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
protected DataSchemaDefinition createDataSchemaDefinition( final MasterReport masterReportElement ) { DataSchemaDefinition dataSchemaDefinition = masterReportElement.getDataSchemaDefinition(); if ( dataSchemaDefinition == null ) { return DataSchemaUtility.parseDefaults( masterReportElement.getResourceManager() ); } return dataSchemaDefinition; }
Example 9
Source File: GeneratorTest.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
@Test public void testCrosstab() throws Exception { final GroupDefinition[] groupDefs = new GroupDefinition[ 3 ]; groupDefs[ 0 ] = new DefaultGroupDefinition( GroupType.RELATIONAL, "group-field1" ); groupDefs[ 1 ] = new DefaultGroupDefinition( GroupType.CT_ROW, "group-field2" ); groupDefs[ 2 ] = new DefaultGroupDefinition( GroupType.CT_COLUMN, "group-field3" ); final DetailFieldDefinition[] detailFields = new DetailFieldDefinition[ 1 ]; detailFields[ 0 ] = new DefaultDetailFieldDefinition( "detail-field1" ); final DefaultWizardSpecification wizardSpecification = new DefaultWizardSpecification(); wizardSpecification.setGroupDefinitions( groupDefs ); wizardSpecification.setDetailFieldDefinitions( detailFields ); final MasterReport report = new MasterReport(); report.setAttribute( AttributeNames.Wizard.NAMESPACE, "wizard-spec", wizardSpecification ); final ProcessingContext processingContext = new DefaultProcessingContext(); final DefaultFlowController flowController = new DefaultFlowController ( processingContext, report.getDataSchemaDefinition(), new ReportParameterValues(), new NoOpPerformanceMonitorContext() ); final WizardProcessor processor = new WizardProcessor(); final MasterReport masterReport = processor.performPreProcessing( report, flowController ); final int count = masterReport.getGroupCount(); assertEquals( groupDefs.length + 2, count ); final RelationalGroup defaultGroup = (RelationalGroup) masterReport.getRootGroup(); assertEquals( "Default-Group detector", 0, defaultGroup.getFieldsArray().length ); final SubGroupBody body = (SubGroupBody) defaultGroup.getBody(); final RelationalGroup group1 = (RelationalGroup) body.getGroup(); assertEquals( "Rel-Group", "group-field1", group1.getFieldsArray()[ 0 ] ); final SubGroupBody body1 = (SubGroupBody) group1.getBody(); final CrosstabGroup ctGroup = (CrosstabGroup) body1.getGroup(); final CrosstabRowGroupBody body2 = (CrosstabRowGroupBody) ctGroup.getBody(); final CrosstabRowGroup rowGroup = body2.getGroup(); assertEquals( "Row-Group", "group-field2", rowGroup.getField() ); final CrosstabColumnGroupBody body3 = (CrosstabColumnGroupBody) rowGroup.getBody(); final CrosstabColumnGroup colGroup = body3.getGroup(); assertEquals( "Col-Group", "group-field3", colGroup.getField() ); }