Class BundleUtilities


  • public class BundleUtilities
    extends Object
    • Method Detail

      • copyInto

        public static void copyInto​(WriteableDocumentBundle bundle,
                                    String targetPath,
                                    org.pentaho.reporting.libraries.resourceloader.ResourceKey dataKey,
                                    org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager)
                             throws IOException,
                                    org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException
        Throws:
        IOException
        org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException
      • getBundleType

        public static String getBundleType​(org.pentaho.reporting.libraries.repository.Repository repository)
      • getBundleMapping

        public static String getBundleMapping​(String bundleType)
      • writeAsZip

        public static void writeAsZip​(File target,
                                      DocumentBundle bundle)
                               throws IOException,
                                      org.pentaho.reporting.libraries.repository.ContentIOException
        Throws:
        IOException
        org.pentaho.reporting.libraries.repository.ContentIOException
      • writeAsZip

        public static void writeAsZip​(OutputStream targetStream,
                                      DocumentBundle bundle)
                               throws org.pentaho.reporting.libraries.repository.ContentIOException,
                                      IOException
        Throws:
        org.pentaho.reporting.libraries.repository.ContentIOException
        IOException
      • writeToDirectory

        public static void writeToDirectory​(File target,
                                            DocumentBundle bundle)
                                     throws org.pentaho.reporting.libraries.repository.ContentIOException,
                                            IOException
        Throws:
        org.pentaho.reporting.libraries.repository.ContentIOException
        IOException
      • writeToRepository

        public static void writeToRepository​(org.pentaho.reporting.libraries.repository.Repository repository,
                                             DocumentBundle bundle)
                                      throws org.pentaho.reporting.libraries.repository.ContentIOException,
                                             IOException
        Throws:
        org.pentaho.reporting.libraries.repository.ContentIOException
        IOException
      • getUniqueName

        public static String getUniqueName​(DocumentBundle bundle,
                                           String parent,
                                           String pattern)
        Returns an unique name for the given pattern, producing a file relative to the parent file name. The returned path will be an absolute path starting from the root of the bundle. When linking to this path via href-references that imply relative paths, use IOUtils.createRelativePath(java .lang.String, java.lang.String) to transform the absolute path returned here into a path relative to your current context.
        Parameters:
        bundle - the document bundle for which we seek a new unique file name.
        parent - the parent path to which the pattern is relative to.
        pattern - the file name pattern. We expect one parameter only.
        Returns:
        the unique file name, never null.
        Throws:
        IllegalStateException - if the first 2 million entries we test do not yield a unique name we can use.
      • isSameBundle

        public static boolean isSameBundle​(org.pentaho.reporting.libraries.resourceloader.ResourceKey elementSource,
                                           org.pentaho.reporting.libraries.resourceloader.ResourceKey attributeValue)
      • getBundle

        public static DocumentBundle getBundle​(File file)
                                        throws org.pentaho.reporting.libraries.resourceloader.ResourceException
        Throws:
        org.pentaho.reporting.libraries.resourceloader.ResourceException
      • parseDate

        public static Date parseDate​(String date)
      • parseDuration

        public static Date parseDuration​(String duration)