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 report;
if (subReportStorage.contains(functionStorageKey))
{
report = subReportStorage.restore(functionStorageKey);
final ElementStyleSheet subreportStyle = subreportFromMarker.getStyle();
final Map styleExpressions = subreportFromMarker.getStyleExpressions();
final StyleKey[] definedStyle =
(StyleKey[]) styleExpressions.keySet().toArray(new StyleKey[styleExpressions.size()]);
for (int i = 0; i < definedStyle.length; i++)
{
final StyleKey styleKey = definedStyle[i];
report.getStyle().setStyleProperty(styleKey, subreportStyle.getStyleProperty(styleKey));
}
needPreProcessing = false;
}
else
{
report = subreportFromMarker;
needPreProcessing = true;
}
final ResourceBundleFactory resourceBundleFactory;
if (report.getResourceBundleFactory() != null)
{
resourceBundleFactory = MasterReport.computeAndInitResourceBundleFactory
(report.getResourceBundleFactory(), parentState.getFlowController().getReportContext().getEnvironment());
}
else
{
resourceBundleFactory = parentState.getResourceBundleFactory();
}
final int processingLevel = flowController.getReportContext().getProcessingLevel();
if (processingLevel == LayoutProcess.LEVEL_PAGINATE &&
report.isVisible() == false)
{
// make it a minimum effort report, but still enter the loop.
final ReportDefinition parentReport = parentState.getReport();
final SubReport dummyReport = new SubReport(functionStorageKey.getReportId());
this.report = new ReportDefinitionImpl(dummyReport, parentReport.getPageDefinition());
this.flowController = parentState.flowController.derive();
this.advanceHandler = EndSubReportHandler.HANDLER;
this.layoutProcess = new SubLayoutProcess
(parentState.layoutProcess, computeStructureFunctions(report.getStructureFunctions(),