@Test public void testInitializeForSubreport() throws Exception { MasterReport masterReport = new MasterReport(); ProcessingContext processingContext = new DefaultProcessingContext(); OutputFunction outputFunction = new DefaultOutputFunction(); SubReport subReportSpy = spy( new SubReport() ); InstanceID instanceID = new InstanceID(); InlineSubreportMarker[] inlineSubreportMarkers = new InlineSubreportMarker[1]; inlineSubreportMarkers[0] = new InlineSubreportMarker( subReportSpy, instanceID, SubReportProcessType.INLINE ); ProcessState parentProcessStateSpy = spy( new ProcessState() ); ProcessState processState = new ProcessState(); masterReport.getRelationalGroup( 0 ).getHeader().addSubReport( subReportSpy ); masterReport.setQueryLimit( 3 ); subReportSpy.reconnectParent( masterReport ); when( subReportSpy.isQueryLimitInherited() ).thenReturn( false ).thenReturn( true ); when( parentProcessStateSpy.getReport() ).thenReturn( masterReport ); parentProcessStateSpy.initializeForMasterReport( masterReport, processingContext, outputFunction ); processState.initializeForSubreport( inlineSubreportMarkers, 0, parentProcessStateSpy ); assertEquals( Integer.valueOf( -1 ), processState.getQueryLimit() ); processState.initializeForSubreport( inlineSubreportMarkers, 0, parentProcessStateSpy ); assertEquals( Integer.valueOf( 3 ), processState.getQueryLimit() ); }
public void initializeForSubreport( final InlineSubreportMarker[] subReports, final int subReportIndex, final ProcessState parentState ) throws ReportProcessingException { if ( parentState == null ) { throw new NullPointerException(); } this.designtime = parentState.designtime; this.crosstabColumnSequenceCounter = new LongSequence( 10, -1 ); this.groupSequenceCounter = new LongSequence( 10, -1 ); this.groupSequenceCounter.set( 0, -1 ); this.recorder = (GroupSizeRecorder) parentState.recorder.clone(); this.recorder.reset(); this.performanceMonitorContext = parentState.performanceMonitorContext; this.reportInstancesShareConnection = parentState.reportInstancesShareConnection; this.groupStarts = new FastStack<GroupStartRecord>(); this.parentSubReportState = parentState; this.advanceHandler = BeginReportHandler.HANDLER; this.errorHandler = parentState.errorHandler; this.functionStorage = parentState.functionStorage; this.structureFunctionStorage = parentState.structureFunctionStorage; this.processStore = parentState.processStore; this.currentGroupIndex = ReportState.BEFORE_FIRST_GROUP; this.currentPresentationGroupIndex = ReportState.BEFORE_FIRST_GROUP; this.currentSubReport = subReportIndex; this.subReports = subReports.clone(); this.dataFactoryManager = parentState.dataFactoryManager; this.subReportStorage = parentState.subReportStorage; this.structuralPreprocessingNeeded = parentState.structuralPreprocessingNeeded; this.processLevels = parentState.processLevels; this.sequenceCounter = parentState.getSequenceCounter() + 1; this.currentSubReportMarker = subReports[ subReportIndex ]; this.inlineProcess = parentState.isInlineProcess() || currentSubReportMarker.getProcessType() == SubReportProcessType.INLINE; final SubReport subreportFromMarker = currentSubReportMarker.getSubreport(); final FunctionStorageKey functionStorageKey = FunctionStorageKey.createKey( parentSubReportState.getProcessKey(), subreportFromMarker ); final boolean needPreProcessing; final SubReport initialSubReport; if ( subReportStorage.contains( functionStorageKey ) ) { initialSubReport = subReportStorage.restore( functionStorageKey ); initialSubReport.reconnectParent( subreportFromMarker.getParentSection() ); applyCurrentStyleAndAttributes( subreportFromMarker, initialSubReport ); needPreProcessing = false; } else { initialSubReport = subreportFromMarker.derive( true ); initialSubReport.reconnectParent( subreportFromMarker.getParentSection() ); needPreProcessing = true; } final DefaultFlowController parentStateFlowController = parentState.getFlowController(); final ResourceBundleFactory resourceBundleFactory = parentState.getResourceBundleFactory(); if ( isSubReportInvisible( initialSubReport, parentStateFlowController ) ) { final ReportDefinition parentReport = parentState.getReport(); final SubReport dummyReport = new SubReport( functionStorageKey.getReportId() ); this.report = new ReportDefinitionImpl( dummyReport, parentReport.getPageDefinition(), subreportFromMarker.getParentSection() ); this.flowController = parentStateFlowController.derive(); this.advanceHandler = EndSubReportHandler.HANDLER; this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, computeStructureFunctions( initialSubReport.getStructureFunctions(), flowController.getReportContext().getOutputProcessorMetaData() ), this.report.getObjectID() ); } else { DataFactory dataFactory = dataFactoryManager.restore( functionStorageKey, isReportsShareConnections( initialSubReport ) ); final DefaultFlowController postPreProcessingFlowController; final SubReport preDataSubReport; if ( dataFactory == null ) { final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor( parentStateFlowController ); preDataSubReport = preprocessor.invokePreDataProcessing( initialSubReport ); postPreProcessingFlowController = preprocessor.getFlowController(); final DataFactory subreportDf = lookupDataFactory( preDataSubReport ); final boolean dataCacheEnabled = isCacheEnabled( preDataSubReport ); if ( subreportDf == null ) { dataFactory = new EmptyDataFactory(); } else { final DataFactory sortingDataFactory = new SortingDataFactory( subreportDf, performanceMonitorContext ); final CachingDataFactory cdataFactory = new CachingDataFactory( sortingDataFactory, dataCacheEnabled ); final ProcessingContext context = postPreProcessingFlowController.getReportContext(); cdataFactory.initialize( new ProcessingDataFactoryContext( context, cdataFactory ) ); dataFactoryManager.store( functionStorageKey, cdataFactory, isReportsShareConnections( preDataSubReport ) ); dataFactory = cdataFactory; } } else { preDataSubReport = initialSubReport; postPreProcessingFlowController = parentStateFlowController; } final ParameterMapping[] inputMappings = preDataSubReport.getInputMappings(); final ParameterMapping[] exportMappings = preDataSubReport.getExportMappings(); this.flowController = postPreProcessingFlowController.performInitSubreport( dataFactory, inputMappings, resourceBundleFactory ); final Integer queryLimitDefault = IntegerCache.getInteger( preDataSubReport.getQueryLimit() ); final Integer queryTimeoutDefault = IntegerCache.getInteger( preDataSubReport.getQueryTimeout() ); final Object queryRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY ), preDataSubReport.getQuery() ); final String queryDefined = designtime ? "design-time-query" : preDataSubReport.getQuery(); this.query = (String) ConverterRegistry.convert( queryRaw, String.class, queryDefined ); if ( this.currentSubReportMarker.getSubreport().isQueryLimitInherited() && parentState.queryLimit != null ) { this.queryLimit = parentState.queryLimit; } else { final Object queryLimitRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY_LIMIT ), queryLimitDefault ); this.queryLimit = (Integer) ConverterRegistry.convert( queryLimitRaw, Integer.class, queryLimitDefault ); } final Object queryTimeoutRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY_TIMEOUT ), queryTimeoutDefault ); this.queryTimeout = (Integer) ConverterRegistry.convert( queryTimeoutRaw, Integer.class, queryTimeoutDefault ); final List<SortConstraint> sortOrder = lookupSortOrder( preDataSubReport ); DefaultFlowController postQueryFlowController = flowController .performSubReportQuery( query, queryLimit, queryTimeout, exportMappings, sortOrder ); final ProxyDataSchemaDefinition schemaDefinition = new ProxyDataSchemaDefinition( preDataSubReport.getDataSchemaDefinition(), postQueryFlowController.getMasterRow().getDataSchemaDefinition() ); postQueryFlowController = postQueryFlowController.updateDataSchema( schemaDefinition ); SubReport fullReport = preDataSubReport; DefaultFlowController fullFlowController = postQueryFlowController; if ( needPreProcessing ) { final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor( postQueryFlowController ); fullReport = preprocessor.invokePreProcessing( preDataSubReport ); fullFlowController = preprocessor.getFlowController(); subReportStorage.store( functionStorageKey, fullReport ); } this.report = new ReportDefinitionImpl( fullReport, fullReport.getPageDefinition(), subreportFromMarker.getParentSection() ); final Expression[] structureFunctions = getStructureFunctionStorage().restore( functionStorageKey ); if ( structureFunctions != null ) { final StructureFunction[] functions = new StructureFunction[ structureFunctions.length ]; System.arraycopy( structureFunctions, 0, functions, 0, structureFunctions.length ); this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, functions, this.report.getObjectID() ); } else { final StructureFunction[] functions = computeStructureFunctions( fullReport.getStructureFunctions(), fullFlowController.getReportContext().getOutputProcessorMetaData() ); this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, functions, this.report.getObjectID() ); } boolean preserve = true; Expression[] expressions = getFunctionStorage().restore( functionStorageKey ); if ( expressions == null ) { if ( designtime ) { expressions = new Expression[ 0 ]; } else { expressions = fullReport.getExpressions().getExpressions(); } preserve = false; } this.flowController = fullFlowController.activateExpressions( expressions, preserve ); this.flowController = this.flowController.refreshDataRow(); if ( this.report.getParentSection() == null ) { throw new InvalidReportStateException(); } if ( this.report.getParentSection().getReportDefinition() != this.parentSubReportState.getReport() ) { throw new InvalidReportStateException(); } final int processingLevel = flowController.getReportContext().getProcessingLevel(); if ( processingLevel == LayoutProcess.LEVEL_PAGINATE ) { if ( this.parentSubReportState.isInItemGroup() ) { if ( this.parentSubReportState.getReport().getDetailsFooter().getComputedStyle() == null ) { throw new InvalidReportStateException(); } } } } StateUtilities.computeLevels( this.flowController, this.layoutProcess, processLevels ); this.processKey = createKey(); }
ProcessState implements ReportState { public void initializeForSubreport( final InlineSubreportMarker[] subReports, final int subReportIndex, final ProcessState parentState ) throws ReportProcessingException { if ( parentState == null ) { throw new NullPointerException(); } this.designtime = parentState.designtime; this.crosstabColumnSequenceCounter = new LongSequence( 10, -1 ); this.groupSequenceCounter = new LongSequence( 10, -1 ); this.groupSequenceCounter.set( 0, -1 ); this.recorder = (GroupSizeRecorder) parentState.recorder.clone(); this.recorder.reset(); this.performanceMonitorContext = parentState.performanceMonitorContext; this.reportInstancesShareConnection = parentState.reportInstancesShareConnection; this.groupStarts = new FastStack<GroupStartRecord>(); this.parentSubReportState = parentState; this.advanceHandler = BeginReportHandler.HANDLER; this.errorHandler = parentState.errorHandler; this.functionStorage = parentState.functionStorage; this.structureFunctionStorage = parentState.structureFunctionStorage; this.processStore = parentState.processStore; this.currentGroupIndex = ReportState.BEFORE_FIRST_GROUP; this.currentPresentationGroupIndex = ReportState.BEFORE_FIRST_GROUP; this.currentSubReport = subReportIndex; this.subReports = subReports.clone(); this.dataFactoryManager = parentState.dataFactoryManager; this.subReportStorage = parentState.subReportStorage; this.structuralPreprocessingNeeded = parentState.structuralPreprocessingNeeded; this.processLevels = parentState.processLevels; this.sequenceCounter = parentState.getSequenceCounter() + 1; this.currentSubReportMarker = subReports[ subReportIndex ]; this.inlineProcess = parentState.isInlineProcess() || currentSubReportMarker.getProcessType() == SubReportProcessType.INLINE; final SubReport subreportFromMarker = currentSubReportMarker.getSubreport(); final FunctionStorageKey functionStorageKey = FunctionStorageKey.createKey( parentSubReportState.getProcessKey(), subreportFromMarker ); final boolean needPreProcessing; final SubReport initialSubReport; if ( subReportStorage.contains( functionStorageKey ) ) { initialSubReport = subReportStorage.restore( functionStorageKey ); initialSubReport.reconnectParent( subreportFromMarker.getParentSection() ); applyCurrentStyleAndAttributes( subreportFromMarker, initialSubReport ); needPreProcessing = false; } else { initialSubReport = subreportFromMarker.derive( true ); initialSubReport.reconnectParent( subreportFromMarker.getParentSection() ); needPreProcessing = true; } final DefaultFlowController parentStateFlowController = parentState.getFlowController(); final ResourceBundleFactory resourceBundleFactory = parentState.getResourceBundleFactory(); if ( isSubReportInvisible( initialSubReport, parentStateFlowController ) ) { final ReportDefinition parentReport = parentState.getReport(); final SubReport dummyReport = new SubReport( functionStorageKey.getReportId() ); this.report = new ReportDefinitionImpl( dummyReport, parentReport.getPageDefinition(), subreportFromMarker.getParentSection() ); this.flowController = parentStateFlowController.derive(); this.advanceHandler = EndSubReportHandler.HANDLER; this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, computeStructureFunctions( initialSubReport.getStructureFunctions(), flowController.getReportContext().getOutputProcessorMetaData() ), this.report.getObjectID() ); } else { DataFactory dataFactory = dataFactoryManager.restore( functionStorageKey, isReportsShareConnections( initialSubReport ) ); final DefaultFlowController postPreProcessingFlowController; final SubReport preDataSubReport; if ( dataFactory == null ) { final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor( parentStateFlowController ); preDataSubReport = preprocessor.invokePreDataProcessing( initialSubReport ); postPreProcessingFlowController = preprocessor.getFlowController(); final DataFactory subreportDf = lookupDataFactory( preDataSubReport ); final boolean dataCacheEnabled = isCacheEnabled( preDataSubReport ); if ( subreportDf == null ) { dataFactory = new EmptyDataFactory(); } else { final DataFactory sortingDataFactory = new SortingDataFactory( subreportDf, performanceMonitorContext ); final CachingDataFactory cdataFactory = new CachingDataFactory( sortingDataFactory, dataCacheEnabled ); final ProcessingContext context = postPreProcessingFlowController.getReportContext(); cdataFactory.initialize( new ProcessingDataFactoryContext( context, cdataFactory ) ); dataFactoryManager.store( functionStorageKey, cdataFactory, isReportsShareConnections( preDataSubReport ) ); dataFactory = cdataFactory; } } else { preDataSubReport = initialSubReport; postPreProcessingFlowController = parentStateFlowController; } final ParameterMapping[] inputMappings = preDataSubReport.getInputMappings(); final ParameterMapping[] exportMappings = preDataSubReport.getExportMappings(); this.flowController = postPreProcessingFlowController.performInitSubreport( dataFactory, inputMappings, resourceBundleFactory ); final Integer queryLimitDefault = IntegerCache.getInteger( preDataSubReport.getQueryLimit() ); final Integer queryTimeoutDefault = IntegerCache.getInteger( preDataSubReport.getQueryTimeout() ); final Object queryRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY ), preDataSubReport.getQuery() ); final String queryDefined = designtime ? "design-time-query" : preDataSubReport.getQuery(); this.query = (String) ConverterRegistry.convert( queryRaw, String.class, queryDefined ); if ( this.currentSubReportMarker.getSubreport().isQueryLimitInherited() && parentState.queryLimit != null ) { this.queryLimit = parentState.queryLimit; } else { final Object queryLimitRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY_LIMIT ), queryLimitDefault ); this.queryLimit = (Integer) ConverterRegistry.convert( queryLimitRaw, Integer.class, queryLimitDefault ); } final Object queryTimeoutRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY_TIMEOUT ), queryTimeoutDefault ); this.queryTimeout = (Integer) ConverterRegistry.convert( queryTimeoutRaw, Integer.class, queryTimeoutDefault ); final List<SortConstraint> sortOrder = lookupSortOrder( preDataSubReport ); DefaultFlowController postQueryFlowController = flowController .performSubReportQuery( query, queryLimit, queryTimeout, exportMappings, sortOrder ); final ProxyDataSchemaDefinition schemaDefinition = new ProxyDataSchemaDefinition( preDataSubReport.getDataSchemaDefinition(), postQueryFlowController.getMasterRow().getDataSchemaDefinition() ); postQueryFlowController = postQueryFlowController.updateDataSchema( schemaDefinition ); SubReport fullReport = preDataSubReport; DefaultFlowController fullFlowController = postQueryFlowController; if ( needPreProcessing ) { final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor( postQueryFlowController ); fullReport = preprocessor.invokePreProcessing( preDataSubReport ); fullFlowController = preprocessor.getFlowController(); subReportStorage.store( functionStorageKey, fullReport ); } this.report = new ReportDefinitionImpl( fullReport, fullReport.getPageDefinition(), subreportFromMarker.getParentSection() ); final Expression[] structureFunctions = getStructureFunctionStorage().restore( functionStorageKey ); if ( structureFunctions != null ) { final StructureFunction[] functions = new StructureFunction[ structureFunctions.length ]; System.arraycopy( structureFunctions, 0, functions, 0, structureFunctions.length ); this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, functions, this.report.getObjectID() ); } else { final StructureFunction[] functions = computeStructureFunctions( fullReport.getStructureFunctions(), fullFlowController.getReportContext().getOutputProcessorMetaData() ); this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, functions, this.report.getObjectID() ); } boolean preserve = true; Expression[] expressions = getFunctionStorage().restore( functionStorageKey ); if ( expressions == null ) { if ( designtime ) { expressions = new Expression[ 0 ]; } else { expressions = fullReport.getExpressions().getExpressions(); } preserve = false; } this.flowController = fullFlowController.activateExpressions( expressions, preserve ); this.flowController = this.flowController.refreshDataRow(); if ( this.report.getParentSection() == null ) { throw new InvalidReportStateException(); } if ( this.report.getParentSection().getReportDefinition() != this.parentSubReportState.getReport() ) { throw new InvalidReportStateException(); } final int processingLevel = flowController.getReportContext().getProcessingLevel(); if ( processingLevel == LayoutProcess.LEVEL_PAGINATE ) { if ( this.parentSubReportState.isInItemGroup() ) { if ( this.parentSubReportState.getReport().getDetailsFooter().getComputedStyle() == null ) { throw new InvalidReportStateException(); } } } } StateUtilities.computeLevels( this.flowController, this.layoutProcess, processLevels ); this.processKey = createKey(); } }
ProcessState implements ReportState { public void initializeForSubreport( final InlineSubreportMarker[] subReports, final int subReportIndex, final ProcessState parentState ) throws ReportProcessingException { if ( parentState == null ) { throw new NullPointerException(); } this.designtime = parentState.designtime; this.crosstabColumnSequenceCounter = new LongSequence( 10, -1 ); this.groupSequenceCounter = new LongSequence( 10, -1 ); this.groupSequenceCounter.set( 0, -1 ); this.recorder = (GroupSizeRecorder) parentState.recorder.clone(); this.recorder.reset(); this.performanceMonitorContext = parentState.performanceMonitorContext; this.reportInstancesShareConnection = parentState.reportInstancesShareConnection; this.groupStarts = new FastStack<GroupStartRecord>(); this.parentSubReportState = parentState; this.advanceHandler = BeginReportHandler.HANDLER; this.errorHandler = parentState.errorHandler; this.functionStorage = parentState.functionStorage; this.structureFunctionStorage = parentState.structureFunctionStorage; this.processStore = parentState.processStore; this.currentGroupIndex = ReportState.BEFORE_FIRST_GROUP; this.currentPresentationGroupIndex = ReportState.BEFORE_FIRST_GROUP; this.currentSubReport = subReportIndex; this.subReports = subReports.clone(); this.dataFactoryManager = parentState.dataFactoryManager; this.subReportStorage = parentState.subReportStorage; this.structuralPreprocessingNeeded = parentState.structuralPreprocessingNeeded; this.processLevels = parentState.processLevels; this.sequenceCounter = parentState.getSequenceCounter() + 1; this.currentSubReportMarker = subReports[ subReportIndex ]; this.inlineProcess = parentState.isInlineProcess() || currentSubReportMarker.getProcessType() == SubReportProcessType.INLINE; final SubReport subreportFromMarker = currentSubReportMarker.getSubreport(); final FunctionStorageKey functionStorageKey = FunctionStorageKey.createKey( parentSubReportState.getProcessKey(), subreportFromMarker ); final boolean needPreProcessing; final SubReport initialSubReport; if ( subReportStorage.contains( functionStorageKey ) ) { initialSubReport = subReportStorage.restore( functionStorageKey ); initialSubReport.reconnectParent( subreportFromMarker.getParentSection() ); applyCurrentStyleAndAttributes( subreportFromMarker, initialSubReport ); needPreProcessing = false; } else { initialSubReport = subreportFromMarker.derive( true ); initialSubReport.reconnectParent( subreportFromMarker.getParentSection() ); needPreProcessing = true; } final DefaultFlowController parentStateFlowController = parentState.getFlowController(); final ResourceBundleFactory resourceBundleFactory = parentState.getResourceBundleFactory(); if ( isSubReportInvisible( initialSubReport, parentStateFlowController ) ) { final ReportDefinition parentReport = parentState.getReport(); final SubReport dummyReport = new SubReport( functionStorageKey.getReportId() ); this.report = new ReportDefinitionImpl( dummyReport, parentReport.getPageDefinition(), subreportFromMarker.getParentSection() ); this.flowController = parentStateFlowController.derive(); this.advanceHandler = EndSubReportHandler.HANDLER; this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, computeStructureFunctions( initialSubReport.getStructureFunctions(), flowController.getReportContext().getOutputProcessorMetaData() ), this.report.getObjectID() ); } else { DataFactory dataFactory = dataFactoryManager.restore( functionStorageKey, isReportsShareConnections( initialSubReport ) ); final DefaultFlowController postPreProcessingFlowController; final SubReport preDataSubReport; if ( dataFactory == null ) { final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor( parentStateFlowController ); preDataSubReport = preprocessor.invokePreDataProcessing( initialSubReport ); postPreProcessingFlowController = preprocessor.getFlowController(); final DataFactory subreportDf = lookupDataFactory( preDataSubReport ); final boolean dataCacheEnabled = isCacheEnabled( preDataSubReport ); if ( subreportDf == null ) { dataFactory = new EmptyDataFactory(); } else { final DataFactory sortingDataFactory = new SortingDataFactory( subreportDf, performanceMonitorContext ); final CachingDataFactory cdataFactory = new CachingDataFactory( sortingDataFactory, dataCacheEnabled ); final ProcessingContext context = postPreProcessingFlowController.getReportContext(); cdataFactory.initialize( new ProcessingDataFactoryContext( context, cdataFactory ) ); dataFactoryManager.store( functionStorageKey, cdataFactory, isReportsShareConnections( preDataSubReport ) ); dataFactory = cdataFactory; } } else { preDataSubReport = initialSubReport; postPreProcessingFlowController = parentStateFlowController; } final ParameterMapping[] inputMappings = preDataSubReport.getInputMappings(); final ParameterMapping[] exportMappings = preDataSubReport.getExportMappings(); this.flowController = postPreProcessingFlowController.performInitSubreport( dataFactory, inputMappings, resourceBundleFactory ); final Integer queryLimitDefault = IntegerCache.getInteger( preDataSubReport.getQueryLimit() ); final Integer queryTimeoutDefault = IntegerCache.getInteger( preDataSubReport.getQueryTimeout() ); final Object queryRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY ), preDataSubReport.getQuery() ); final String queryDefined = designtime ? "design-time-query" : preDataSubReport.getQuery(); this.query = (String) ConverterRegistry.convert( queryRaw, String.class, queryDefined ); if ( this.currentSubReportMarker.getSubreport().isQueryLimitInherited() && parentState.queryLimit != null ) { this.queryLimit = parentState.queryLimit; } else { final Object queryLimitRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY_LIMIT ), queryLimitDefault ); this.queryLimit = (Integer) ConverterRegistry.convert( queryLimitRaw, Integer.class, queryLimitDefault ); } final Object queryTimeoutRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY_TIMEOUT ), queryTimeoutDefault ); this.queryTimeout = (Integer) ConverterRegistry.convert( queryTimeoutRaw, Integer.class, queryTimeoutDefault ); final List<SortConstraint> sortOrder = lookupSortOrder( preDataSubReport ); DefaultFlowController postQueryFlowController = flowController .performSubReportQuery( query, queryLimit, queryTimeout, exportMappings, sortOrder ); final ProxyDataSchemaDefinition schemaDefinition = new ProxyDataSchemaDefinition( preDataSubReport.getDataSchemaDefinition(), postQueryFlowController.getMasterRow().getDataSchemaDefinition() ); postQueryFlowController = postQueryFlowController.updateDataSchema( schemaDefinition ); SubReport fullReport = preDataSubReport; DefaultFlowController fullFlowController = postQueryFlowController; if ( needPreProcessing ) { final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor( postQueryFlowController ); fullReport = preprocessor.invokePreProcessing( preDataSubReport ); fullFlowController = preprocessor.getFlowController(); subReportStorage.store( functionStorageKey, fullReport ); } this.report = new ReportDefinitionImpl( fullReport, fullReport.getPageDefinition(), subreportFromMarker.getParentSection() ); final Expression[] structureFunctions = getStructureFunctionStorage().restore( functionStorageKey ); if ( structureFunctions != null ) { final StructureFunction[] functions = new StructureFunction[ structureFunctions.length ]; System.arraycopy( structureFunctions, 0, functions, 0, structureFunctions.length ); this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, functions, this.report.getObjectID() ); } else { final StructureFunction[] functions = computeStructureFunctions( fullReport.getStructureFunctions(), fullFlowController.getReportContext().getOutputProcessorMetaData() ); this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, functions, this.report.getObjectID() ); } boolean preserve = true; Expression[] expressions = getFunctionStorage().restore( functionStorageKey ); if ( expressions == null ) { if ( designtime ) { expressions = new Expression[ 0 ]; } else { expressions = fullReport.getExpressions().getExpressions(); } preserve = false; } this.flowController = fullFlowController.activateExpressions( expressions, preserve ); this.flowController = this.flowController.refreshDataRow(); if ( this.report.getParentSection() == null ) { throw new InvalidReportStateException(); } if ( this.report.getParentSection().getReportDefinition() != this.parentSubReportState.getReport() ) { throw new InvalidReportStateException(); } final int processingLevel = flowController.getReportContext().getProcessingLevel(); if ( processingLevel == LayoutProcess.LEVEL_PAGINATE ) { if ( this.parentSubReportState.isInItemGroup() ) { if ( this.parentSubReportState.getReport().getDetailsFooter().getComputedStyle() == null ) { throw new InvalidReportStateException(); } } } } StateUtilities.computeLevels( this.flowController, this.layoutProcess, processLevels ); this.processKey = createKey(); } ProcessState(); }
ProcessState implements ReportState { public void initializeForSubreport( final InlineSubreportMarker[] subReports, final int subReportIndex, final ProcessState parentState ) throws ReportProcessingException { if ( parentState == null ) { throw new NullPointerException(); } this.designtime = parentState.designtime; this.crosstabColumnSequenceCounter = new LongSequence( 10, -1 ); this.groupSequenceCounter = new LongSequence( 10, -1 ); this.groupSequenceCounter.set( 0, -1 ); this.recorder = (GroupSizeRecorder) parentState.recorder.clone(); this.recorder.reset(); this.performanceMonitorContext = parentState.performanceMonitorContext; this.reportInstancesShareConnection = parentState.reportInstancesShareConnection; this.groupStarts = new FastStack<GroupStartRecord>(); this.parentSubReportState = parentState; this.advanceHandler = BeginReportHandler.HANDLER; this.errorHandler = parentState.errorHandler; this.functionStorage = parentState.functionStorage; this.structureFunctionStorage = parentState.structureFunctionStorage; this.processStore = parentState.processStore; this.currentGroupIndex = ReportState.BEFORE_FIRST_GROUP; this.currentPresentationGroupIndex = ReportState.BEFORE_FIRST_GROUP; this.currentSubReport = subReportIndex; this.subReports = subReports.clone(); this.dataFactoryManager = parentState.dataFactoryManager; this.subReportStorage = parentState.subReportStorage; this.structuralPreprocessingNeeded = parentState.structuralPreprocessingNeeded; this.processLevels = parentState.processLevels; this.sequenceCounter = parentState.getSequenceCounter() + 1; this.currentSubReportMarker = subReports[ subReportIndex ]; this.inlineProcess = parentState.isInlineProcess() || currentSubReportMarker.getProcessType() == SubReportProcessType.INLINE; final SubReport subreportFromMarker = currentSubReportMarker.getSubreport(); final FunctionStorageKey functionStorageKey = FunctionStorageKey.createKey( parentSubReportState.getProcessKey(), subreportFromMarker ); final boolean needPreProcessing; final SubReport initialSubReport; if ( subReportStorage.contains( functionStorageKey ) ) { initialSubReport = subReportStorage.restore( functionStorageKey ); initialSubReport.reconnectParent( subreportFromMarker.getParentSection() ); applyCurrentStyleAndAttributes( subreportFromMarker, initialSubReport ); needPreProcessing = false; } else { initialSubReport = subreportFromMarker.derive( true ); initialSubReport.reconnectParent( subreportFromMarker.getParentSection() ); needPreProcessing = true; } final DefaultFlowController parentStateFlowController = parentState.getFlowController(); final ResourceBundleFactory resourceBundleFactory = parentState.getResourceBundleFactory(); if ( isSubReportInvisible( initialSubReport, parentStateFlowController ) ) { final ReportDefinition parentReport = parentState.getReport(); final SubReport dummyReport = new SubReport( functionStorageKey.getReportId() ); this.report = new ReportDefinitionImpl( dummyReport, parentReport.getPageDefinition(), subreportFromMarker.getParentSection() ); this.flowController = parentStateFlowController.derive(); this.advanceHandler = EndSubReportHandler.HANDLER; this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, computeStructureFunctions( initialSubReport.getStructureFunctions(), flowController.getReportContext().getOutputProcessorMetaData() ), this.report.getObjectID() ); } else { DataFactory dataFactory = dataFactoryManager.restore( functionStorageKey, isReportsShareConnections( initialSubReport ) ); final DefaultFlowController postPreProcessingFlowController; final SubReport preDataSubReport; if ( dataFactory == null ) { final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor( parentStateFlowController ); preDataSubReport = preprocessor.invokePreDataProcessing( initialSubReport ); postPreProcessingFlowController = preprocessor.getFlowController(); final DataFactory subreportDf = lookupDataFactory( preDataSubReport ); final boolean dataCacheEnabled = isCacheEnabled( preDataSubReport ); if ( subreportDf == null ) { dataFactory = new EmptyDataFactory(); } else { final DataFactory sortingDataFactory = new SortingDataFactory( subreportDf, performanceMonitorContext ); final CachingDataFactory cdataFactory = new CachingDataFactory( sortingDataFactory, dataCacheEnabled ); final ProcessingContext context = postPreProcessingFlowController.getReportContext(); cdataFactory.initialize( new ProcessingDataFactoryContext( context, cdataFactory ) ); dataFactoryManager.store( functionStorageKey, cdataFactory, isReportsShareConnections( preDataSubReport ) ); dataFactory = cdataFactory; } } else { preDataSubReport = initialSubReport; postPreProcessingFlowController = parentStateFlowController; } final ParameterMapping[] inputMappings = preDataSubReport.getInputMappings(); final ParameterMapping[] exportMappings = preDataSubReport.getExportMappings(); this.flowController = postPreProcessingFlowController.performInitSubreport( dataFactory, inputMappings, resourceBundleFactory ); final Integer queryLimitDefault = IntegerCache.getInteger( preDataSubReport.getQueryLimit() ); final Integer queryTimeoutDefault = IntegerCache.getInteger( preDataSubReport.getQueryTimeout() ); final Object queryRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY ), preDataSubReport.getQuery() ); final String queryDefined = designtime ? "design-time-query" : preDataSubReport.getQuery(); this.query = (String) ConverterRegistry.convert( queryRaw, String.class, queryDefined ); if ( this.currentSubReportMarker.getSubreport().isQueryLimitInherited() && parentState.queryLimit != null ) { this.queryLimit = parentState.queryLimit; } else { final Object queryLimitRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY_LIMIT ), queryLimitDefault ); this.queryLimit = (Integer) ConverterRegistry.convert( queryLimitRaw, Integer.class, queryLimitDefault ); } final Object queryTimeoutRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY_TIMEOUT ), queryTimeoutDefault ); this.queryTimeout = (Integer) ConverterRegistry.convert( queryTimeoutRaw, Integer.class, queryTimeoutDefault ); final List<SortConstraint> sortOrder = lookupSortOrder( preDataSubReport ); DefaultFlowController postQueryFlowController = flowController .performSubReportQuery( query, queryLimit, queryTimeout, exportMappings, sortOrder ); final ProxyDataSchemaDefinition schemaDefinition = new ProxyDataSchemaDefinition( preDataSubReport.getDataSchemaDefinition(), postQueryFlowController.getMasterRow().getDataSchemaDefinition() ); postQueryFlowController = postQueryFlowController.updateDataSchema( schemaDefinition ); SubReport fullReport = preDataSubReport; DefaultFlowController fullFlowController = postQueryFlowController; if ( needPreProcessing ) { final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor( postQueryFlowController ); fullReport = preprocessor.invokePreProcessing( preDataSubReport ); fullFlowController = preprocessor.getFlowController(); subReportStorage.store( functionStorageKey, fullReport ); } this.report = new ReportDefinitionImpl( fullReport, fullReport.getPageDefinition(), subreportFromMarker.getParentSection() ); final Expression[] structureFunctions = getStructureFunctionStorage().restore( functionStorageKey ); if ( structureFunctions != null ) { final StructureFunction[] functions = new StructureFunction[ structureFunctions.length ]; System.arraycopy( structureFunctions, 0, functions, 0, structureFunctions.length ); this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, functions, this.report.getObjectID() ); } else { final StructureFunction[] functions = computeStructureFunctions( fullReport.getStructureFunctions(), fullFlowController.getReportContext().getOutputProcessorMetaData() ); this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, functions, this.report.getObjectID() ); } boolean preserve = true; Expression[] expressions = getFunctionStorage().restore( functionStorageKey ); if ( expressions == null ) { if ( designtime ) { expressions = new Expression[ 0 ]; } else { expressions = fullReport.getExpressions().getExpressions(); } preserve = false; } this.flowController = fullFlowController.activateExpressions( expressions, preserve ); this.flowController = this.flowController.refreshDataRow(); if ( this.report.getParentSection() == null ) { throw new InvalidReportStateException(); } if ( this.report.getParentSection().getReportDefinition() != this.parentSubReportState.getReport() ) { throw new InvalidReportStateException(); } final int processingLevel = flowController.getReportContext().getProcessingLevel(); if ( processingLevel == LayoutProcess.LEVEL_PAGINATE ) { if ( this.parentSubReportState.isInItemGroup() ) { if ( this.parentSubReportState.getReport().getDetailsFooter().getComputedStyle() == null ) { throw new InvalidReportStateException(); } } } } StateUtilities.computeLevels( this.flowController, this.layoutProcess, processLevels ); this.processKey = createKey(); } ProcessState(); boolean initializeForMasterReport( final MasterReport report,
                                         final ProcessingContext processingContext,
                                         final OutputFunction outputFunction ); void initializeForSubreport( final InlineSubreportMarker[] subReports,
                                      final int subReportIndex,
                                      final ProcessState parentState ); ReportProcessStore getProcessStore(); int[] getRequiredRuntimeLevels(); boolean isSubReportExecutable(); ProcessState returnFromSubReport( final LayoutProcess layoutProcess ); ProcessState restart(); ReportProcessingErrorHandler getErrorHandler(); void setErrorHandler( final ReportProcessingErrorHandler errorHandler ); void setSequenceCounter( final int sequenceCounter ); int getSequenceCounter(); InlineSubreportMarker getCurrentSubReportMarker(); boolean isInlineProcess(); SubReportProcessType getSubreportProcessingType(); ProcessState deriveForPagebreak(); ProcessState deriveForAdvance(); ProcessState deriveForStorage(); ProcessState clone(); AdvanceHandler getAdvanceHandler(); void setAdvanceHandler( final AdvanceHandler advanceHandler ); final ProcessState advance(); final ProcessState commit(); int getCurrentRow(); int getCurrentDataItem(); int getProgressLevel(); int getProgressLevelCount(); boolean isPrepareRun(); int getLevel(); boolean isFinish(); int getEventCode(); int getCurrentGroupIndex(); void enterGroup(); void leaveGroup(); int getPresentationGroupIndex(); void enterPresentationGroup(); void leavePresentationGroup(); ReportDefinition getReport(); int getCurrentSubReport(); ReportState getParentState(); ReportState getParentSubReportState(); FunctionStorage getStructureFunctionStorage(); FunctionStorage getFunctionStorage(); DefaultFlowController getFlowController(); void setFlowController( final DefaultFlowController flowController ); LayoutProcess getLayoutProcess(); ReportStateKey getProcessKey(); DataRow getDataRow(); int getNumberOfRows(); void firePageStartedEvent( final int baseEvent ); void firePageFinishedEvent( final boolean noParentPassing ); static boolean isLastItemInGroup( final Group rootGroup,
                                           final MasterDataRow currentDataRow,
                                           final MasterDataRow nextDataRow ); boolean isSubReportEvent(); InlineSubreportMarker[] getSubReports(); ProcessStateHandle getProcessHandle(); void setInItemGroup( final boolean inItemGroup ); boolean isInItemGroup(); ResourceBundleFactory getResourceBundleFactory(); boolean isArtifcialState(); GroupingState createGroupingState(); boolean isStructuralPreprocessingNeeded(); void advanceCursor(); Integer getPredictedStateCount(); boolean isCrosstabActive(); String toString(); ProcessState recordCrosstabRowState(); ProcessState replayStoredCrosstabRowState(); int getReplayStoredCrosstabGroup(); AdvanceHandler getPostSummaryRowAdvanceHandler(); void setPostSummaryRowAdvanceHandler( final AdvanceHandler postSummaryRowAdvanceHandler ); ProcessState finishReplayingStoredCrosstabRowState(); void clearStoredCrosstabRowState(); long getGroupSequenceCounter( final int groupIndex ); long getCrosstabColumnSequenceCounter( final int groupIndex ); void crosstabResetColumnIndices(); void crosstabIncrementColumnCounter(); PerformanceMonitorContext getPerformanceMonitorContext(); }
