Package org.pentaho.reporting.engine.classic.core.modules.parser.bundle.writer

Examples of org.pentaho.reporting.engine.classic.core.modules.parser.bundle.writer.BundleWriterState


    final String absolutePath = computePath(state);
    final String directory = BundleUtilities.getUniqueName(bundle, absolutePath + "/subreport{0}");
    bundle.createDirectoryEntry(directory, "application/vnd.pentaho.reporting.classic.subreport");
    final String dirRelative = IOUtils.getInstance().createRelativePath(directory, absolutePath + "/.");
    final BundleWriterState subReportState = new BundleWriterState(state, subReport, dirRelative + '/');
    state.getBundleWriter().writeSubReport(bundle, subReportState);

    final ParameterMapping[] inputMappings = subReport.getInputMappings();
    final ParameterMapping[] outputMappings = subReport.getExportMappings();
    final String tagName = subReport.getElementTypeName();
    if (inputMappings.length == 0 && outputMappings.length == 0)
    {
      xmlWriter.writeTag(BundleNamespaces.LAYOUT, tagName, "href",
          '/' + subReportState.getFileName() + "content.xml", XmlWriterSupport.CLOSE);
    }
    else
    {
      xmlWriter.writeTag(BundleNamespaces.LAYOUT, tagName, "href",
          '/' + subReportState.getFileName() + "content.xml", XmlWriterSupport.OPEN);

      for (int i = 0; i < inputMappings.length; i++)
      {
        final ParameterMapping mapping = inputMappings[i];
        final AttributeList attrs = new AttributeList();
View Full Code Here


      if (specification == null)
      {
        return null;
      }

      final BundleWriterState wizardFileState = new BundleWriterState(state, "wizard-specification.xml");
      final OutputStream outputStream = new BufferedOutputStream(bundle.createEntry(wizardFileState.getFileName(), "text/xml"));
      final DefaultTagDescription tagDescription = new DefaultTagDescription(
          ClassicEngineBoot.getInstance().getGlobalConfig(), WizardCoreModule.TAG_DEF_PREFIX);
      final XmlWriter xmlWriter = new XmlWriter
          (new OutputStreamWriter(outputStream, "UTF-8"), tagDescription, "  ", "\n");

      final AttributeList rootAttrs = new AttributeList();
      rootAttrs.addNamespaceDeclaration("wizard", WizardCoreModule.NAMESPACE);

      xmlWriter.writeTag(WizardCoreModule.NAMESPACE, "wizard-specification", rootAttrs, XmlWriter.OPEN);

      final RootBandWriterHandler rootBandWriterHandler = new RootBandWriterHandler();
      rootBandWriterHandler.writeReport(bundle, wizardFileState, xmlWriter, specification.getColumnHeader(), "column-header");
      rootBandWriterHandler.writeReport(bundle, wizardFileState, xmlWriter, specification.getColumnFooter(), "column-footer");


      xmlWriter.writeTag(WizardCoreModule.NAMESPACE, "detail-fields", XmlWriter.OPEN);
      final DetailFieldDefinition[] detailFieldDefinitions = specification.getDetailFieldDefinitions();
      final DetailFieldDefinitionWriteHandler detailWriteHandler = new DetailFieldDefinitionWriteHandler();
      for (int i = 0; i < detailFieldDefinitions.length; i++)
      {
        final DetailFieldDefinition definition = detailFieldDefinitions[i];
        detailWriteHandler.writeReport(bundle, wizardFileState, xmlWriter, definition);
      }
      xmlWriter.writeCloseTag();

      xmlWriter.writeTag(WizardCoreModule.NAMESPACE, "group-definitions", XmlWriter.OPEN);
      final GroupDefinition[] groupDefinitions = specification.getGroupDefinitions();
      final GroupDefinitionWriteHandler groupDefinitionWriteHandler = new GroupDefinitionWriteHandler();
      for (int i = 0; i < groupDefinitions.length; i++)
      {
        final GroupDefinition definition = groupDefinitions[i];
        groupDefinitionWriteHandler.writeReport(bundle, wizardFileState, xmlWriter, definition);
      }
      xmlWriter.writeCloseTag();

      final WatermarkDefinitionWriterHandler watermarkDefinitionWriterHandler = new WatermarkDefinitionWriterHandler();
      watermarkDefinitionWriterHandler.writeReport(bundle, wizardFileState, xmlWriter, specification.getWatermarkDefinition());
      xmlWriter.writeCloseTag();
      xmlWriter.close();
      return wizardFileState.getFileName();
    }
    catch (final ReportProcessingException e)
    {
      throw new BundleWriterException("Failed to load wizard-specifiation",e);
    }
View Full Code Here

    final String absolutePath = computePath(state);
    final String directory = BundleUtilities.getUniqueName(bundle, absolutePath + "/subreport{0}");
    bundle.createDirectoryEntry(directory, "application/vnd.pentaho.reporting.classic.subreport");
    final String dirRelative = IOUtils.getInstance().createRelativePath(directory, absolutePath + "/.");
    final BundleWriterState subReportState = new BundleWriterState(state, subReport, dirRelative + '/');
    state.getBundleWriter().writeSubReport(bundle, subReportState);

    final ParameterMapping[] inputMappings = subReport.getInputMappings();
    final ParameterMapping[] outputMappings = subReport.getExportMappings();
    ElementMetaData metaData = subReport.getMetaData();
    final String tagName = metaData.getName();
    final String namespace = metaData.getNamespace();
    if (inputMappings.length == 0 && outputMappings.length == 0)
    {
      xmlWriter.writeTag(namespace, tagName, "href",
          '/' + subReportState.getFileName() + "content.xml", XmlWriterSupport.CLOSE);
    }
    else
    {
      xmlWriter.writeTag(namespace, tagName, "href",
          '/' + subReportState.getFileName() + "content.xml", XmlWriterSupport.OPEN);

      for (int i = 0; i < inputMappings.length; i++)
      {
        final ParameterMapping mapping = inputMappings[i];
        final AttributeList attrs = new AttributeList();
View Full Code Here

      if (specification == null)
      {
        return null;
      }

      final BundleWriterState wizardFileState = new BundleWriterState(state, "wizard-specification.xml");
      if(bundle.isEntryExists(wizardFileState.getFileName())){
        // if already exists, remove the old one, enabling node creation of the most recent
        bundle.removeEntry(wizardFileState.getFileName())
      }
      final OutputStream outputStream = new BufferedOutputStream(bundle.createEntry(wizardFileState.getFileName(), "text/xml"));
      bundle.getWriteableDocumentMetaData().setEntryAttribute(wizardFileState.getFileName(), BundleUtilities.STICKY_FLAG, "true");
      bundle.getWriteableDocumentMetaData().setEntryAttribute(wizardFileState.getFileName(), BundleUtilities.HIDDEN_FLAG, "true");
      final DefaultTagDescription tagDescription = new DefaultTagDescription();
      tagDescription.setNamespaceHasCData(WizardCoreModule.NAMESPACE, false);

      final XmlWriter xmlWriter = new XmlWriter
          (new OutputStreamWriter(outputStream, "UTF-8"), tagDescription, "  ", "\n");

      final AttributeList rootAttrs = new AttributeList();
      rootAttrs.addNamespaceDeclaration("wizard", WizardCoreModule.NAMESPACE);

      xmlWriter.writeTag(WizardCoreModule.NAMESPACE, "wizard-specification", rootAttrs, XmlWriter.OPEN);

      final RootBandWriterHandler rootBandWriterHandler = new RootBandWriterHandler();
      rootBandWriterHandler.writeReport(bundle, wizardFileState, xmlWriter, specification.getColumnHeader(), "column-header");
      rootBandWriterHandler.writeReport(bundle, wizardFileState, xmlWriter, specification.getColumnFooter(), "column-footer");


      xmlWriter.writeTag(WizardCoreModule.NAMESPACE, "detail-fields", XmlWriter.OPEN);
      final DetailFieldDefinition[] detailFieldDefinitions = specification.getDetailFieldDefinitions();
      final DetailFieldDefinitionWriteHandler detailWriteHandler = new DetailFieldDefinitionWriteHandler();
      for (int i = 0; i < detailFieldDefinitions.length; i++)
      {
        final DetailFieldDefinition definition = detailFieldDefinitions[i];
        detailWriteHandler.writeReport(bundle, wizardFileState, xmlWriter, definition);
      }
      xmlWriter.writeCloseTag();

      xmlWriter.writeTag(WizardCoreModule.NAMESPACE, "group-definitions", XmlWriter.OPEN);
      final GroupDefinition[] groupDefinitions = specification.getGroupDefinitions();
      final GroupDefinitionWriteHandler groupDefinitionWriteHandler = new GroupDefinitionWriteHandler();
      for (int i = 0; i < groupDefinitions.length; i++)
      {
        final GroupDefinition definition = groupDefinitions[i];
        groupDefinitionWriteHandler.writeReport(bundle, wizardFileState, xmlWriter, definition);
      }
      xmlWriter.writeCloseTag();

      final WatermarkDefinitionWriterHandler watermarkDefinitionWriterHandler = new WatermarkDefinitionWriterHandler();
      watermarkDefinitionWriterHandler.writeReport(bundle, wizardFileState, xmlWriter, specification.getWatermarkDefinition());
      xmlWriter.writeCloseTag();
      xmlWriter.close();
      return wizardFileState.getFileName();
    }
    catch (final ReportProcessingException e)
    {
      throw new BundleWriterException("Failed to load wizard-specifiation",e);
    }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.modules.parser.bundle.writer.BundleWriterState

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.