Package org.pentaho.reporting.libraries.xmlns.parser

Examples of org.pentaho.reporting.libraries.xmlns.parser.RootXmlReadHandler


    else
    {
      report = (MasterReport) maybeReport;
    }

    final RootXmlReadHandler parser = getRootHandler();
    if (ReportParserUtil.isIncluded(parser) == false)
    {
      final String query = attrs.getValue(getUri(), "query");
      if (query != null)
      {
View Full Code Here


        throw new ParseException("The existing report contains non-default groups. " +
            "This parser cannot handle such a construct.");
      }
    }

    final RootXmlReadHandler parser = getRootHandler();
    if (ReportParserUtil.isIncluded(parser) == false)
    {
      final String query = attrs.getValue(getUri(), "query");
      if (query != null)
      {
View Full Code Here

   * @throws org.xml.sax.SAXException if there is a parsing error.
   */
  protected void startParsing(final PropertyAttributes attrs)
      throws SAXException
  {
    final RootXmlReadHandler rootHandler = getRootHandler();
    final Object maybeReport = rootHandler.getHelperObject
        (ReportParserUtil.HELPER_OBJ_REPORT_NAME);
    final SubReport report;
    if (maybeReport instanceof SubReport == false)
    {
      // replace it ..
      report = new SubReport();
      report.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.SOURCE, getRootHandler().getSource());
    }
    else
    {
      report = (SubReport) maybeReport;
    }

    if (ReportParserUtil.isIncluded(rootHandler) == false)
    {
      final String query = attrs.getValue(getUri(), "query");
      if (query != null)
      {
        report.setQuery(query);
      }
    }

    if (rootHandler.getHelperObject(ExtSubReportReadHandler.ELEMENT_FACTORY_KEY) == null)
    {
      final ElementFactoryCollector elementFactory = new ElementFactoryCollector();
      rootHandler.setHelperObject(ExtSubReportReadHandler.ELEMENT_FACTORY_KEY, elementFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.STYLE_FACTORY_KEY) == null)
    {
      final StyleKeyFactoryCollector styleKeyFactory = new StyleKeyFactoryCollector();
      rootHandler.setHelperObject(ExtSubReportReadHandler.STYLE_FACTORY_KEY, styleKeyFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.CLASS_FACTORY_KEY) == null)
    {
      final ClassFactoryCollector classFactory = new ClassFactoryCollector();
      classFactory.configure(rootHandler.getParserConfiguration());
      rootHandler.setHelperObject(ExtSubReportReadHandler.CLASS_FACTORY_KEY, classFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.DATASOURCE_FACTORY_KEY) == null)
    {
      final DataSourceCollector dataSourceFactory = new DataSourceCollector();
      dataSourceFactory.configure(rootHandler.getParserConfiguration());
      rootHandler.setHelperObject(ExtSubReportReadHandler.DATASOURCE_FACTORY_KEY, dataSourceFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.TEMPLATE_FACTORY_KEY) == null)
    {
      final TemplateCollector templateFactory = new TemplateCollector();
      templateFactory.configure(rootHandler.getParserConfiguration());
      rootHandler.setHelperObject(ExtSubReportReadHandler.TEMPLATE_FACTORY_KEY, templateFactory);
    }

    report.setName(attrs.getValue(getUri(), "name"));

    rootHandler.setHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME, report);
  }
View Full Code Here

        throw new ParseException("The existing report contains non-default groups. " +
            "This parser cannot handle such a construct.");
      }
    }

    final RootXmlReadHandler parser = getRootHandler();
    if (ReportParserUtil.isIncluded(parser) == false)
    {
      final String query = attrs.getValue(getUri(), "query");
      if (query != null)
      {
View Full Code Here

    final SubReportReadHandlerFactory factory = SubReportReadHandlerFactory.getInstance();
    final SubReportReadHandler handler = (SubReportReadHandler) factory.getHandler(getUri(), getTagName());
    if (handler != null)
    {
      handler.setDisableRootTagWarning(true);
      final RootXmlReadHandler rootHandler = getRootHandler();
      oldReport = rootHandler.getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);
      rootHandler.setHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME, report);
      rootHandler.delegate(handler, getUri(), getTagName(), attrs);
      subReportReadHandler = handler;
    }
  }
View Full Code Here

   * @param attrs the attributes.
   * @throws SAXException if there is a parsing error.
   */
  protected void startParsing(final Attributes attrs) throws SAXException
  {
    final RootXmlReadHandler rootHandler = getRootHandler();
    final Object maybeReport = rootHandler.getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);
    if (maybeReport instanceof SubReport)
    {
      report = (SubReport) maybeReport;
    }
    else if (maybeReport instanceof MasterReport)
