protected void startParsing(final PropertyAttributes attrs)
throws SAXException
{
final Object maybeReport = getRootHandler().getHelperObject
(ReportParserUtil.HELPER_OBJ_REPORT_NAME);
final MasterReport report;
if (maybeReport instanceof MasterReport == false)
{
// replace it ..
report = new MasterReport();
report.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.SOURCE, getRootHandler().getSource());
}
else
{
report = (MasterReport) maybeReport;
}
final RootXmlReadHandler parser = getRootHandler();
if (ReportParserUtil.isIncluded(parser) == false)
{
final String query = attrs.getValue(getUri(), "query");
if (query != null)
{
report.setQuery(query);
}
final String value = attrs.getValue(getUri(), "name");
if (value != null)
{
report.setName(value);
}
}
final ElementFactoryCollector elementFactory = new ElementFactoryCollector();
final StyleKeyFactoryCollector styleKeyFactory = new StyleKeyFactoryCollector();
final ClassFactoryCollector classFactory = new ClassFactoryCollector();
final DataSourceCollector dataSourceFactory = new DataSourceCollector();
final TemplateCollector templateFactory = new TemplateCollector();
classFactory.configure(getRootHandler().getParserConfiguration());
dataSourceFactory.configure(getRootHandler().getParserConfiguration());
templateFactory.configure(getRootHandler().getParserConfiguration());
getRootHandler().setHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME, report);
getRootHandler().setHelperObject(ReportDefinitionReadHandler.ELEMENT_FACTORY_KEY, elementFactory);
getRootHandler().setHelperObject(ReportDefinitionReadHandler.STYLE_FACTORY_KEY, styleKeyFactory);
getRootHandler().setHelperObject(ReportDefinitionReadHandler.CLASS_FACTORY_KEY, classFactory);
getRootHandler().setHelperObject(ReportDefinitionReadHandler.DATASOURCE_FACTORY_KEY, dataSourceFactory);
getRootHandler().setHelperObject(ReportDefinitionReadHandler.TEMPLATE_FACTORY_KEY, templateFactory);
report.setAttribute(AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.FILEFORMAT, "extended-xml");
this.report = report;
}