}
public static SubReport materialize(final SubReport report,
final WizardProcessor processor) throws ReportProcessingException
{
final PerformanceMonitorContext performanceMonitorContext =
ClassicEngineBoot.getInstance().getObjectFactory().get(PerformanceMonitorContext.class);
try
{
final DefaultProcessingContext processingContext;
final MasterReport masterReport = DesignTimeUtil.getMasterReport(report);
if (masterReport != null)
{
processingContext = new DefaultProcessingContext(masterReport);
}
else
{
processingContext = new DefaultProcessingContext();
}
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 SubReport subReport = processor.performPreProcessing(report, postQueryFlowController);
subReport.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, originalEnable);
return subReport;
}
finally
{
dataFactory.close();
}
}
finally
{
performanceMonitorContext.close();
}
}