Class BundleUtilities
- java.lang.Object
-
- org.pentaho.reporting.libraries.docbundle.BundleUtilities
-
public class BundleUtilities extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
HIDDEN_FLAG
static String
STICKY_FLAG
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
copyInto(WriteableDocumentBundle bundle, String targetPath, org.pentaho.reporting.libraries.resourceloader.ResourceKey dataKey, org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager)
static void
copyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle)
static void
copyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle, String[] files)
static void
copyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle, String[] files, boolean ignoreSticky)
static void
copyMetaData(MemoryDocumentBundle memoryDocumentBundle, DocumentBundle bundle)
static void
copyStickyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle)
static DocumentBundle
getBundle(File file)
static String
getBundleMapping(String bundleType)
static String
getBundleType(org.pentaho.reporting.libraries.repository.Repository repository)
static String
getUniqueName(DocumentBundle bundle, String pattern)
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.static boolean
isSameBundle(org.pentaho.reporting.libraries.resourceloader.ResourceKey elementSource, org.pentaho.reporting.libraries.resourceloader.ResourceKey attributeValue)
static Date
parseDate(String date)
static Date
parseDuration(String duration)
static void
writeAsZip(File target, DocumentBundle bundle)
static void
writeAsZip(OutputStream targetStream, DocumentBundle bundle)
static void
writeToDirectory(File target, DocumentBundle bundle)
static void
writeToRepository(org.pentaho.reporting.libraries.repository.Repository repository, DocumentBundle bundle)
-
-
-
Field Detail
-
STICKY_FLAG
public static final String STICKY_FLAG
- See Also:
- Constant Field Values
-
HIDDEN_FLAG
public static final String HIDDEN_FLAG
- See Also:
- Constant Field Values
-
-
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)
-
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
-
copyInto
public static void copyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle) throws IOException
- Throws:
IOException
-
copyStickyInto
public static void copyStickyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle) throws IOException
- Throws:
IOException
-
copyInto
public static void copyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle, String[] files) throws IOException
- Throws:
IOException
-
copyInto
public static void copyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle, String[] files, boolean ignoreSticky) throws IOException
- Throws:
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, useIOUtils.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.
-
getUniqueName
public static String getUniqueName(DocumentBundle bundle, String pattern)
-
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
-
copyMetaData
public static void copyMetaData(MemoryDocumentBundle memoryDocumentBundle, DocumentBundle bundle)
-
-