Package org.pentaho.reporting.libraries.docbundle

Examples of org.pentaho.reporting.libraries.docbundle.WriteableDocumentMetaData


    if (globalBundle == null)
    {
      throw new NullPointerException();
    }

    final WriteableDocumentMetaData data = bundle.getWriteableDocumentMetaData();
    data.setBundleType(ClassicEngineBoot.BUNDLE_TYPE);

    final MasterReport clone = (MasterReport) report.derive();
    final BundleWriterState state = new BundleWriterState(clone, globalBundle, this);
    for (int i = 0; i < masterWriter.length; i++)
    {
View Full Code Here


    final MemoryDocumentBundle documentBundle = new MemoryDocumentBundle();
    final BundleWriter writer = new BundleWriter();
    writer.writeReport(documentBundle, report);

    // restore the metadata to match the metadata of the original bundle.
    final WriteableDocumentMetaData targetMetaData = (WriteableDocumentMetaData) documentBundle.getMetaData();
    for (final String namespace: metaData.getMetaDataNamespaces())
    {
      for (final String name: metaData.getMetaDataNames(namespace))
      {
        targetMetaData.setBundleAttribute(namespace, name, metaData.getBundleAttribute(namespace, name));
      }
    }

    BundleUtilities.writeAsZip(out, documentBundle);
  }
View Full Code Here

  public static void resetDocumentMetaData(final MasterReport report)
  {
    final DocumentMetaData metaData = report.getBundle().getMetaData();
    if (metaData instanceof WriteableDocumentMetaData)
    {
      final WriteableDocumentMetaData wmd = (WriteableDocumentMetaData) metaData;
      wmd.setBundleAttribute(ODFMetaAttributeNames.Meta.NAMESPACE,
          ODFMetaAttributeNames.Meta.INITIAL_CREATOR, wmd.getBundleAttribute
              (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.CREATOR));
      try
      {
        wmd.setBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE,
            ODFMetaAttributeNames.DublinCore.CREATOR, System.getProperty("user.name"));
      }
      catch (Exception e)
      {
        // ignore it, not that important ...
      }
      wmd.setBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE,
          ODFMetaAttributeNames.DublinCore.DESCRIPTION, null);
      wmd.setBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE,
          ODFMetaAttributeNames.DublinCore.SUBJECT, null);
      wmd.setBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE,
          ODFMetaAttributeNames.DublinCore.TITLE, null);
      wmd.setBundleAttribute(ODFMetaAttributeNames.Meta.NAMESPACE,
          ODFMetaAttributeNames.Meta.CREATION_DATE, new Date());
      wmd.setBundleAttribute(ODFMetaAttributeNames.Meta.NAMESPACE,
          ODFMetaAttributeNames.Meta.KEYWORDS, null);
    }
  }
View Full Code Here

    report.setAttribute
        (ReportDesignerBoot.DESIGNER_NAMESPACE, ReportDesignerBoot.LAST_FILENAME, selectedReport);

    if (metaData instanceof WriteableDocumentMetaData)
    {
      final WriteableDocumentMetaData writeableDocumentMetaData = (WriteableDocumentMetaData) metaData;
      writeableDocumentMetaData.setBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.DESCRIPTION,
              selectFileForPublishTask.getDescription());
      writeableDocumentMetaData.setBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.TITLE,
              selectFileForPublishTask.getReportTitle());
    }

    report.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.LOCK_PREFERRED_OUTPUT_TYPE,
View Full Code Here

      report.setAttribute
          (ReportDesignerBoot.DESIGNER_NAMESPACE, ReportDesignerBoot.LAST_FILENAME, selectedReport);

      if (metaData instanceof WriteableDocumentMetaData)
      {
        final WriteableDocumentMetaData writeableDocumentMetaData = (WriteableDocumentMetaData) metaData;
        writeableDocumentMetaData.setBundleAttribute
            (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.DESCRIPTION,
                selectFileForPublishTask.getDescription());
        writeableDocumentMetaData.setBundleAttribute
            (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.TITLE,
                selectFileForPublishTask.getReportTitle());
      }

      report.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.LOCK_PREFERRED_OUTPUT_TYPE,
View Full Code Here

    return changed;
  }

  private void refreshBundleList()
  {
    final WriteableDocumentMetaData metaData = bundle.getWriteableDocumentMetaData();
    final ArrayList<String> entries = new ArrayList<String>();
    final String[] manifestEntryNames = metaData.getManifestEntryNames();
    for (int i = 0; i < manifestEntryNames.length; i++)
    {
      final String manifestEntryName = manifestEntryNames[i];

      final String stickyFlag = metaData.getEntryAttribute(manifestEntryName, BundleUtilities.STICKY_FLAG);
      if ("true".equals(stickyFlag)) // NON-NLS
      {
        entries.add(manifestEntryName);
      }
    }
View Full Code Here

    public void undo(final ReportRenderContext renderContext)
    {
      final MasterReport report = renderContext.getMasterReportElement();
      final WriteableDocumentBundle bundle = (WriteableDocumentBundle) report.getBundle();
      final WriteableDocumentMetaData metaData = bundle.getWriteableDocumentMetaData();
      metaData.setBundleAttribute
          (ODFMetaAttributeNames.Meta.NAMESPACE, ODFMetaAttributeNames.Meta.KEYWORDS,
              oldMetaData.getBundleAttribute(ODFMetaAttributeNames.Meta.NAMESPACE, ODFMetaAttributeNames.Meta.KEYWORDS));
      metaData.setBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.CREATOR,
              oldMetaData.getBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.CREATOR));
      metaData.setBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.DESCRIPTION,
              oldMetaData.getBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.DESCRIPTION));
      metaData.setBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.SUBJECT,
              oldMetaData.getBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.SUBJECT));
      metaData.setBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.TITLE,
              oldMetaData.getBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.TITLE));
      report.notifyNodePropertiesChanged();
    }
View Full Code Here

    public void redo(final ReportRenderContext renderContext)
    {
      final MasterReport report = renderContext.getMasterReportElement();
      final WriteableDocumentBundle bundle = (WriteableDocumentBundle) report.getBundle();
      final WriteableDocumentMetaData metaData = bundle.getWriteableDocumentMetaData();
      metaData.setBundleAttribute
          (ODFMetaAttributeNames.Meta.NAMESPACE, ODFMetaAttributeNames.Meta.KEYWORDS,
              newMetaData.getBundleAttribute(ODFMetaAttributeNames.Meta.NAMESPACE, ODFMetaAttributeNames.Meta.KEYWORDS));
      metaData.setBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.CREATOR,
              newMetaData.getBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.CREATOR));
      metaData.setBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.DESCRIPTION,
              newMetaData.getBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.DESCRIPTION));
      metaData.setBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.SUBJECT,
              newMetaData.getBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.SUBJECT));
      metaData.setBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.TITLE,
              newMetaData.getBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.TITLE));
      report.notifyNodePropertiesChanged();
    }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.docbundle.WriteableDocumentMetaData

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.