View Full Code Here

      throw new ParseException("Required attribute 'src' is missing.", getRootHandler().getDocumentLocator());
    }

    try
    {
      final RootXmlReadHandler rootHandler = getRootHandler();
      final ResourceManager resourceManager = rootHandler.getResourceManager();
      final ResourceKey source = rootHandler.getSource();

      final HashMap map = new HashMap();
      final String[] names = rootHandler.getHelperObjectNames();
      for (int i = 0; i < names.length; i++)
      {
        final String name = names[i];
        final FactoryParameterKey key = new FactoryParameterKey(name);
        map.put(key, rootHandler.getHelperObject(name));
      }
      map.put(new FactoryParameterKey(ReportParserUtil.INCLUDE_PARSING_KEY), ReportParserUtil.INCLUDE_PARSING_VALUE);

      final ResourceKey target = resourceManager.deriveKey(source, file, map);
      final DependencyCollector dc = rootHandler.getDependencyCollector();

      final Object maybeReport = getRootHandler().getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);
      if (maybeReport == null)
      {
        throw new ParseException("Illegal State: No valid report", getRootHandler().getDocumentLocator());
      }

      final Class targetType;
      if (maybeReport instanceof SubReport)
      {
        targetType = SubReport.class;
      }
      else if (maybeReport instanceof MasterReport)
      {
        targetType = MasterReport.class;
      }
      else
      {
        throw new ParseException("Illegal State: No valid report", getRootHandler().getDocumentLocator());
      }

      final Resource resource = resourceManager.create(target, rootHandler.getContext(), targetType);
      dc.add(resource);

    }
    catch (ResourceKeyCreationException e)
    {
View Full Code Here

   * @throws org.xml.sax.SAXException if there is a parsing error.
   */
  protected void startParsing(final PropertyAttributes attrs)
      throws SAXException
  {
    final RootXmlReadHandler rootHandler = getRootHandler();
    final Object maybeReport = rootHandler.getHelperObject
        (ReportParserUtil.HELPER_OBJ_REPORT_NAME);
    final SubReport report;
    if (maybeReport instanceof SubReport == false)
    {
      // replace it ..
      report = new SubReport();
      report.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.SOURCE, getRootHandler().getSource());
    }
    else
    {
      report = (SubReport) maybeReport;
    }

    if (ReportParserUtil.isIncluded(rootHandler) == false)
    {
      final String query = attrs.getValue(getUri(), "query");
      if (query != null)
      {
        report.setQuery(query);
      }
    }

    if (rootHandler.getHelperObject(ExtSubReportReadHandler.ELEMENT_FACTORY_KEY) == null)
    {
      final ElementFactoryCollector elementFactory = new ElementFactoryCollector();
      rootHandler.setHelperObject(ExtSubReportReadHandler.ELEMENT_FACTORY_KEY, elementFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.STYLE_FACTORY_KEY) == null)
    {
      final StyleKeyFactoryCollector styleKeyFactory = new StyleKeyFactoryCollector();
      rootHandler.setHelperObject(ExtSubReportReadHandler.STYLE_FACTORY_KEY, styleKeyFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.CLASS_FACTORY_KEY) == null)
    {
      final ClassFactoryCollector classFactory = new ClassFactoryCollector();
      classFactory.configure(rootHandler.getParserConfiguration());
      rootHandler.setHelperObject(ExtSubReportReadHandler.CLASS_FACTORY_KEY, classFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.DATASOURCE_FACTORY_KEY) == null)
    {
      final DataSourceCollector dataSourceFactory = new DataSourceCollector();
      dataSourceFactory.configure(rootHandler.getParserConfiguration());
      rootHandler.setHelperObject(ExtSubReportReadHandler.DATASOURCE_FACTORY_KEY, dataSourceFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.TEMPLATE_FACTORY_KEY) == null)
    {
      final TemplateCollector templateFactory = new TemplateCollector();
      templateFactory.configure(rootHandler.getParserConfiguration());
      rootHandler.setHelperObject(ExtSubReportReadHandler.TEMPLATE_FACTORY_KEY, templateFactory);
    }

    report.setName(attrs.getValue(getUri(), "name"));

    rootHandler.setHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME, report);
    if (rootHandler.getHelperObject(ReportParserUtil.HELPER_OBJ_LEGACY_STYLES) instanceof HashMap == false)
    {
      rootHandler.setHelperObject(ReportParserUtil.HELPER_OBJ_LEGACY_STYLES, new HashMap<String, ElementStyleSheet>());
    }
  }
View Full Code Here

   * @param attrs the attributes.
   * @throws SAXException if there is a parsing error.
   */
  protected void startParsing(final Attributes attrs) throws SAXException
  {
    final RootXmlReadHandler rootHandler = getRootHandler();
    final Object maybeReport = rootHandler.getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);
    if (maybeReport instanceof SubReport)
    {
      report = (SubReport) maybeReport;
    }
    else if (maybeReport instanceof MasterReport)
View Full Code Here

    final SubReportReadHandlerFactory factory = SubReportReadHandlerFactory.getInstance();
    final SubReportReadHandler handler = factory.getHandler(getUri(), getTagName());
    if (handler != null)
    {
      handler.setDisableRootTagWarning(true);
      final RootXmlReadHandler rootHandler = getRootHandler();
      oldReport = rootHandler.getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);
      rootHandler.setHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME, report);
      rootHandler.delegate(handler, getUri(), getTagName(), attrs);
      subReportReadHandler = handler;
    }
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.xmlns.parser.RootXmlReadHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.