Package org.pentaho.reporting.engine.classic.wizard.model

Examples of org.pentaho.reporting.engine.classic.wizard.model.WizardSpecification


            else
            {
              return false;
            }
          }
          final WizardSpecification specification = editorModel.getReportSpec();
          final DataFactory dataFactory = editorModel.getReportDefinition().getDataFactory().derive();
          final String oldName = editorModel.getReportDefinition().getName();

          report.setAttribute("http://reporting.pentaho.org/namespaces/engine/attributes/wizard", "template", fileName);
          report.setDataFactory(dataFactory);
View Full Code Here


      throws IOException, BundleWriterException
  {
    final AbstractReportDefinition report = state.getReport();
    try
    {
      final WizardSpecification specification =
          WizardProcessorUtil.loadWizardSpecification(report,
          state.getMasterReport().getResourceManager());
      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)
View Full Code Here

    try
    {
      final AbstractReportDefinition reportDefinition = editorModel.getReportDefinition();
      final AbstractReportDefinition element = (AbstractReportDefinition) reportDefinition.derive();
      final WizardSpecification spec = editorModel.getReportSpec();
      element.setAttribute(AttributeNames.Wizard.NAMESPACE, "enable", Boolean.TRUE);
      WizardProcessorUtil.applyWizardSpec(element, (WizardSpecification) spec.clone());
      WizardProcessorUtil.ensureWizardProcessorIsAdded(element, null);

      if (element instanceof MasterReport)
      {
        dialog.setReportJob((MasterReport) element);
View Full Code Here

      return null;
    }
    final AbstractReportDefinition reportDefinition = wizardController.getEditorModel().getReportDefinition();
    try
    {
      final WizardSpecification spec = wizardController.getEditorModel().getReportSpec();
      WizardProcessorUtil.applyWizardSpec(reportDefinition, spec);
      WizardProcessorUtil.ensureWizardProcessorIsAdded(reportDefinition, null);
    }
    catch (Exception ex)
    {
View Full Code Here

            else
            {
              return false;
            }
          }
          final WizardSpecification specification = editorModel.getReportSpec();
          final DataFactory dataFactory = editorModel.getReportDefinition().getDataFactory().derive();
          final String oldName = editorModel.getReportDefinition().getName();

          report.setAttribute("http://reporting.pentaho.org/namespaces/engine/attributes/wizard", "template", fileName);
          report.setDataFactory(dataFactory);
View Full Code Here

    try
    {
      final AbstractReportDefinition reportDefinition = editorModel.getReportDefinition();
      final AbstractReportDefinition element = (AbstractReportDefinition) reportDefinition.derive();
      final WizardSpecification spec = editorModel.getReportSpec();
      element.setAttribute(AttributeNames.Wizard.NAMESPACE, "enable", Boolean.TRUE);
      WizardProcessorUtil.applyWizardSpec(element, (WizardSpecification) spec.clone());
      WizardProcessorUtil.ensureWizardProcessorIsAdded(element, null);

      if (element instanceof MasterReport)
      {
        dialog.setReportJob((MasterReport) element);
View Full Code Here

      return null;
    }
    final AbstractReportDefinition reportDefinition = wizardController.getEditorModel().getReportDefinition();
    try
    {
      final WizardSpecification spec = wizardController.getEditorModel().getReportSpec();
      WizardProcessorUtil.applyWizardSpec(reportDefinition, spec);
      WizardProcessorUtil.ensureWizardProcessorIsAdded(reportDefinition, null);
    }
    catch (Exception ex)
    {
View Full Code Here

      throws IOException, BundleWriterException
  {
    final AbstractReportDefinition report = state.getReport();
    try
    {
      final WizardSpecification specification =
          WizardProcessorUtil.loadWizardSpecification(report,
          state.getMasterReport().getResourceManager());
      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)
View Full Code Here

    final ResourceManager resourceManager = new ResourceManager();
    resourceManager.registerDefaults();
    final Resource directly = resourceManager.createDirectly(data, MasterReport.class);
    final MasterReport parsedReport = (MasterReport) directly.getResource();
    assertNotNull(parsedReport);
    final WizardSpecification specification =
        WizardProcessorUtil.loadWizardSpecification(report, report.getResourceManager());
    assertNotNull(specification);
  }
View Full Code Here

    resourceManager.registerDefaults();
    final Resource directly = resourceManager.createDirectly(data, MasterReport.class);
    final MasterReport parsedReport = (MasterReport) directly.getResource();
    assertNotNull(parsedReport);

    final WizardSpecification specification =
        WizardProcessorUtil.loadWizardSpecification(report, report.getResourceManager());
    assertNotNull(specification);

    final GroupDefinition[] resultGroups = specification.getGroupDefinitions();
    assertEquals(3, resultGroups.length);
    assertEquals("group-field1", resultGroups[0].getField());
    assertEquals("group-field2", resultGroups[1].getField());
    assertEquals("group-field3", resultGroups[2].getField());
    assertEquals(GroupType.RELATIONAL, resultGroups[0].getGroupType());
    assertEquals(GroupType.RELATIONAL, resultGroups[1].getGroupType());
    assertEquals(GroupType.RELATIONAL, resultGroups[2].getGroupType());

    final DetailFieldDefinition[] resultDetails = specification.getDetailFieldDefinitions();
    assertEquals(3, resultDetails.length);
    assertEquals("detail-field1", resultDetails[0].getField());
    assertEquals("detail-field2", resultDetails[1].getField());
    assertEquals("detail-field3", resultDetails[2].getField());
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.wizard.model.WizardSpecification

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.