Class PdfWorkCache


  • public class PdfWorkCache
    extends java.lang.Object
    This class provides access to PDFs as files when you need them on the file system to perform some operation. Calls to getPdfPath(Item) will either provide a path to an already exported PDF for the given item or generate the PDF as needed.
    • Constructor Summary

      Constructors 
      Constructor Description
      PdfWorkCache​(java.io.File tempDirectory)
      Creates a new instance
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cleanupTemporaryPdfs()
      Calling this will delete all temporary PDFs created by this instance, as well as clear internal listing of PDFs and their associated file paths.
      void forgetItem​(nuix.Item item)
      Removes PDF from cache and deletes it from the file system.
      java.io.File getPdfPath​(nuix.Item item)
      Gets the path to a PDF exported for an item if it is already exported.
      boolean getRegenerateStored()  
      void setRegenerateStored​(boolean value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PdfWorkCache

        public PdfWorkCache​(java.io.File tempDirectory)
        Creates a new instance
        Parameters:
        tempDirectory - Temporary directory where PDF files will be saved to.
    • Method Detail

      • getPdfPath

        public java.io.File getPdfPath​(nuix.Item item)
                                throws java.lang.Exception
        Gets the path to a PDF exported for an item if it is already exported. If the given item's PDF has not yet been exported, this will export a PDF for that item and then return the newly generated PDFs path.
        Parameters:
        item - The item you wish to obtain the PDF file path of
        Returns:
        Path to the PDF file for the given item
        Throws:
        java.lang.Exception - If something goes wrong
      • forgetItem

        public void forgetItem​(nuix.Item item)
        Removes PDF from cache and deletes it from the file system. Should not error if:
        - PDF file no longer exists
        - There is no entry in cache for given item
        Parameters:
        item - The item to "forget" (remove from cache and delete PDF file)
      • cleanupTemporaryPdfs

        public void cleanupTemporaryPdfs()
                                  throws java.io.IOException
        Calling this will delete all temporary PDFs created by this instance, as well as clear internal listing of PDFs and their associated file paths.
        Throws:
        java.io.IOException - If something goes wrong
      • getRegenerateStored

        public boolean getRegenerateStored()
      • setRegenerateStored

        public void setRegenerateStored​(boolean value)