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 StringHIDDEN_FLAGstatic StringSTICKY_FLAG
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopyInto(WriteableDocumentBundle bundle, String targetPath, org.pentaho.reporting.libraries.resourceloader.ResourceKey dataKey, org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager)static voidcopyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle)static voidcopyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle, String[] files)static voidcopyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle, String[] files, boolean ignoreSticky)static voidcopyMetaData(MemoryDocumentBundle memoryDocumentBundle, DocumentBundle bundle)static voidcopyStickyInto(WriteableDocumentBundle targetBundle, DocumentBundle sourceBundle)static DocumentBundlegetBundle(File file)static StringgetBundleMapping(String bundleType)static StringgetBundleType(org.pentaho.reporting.libraries.repository.Repository repository)static StringgetUniqueName(DocumentBundle bundle, String pattern)static StringgetUniqueName(DocumentBundle bundle, String parent, String pattern)Returns an unique name for the given pattern, producing a file relative to the parent file name.static booleanisSameBundle(org.pentaho.reporting.libraries.resourceloader.ResourceKey elementSource, org.pentaho.reporting.libraries.resourceloader.ResourceKey attributeValue)static DateparseDate(String date)static DateparseDuration(String duration)static voidwriteAsZip(File target, DocumentBundle bundle)static voidwriteAsZip(OutputStream targetStream, DocumentBundle bundle)static voidwriteToDirectory(File target, DocumentBundle bundle)static voidwriteToRepository(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:
IOExceptionorg.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:
IOExceptionorg.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.ContentIOExceptionIOException
-
writeToDirectory
public static void writeToDirectory(File target, DocumentBundle bundle) throws org.pentaho.reporting.libraries.repository.ContentIOException, IOException
- Throws:
org.pentaho.reporting.libraries.repository.ContentIOExceptionIOException
-
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.ContentIOExceptionIOException
-
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)
-
-