ProcessState implements ReportState { public void initializeForSubreport( final InlineSubreportMarker[] subReports, final int subReportIndex, final ProcessState parentState ) throws ReportProcessingException { if ( parentState == null ) { throw new NullPointerException(); } this.designtime = parentState.designtime; this.crosstabColumnSequenceCounter = new LongSequence( 10, -1 ); this.groupSequenceCounter = new LongSequence( 10, -1 ); this.groupSequenceCounter.set( 0, -1 ); this.recorder = (GroupSizeRecorder) parentState.recorder.clone(); this.recorder.reset(); this.performanceMonitorContext = parentState.performanceMonitorContext; this.reportInstancesShareConnection = parentState.reportInstancesShareConnection; this.groupStarts = new FastStack<GroupStartRecord>(); this.parentSubReportState = parentState; this.advanceHandler = BeginReportHandler.HANDLER; this.errorHandler = parentState.errorHandler; this.functionStorage = parentState.functionStorage; this.structureFunctionStorage = parentState.structureFunctionStorage; this.processStore = parentState.processStore; this.currentGroupIndex = ReportState.BEFORE_FIRST_GROUP; this.currentPresentationGroupIndex = ReportState.BEFORE_FIRST_GROUP; this.currentSubReport = subReportIndex; this.subReports = subReports.clone(); this.dataFactoryManager = parentState.dataFactoryManager; this.subReportStorage = parentState.subReportStorage; this.structuralPreprocessingNeeded = parentState.structuralPreprocessingNeeded; this.processLevels = parentState.processLevels; this.sequenceCounter = parentState.getSequenceCounter() + 1; this.currentSubReportMarker = subReports[ subReportIndex ]; this.inlineProcess = parentState.isInlineProcess() || currentSubReportMarker.getProcessType() == SubReportProcessType.INLINE; final SubReport subreportFromMarker = currentSubReportMarker.getSubreport(); final FunctionStorageKey functionStorageKey = FunctionStorageKey.createKey( parentSubReportState.getProcessKey(), subreportFromMarker ); final boolean needPreProcessing; final SubReport initialSubReport; if ( subReportStorage.contains( functionStorageKey ) ) { initialSubReport = subReportStorage.restore( functionStorageKey ); initialSubReport.reconnectParent( subreportFromMarker.getParentSection() ); applyCurrentStyleAndAttributes( subreportFromMarker, initialSubReport ); needPreProcessing = false; } else { initialSubReport = subreportFromMarker.derive( true ); initialSubReport.reconnectParent( subreportFromMarker.getParentSection() ); needPreProcessing = true; } final DefaultFlowController parentStateFlowController = parentState.getFlowController(); final ResourceBundleFactory resourceBundleFactory = parentState.getResourceBundleFactory(); if ( isSubReportInvisible( initialSubReport, parentStateFlowController ) ) { final ReportDefinition parentReport = parentState.getReport(); final SubReport dummyReport = new SubReport( functionStorageKey.getReportId() ); this.report = new ReportDefinitionImpl( dummyReport, parentReport.getPageDefinition(), subreportFromMarker.getParentSection() ); this.flowController = parentStateFlowController.derive(); this.advanceHandler = EndSubReportHandler.HANDLER; this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, computeStructureFunctions( initialSubReport.getStructureFunctions(), flowController.getReportContext().getOutputProcessorMetaData() ), this.report.getObjectID() ); } else { DataFactory dataFactory = dataFactoryManager.restore( functionStorageKey, isReportsShareConnections( initialSubReport ) ); final DefaultFlowController postPreProcessingFlowController; final SubReport preDataSubReport; if ( dataFactory == null ) { final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor( parentStateFlowController ); preDataSubReport = preprocessor.invokePreDataProcessing( initialSubReport ); postPreProcessingFlowController = preprocessor.getFlowController(); final DataFactory subreportDf = lookupDataFactory( preDataSubReport ); final boolean dataCacheEnabled = isCacheEnabled( preDataSubReport ); if ( subreportDf == null ) { dataFactory = new EmptyDataFactory(); } else { final DataFactory sortingDataFactory = new SortingDataFactory( subreportDf, performanceMonitorContext ); final CachingDataFactory cdataFactory = new CachingDataFactory( sortingDataFactory, dataCacheEnabled ); final ProcessingContext context = postPreProcessingFlowController.getReportContext(); cdataFactory.initialize( new ProcessingDataFactoryContext( context, cdataFactory ) ); dataFactoryManager.store( functionStorageKey, cdataFactory, isReportsShareConnections( preDataSubReport ) ); dataFactory = cdataFactory; } } else { preDataSubReport = initialSubReport; postPreProcessingFlowController = parentStateFlowController; } final ParameterMapping[] inputMappings = preDataSubReport.getInputMappings(); final ParameterMapping[] exportMappings = preDataSubReport.getExportMappings(); this.flowController = postPreProcessingFlowController.performInitSubreport( dataFactory, inputMappings, resourceBundleFactory ); final Integer queryLimitDefault = IntegerCache.getInteger( preDataSubReport.getQueryLimit() ); final Integer queryTimeoutDefault = IntegerCache.getInteger( preDataSubReport.getQueryTimeout() ); final Object queryRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY ), preDataSubReport.getQuery() ); final String queryDefined = designtime ? "design-time-query" : preDataSubReport.getQuery(); this.query = (String) ConverterRegistry.convert( queryRaw, String.class, queryDefined ); if ( this.currentSubReportMarker.getSubreport().isQueryLimitInherited() && parentState.queryLimit != null ) { this.queryLimit = parentState.queryLimit; } else { final Object queryLimitRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY_LIMIT ), queryLimitDefault ); this.queryLimit = (Integer) ConverterRegistry.convert( queryLimitRaw, Integer.class, queryLimitDefault ); } final Object queryTimeoutRaw = evaluateExpression( preDataSubReport.getAttributeExpression( AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY_TIMEOUT ), queryTimeoutDefault ); this.queryTimeout = (Integer) ConverterRegistry.convert( queryTimeoutRaw, Integer.class, queryTimeoutDefault ); final List<SortConstraint> sortOrder = lookupSortOrder( preDataSubReport ); DefaultFlowController postQueryFlowController = flowController .performSubReportQuery( query, queryLimit, queryTimeout, exportMappings, sortOrder ); final ProxyDataSchemaDefinition schemaDefinition = new ProxyDataSchemaDefinition( preDataSubReport.getDataSchemaDefinition(), postQueryFlowController.getMasterRow().getDataSchemaDefinition() ); postQueryFlowController = postQueryFlowController.updateDataSchema( schemaDefinition ); SubReport fullReport = preDataSubReport; DefaultFlowController fullFlowController = postQueryFlowController; if ( needPreProcessing ) { final SubReportProcessPreprocessor preprocessor = new SubReportProcessPreprocessor( postQueryFlowController ); fullReport = preprocessor.invokePreProcessing( preDataSubReport ); fullFlowController = preprocessor.getFlowController(); subReportStorage.store( functionStorageKey, fullReport ); } this.report = new ReportDefinitionImpl( fullReport, fullReport.getPageDefinition(), subreportFromMarker.getParentSection() ); final Expression[] structureFunctions = getStructureFunctionStorage().restore( functionStorageKey ); if ( structureFunctions != null ) { final StructureFunction[] functions = new StructureFunction[ structureFunctions.length ]; System.arraycopy( structureFunctions, 0, functions, 0, structureFunctions.length ); this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, functions, this.report.getObjectID() ); } else { final StructureFunction[] functions = computeStructureFunctions( fullReport.getStructureFunctions(), fullFlowController.getReportContext().getOutputProcessorMetaData() ); this.layoutProcess = new SubLayoutProcess( parentState.layoutProcess, functions, this.report.getObjectID() ); } boolean preserve = true; Expression[] expressions = getFunctionStorage().restore( functionStorageKey ); if ( expressions == null ) { if ( designtime ) { expressions = new Expression[ 0 ]; } else { expressions = fullReport.getExpressions().getExpressions(); } preserve = false; } this.flowController = fullFlowController.activateExpressions( expressions, preserve ); this.flowController = this.flowController.refreshDataRow(); if ( this.report.getParentSection() == null ) { throw new InvalidReportStateException(); } if ( this.report.getParentSection().getReportDefinition() != this.parentSubReportState.getReport() ) { throw new InvalidReportStateException(); } final int processingLevel = flowController.getReportContext().getProcessingLevel(); if ( processingLevel == LayoutProcess.LEVEL_PAGINATE ) { if ( this.parentSubReportState.isInItemGroup() ) { if ( this.parentSubReportState.getReport().getDetailsFooter().getComputedStyle() == null ) { throw new InvalidReportStateException(); } } } } StateUtilities.computeLevels( this.flowController, this.layoutProcess, processLevels ); this.processKey = createKey(); } ProcessState(); boolean initializeForMasterReport( final MasterReport report,
                                         final ProcessingContext processingContext,
                                         final OutputFunction outputFunction ); void initializeForSubreport( final InlineSubreportMarker[] subReports,
                                      final int subReportIndex,
                                      final ProcessState parentState ); ReportProcessStore getProcessStore(); int[] getRequiredRuntimeLevels(); boolean isSubReportExecutable(); ProcessState returnFromSubReport( final LayoutProcess layoutProcess ); ProcessState restart(); ReportProcessingErrorHandler getErrorHandler(); void setErrorHandler( final ReportProcessingErrorHandler errorHandler ); void setSequenceCounter( final int sequenceCounter ); int getSequenceCounter(); InlineSubreportMarker getCurrentSubReportMarker(); boolean isInlineProcess(); SubReportProcessType getSubreportProcessingType(); ProcessState deriveForPagebreak(); ProcessState deriveForAdvance(); ProcessState deriveForStorage(); ProcessState clone(); AdvanceHandler getAdvanceHandler(); void setAdvanceHandler( final AdvanceHandler advanceHandler ); final ProcessState advance(); final ProcessState commit(); int getCurrentRow(); int getCurrentDataItem(); int getProgressLevel(); int getProgressLevelCount(); boolean isPrepareRun(); int getLevel(); boolean isFinish(); int getEventCode(); int getCurrentGroupIndex(); void enterGroup(); void leaveGroup(); int getPresentationGroupIndex(); void enterPresentationGroup(); void leavePresentationGroup(); ReportDefinition getReport(); int getCurrentSubReport(); ReportState getParentState(); ReportState getParentSubReportState(); FunctionStorage getStructureFunctionStorage(); FunctionStorage getFunctionStorage(); DefaultFlowController getFlowController(); void setFlowController( final DefaultFlowController flowController ); LayoutProcess getLayoutProcess(); ReportStateKey getProcessKey(); DataRow getDataRow(); int getNumberOfRows(); void firePageStartedEvent( final int baseEvent ); void firePageFinishedEvent( final boolean noParentPassing ); static boolean isLastItemInGroup( final Group rootGroup,
                                           final MasterDataRow currentDataRow,
                                           final MasterDataRow nextDataRow ); boolean isSubReportEvent(); InlineSubreportMarker[] getSubReports(); ProcessStateHandle getProcessHandle(); void setInItemGroup( final boolean inItemGroup ); boolean isInItemGroup(); ResourceBundleFactory getResourceBundleFactory(); boolean isArtifcialState(); GroupingState createGroupingState(); boolean isStructuralPreprocessingNeeded(); void advanceCursor(); Integer getPredictedStateCount(); boolean isCrosstabActive(); String toString(); ProcessState recordCrosstabRowState(); ProcessState replayStoredCrosstabRowState(); int getReplayStoredCrosstabGroup(); AdvanceHandler getPostSummaryRowAdvanceHandler(); void setPostSummaryRowAdvanceHandler( final AdvanceHandler postSummaryRowAdvanceHandler ); ProcessState finishReplayingStoredCrosstabRowState(); void clearStoredCrosstabRowState(); long getGroupSequenceCounter( final int groupIndex ); long getCrosstabColumnSequenceCounter( final int groupIndex ); void crosstabResetColumnIndices(); void crosstabIncrementColumnCounter(); PerformanceMonitorContext getPerformanceMonitorContext(); static final int ARTIFICIAL_EVENT_CODE; }