Class CustomExporter


  • public class CustomExporter
    extends java.lang.Object
    Provides customized exports while still leveraging the performance of BatchExporter. This is accomplished by first performing a BatchExport using the Nuix API. Once that temporary export is completed, all the exported products (text, natives, images, pdfs) are then restructured based on a series of file naming templates. While restructuring is occurring, paths in DAT and OPT load files are updated to match new structure.
    • Constructor Summary

      Constructors 
      Constructor Description
      CustomExporter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearAllDynamicPlaholders()
      Removes all previously added dynamic placeholders.
      void exportItems​(nuix.Case nuixCase, java.io.File exportDirectory, java.util.List<nuix.Item> items)
      Exports given items in custom structure.
      void exportItems​(nuix.Case nuixCase, java.lang.String exportDirectory, java.util.List<nuix.Item> items)
      Exports given items in custom structure.
      void exportJson​(java.lang.String fileNameTemplate)  
      void exportJson​(java.lang.String fileNameTemplate, JsonExporter jsonExporter)  
      void exportNatives​(java.lang.String fileNameTemplate, java.util.Map<java.lang.String,​java.lang.Object> emailExportSettings)  
      void exportPdfs​(java.lang.String fileNameTemplate, java.util.Map<java.lang.String,​java.lang.Object> pdfExportSettings)  
      void exportText​(java.lang.String fileNameTemplate, java.util.Map<java.lang.String,​java.lang.Object> textExportSettings)  
      void exportTiffs​(java.lang.String fileNameTemplate, java.util.Map<java.lang.String,​java.lang.Object> tiffExportSettings)  
      boolean getExportXlsx()
      Gets whether DAT contents should additionally be exported as an XLSX spreadsheet.
      boolean getKeepOriginalDat()
      Gets whether original DAT will be kept by moving it to final export directory.
      nuix.MetadataProfile getProfile()
      Gets the metadata profile which will be used during export.
      void removeDynamicPlaceholder​(java.lang.String placeholderName)
      Removes a previously added dynamic placeholder.
      void setColumnRemovals​(java.util.Collection<java.lang.String> columnHeaders)
      Allows you to provide a list of header names to specify columns to remove.
      void setDynamicPlaceholder​(java.lang.String placeholderName, java.util.function.BiFunction<nuix.Item,​java.lang.String,​java.lang.String> function)
      Assigns a dynamically calculated placeholder to this instance.
      void setExportXlsx​(boolean exportXlsx)
      Sets whether DAT contents should additionally be exported as an XLSX spreadsheet.
      void setHeaderRenames​(java.util.Map<java.lang.String,​java.lang.String> renames)
      Allows you to provide a Map of headers to rename.
      void setImagingOptions​(java.util.Map<?,​?> settings)
      Sets the Map of settings which will be passed to BatchExporter.setImagingOptions(Map) when performing the temporary export before restructuring.
      void setKeepOriginalDat​(boolean keepOriginalDat)
      Sets whether final DAT will be kept by moving it to final export directory/
      void setParallelProcessingSettings​(java.util.Map<?,​?> settings)
      Sets the Map of settings which will be passed to BatchExporter.setParallelProcessingSettings(Map) when performing the temporary export before restructuring.
      void setProfile​(nuix.MetadataProfile profile)
      Sets the metadata profile used during export.
      void setStampingOptions​(java.util.Map<?,​?> settings)
      Sets the Map of settings which will be passed to BatchExporter.setStampingOptions(Map) when performing the temporary export before restructuring.
      • Methods inherited from class java.lang.Object

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

      • CustomExporter

        public CustomExporter()
    • Method Detail

      • getProfile

        public nuix.MetadataProfile getProfile()
        Gets the metadata profile which will be used during export. May be null.
        Returns:
        The metadata profile used during export.
      • setProfile

        public void setProfile​(nuix.MetadataProfile profile)
        Sets the metadata profile used during export. May be null, in which case a metadata profile containing only the column "GUID" will be created. Note that if a metadata profile is provided that does not contain the column "GUID", then a copy of the submit metadata profile is made and the "GUID" column is added to it. This is done because the GUID is needed during the restructuring phase to find the relevant item in the case corresponding to a given record in the temporary export's Concordance DAT file.
        Parameters:
        profile - The profile to use when generating metadata loadfiles.
      • setDynamicPlaceholder

        public void setDynamicPlaceholder​(java.lang.String placeholderName,
                                          java.util.function.BiFunction<nuix.Item,​java.lang.String,​java.lang.String> function)
        Assigns a dynamically calculated placeholder to this instance.
        Parameters:
        placeholderName - Placeholder name with "{" or "}". For example "my_value". Placeholder in templates can then be referred to using "{my_value}". It is preferred that you use only lower case characters and no whitespace characters. Letters, numbers and underscores only is recommended.
        function - A function which accepts as arguments an item and String with product type. Expected to return a String value. If function yields a null then placeholder will resolve to "NO_VALUE" when resolving the template.
      • removeDynamicPlaceholder

        public void removeDynamicPlaceholder​(java.lang.String placeholderName)
        Removes a previously added dynamic placeholder.
        Parameters:
        placeholderName - The name of the dynamic placeholder to remove
      • clearAllDynamicPlaholders

        public void clearAllDynamicPlaholders()
        Removes all previously added dynamic placeholders.
      • exportNatives

        public void exportNatives​(java.lang.String fileNameTemplate,
                                  java.util.Map<java.lang.String,​java.lang.Object> emailExportSettings)
      • exportText

        public void exportText​(java.lang.String fileNameTemplate,
                               java.util.Map<java.lang.String,​java.lang.Object> textExportSettings)
      • exportPdfs

        public void exportPdfs​(java.lang.String fileNameTemplate,
                               java.util.Map<java.lang.String,​java.lang.Object> pdfExportSettings)
      • exportTiffs

        public void exportTiffs​(java.lang.String fileNameTemplate,
                                java.util.Map<java.lang.String,​java.lang.Object> tiffExportSettings)
      • exportJson

        public void exportJson​(java.lang.String fileNameTemplate)
      • exportJson

        public void exportJson​(java.lang.String fileNameTemplate,
                               JsonExporter jsonExporter)
      • setHeaderRenames

        public void setHeaderRenames​(java.util.Map<java.lang.String,​java.lang.String> renames)
        Allows you to provide a Map of headers to rename. Intended to provide a way to rename headers that Nuix automatically adds to DAT files it generates:
        DOCID
        PARENT_DOCID
        ATTACH_DOCID
        BEGINBATES
        ENDBATES
        BEGINGROUP
        ENDGROUP
        PAGECOUNT
        ITEMPATH (when exporting natives)
        TEXTPATH (when exporting text)
        PDFPATH (when exporting PDFs)
        TIFFPATH (when exporting TIFFs)
        Parameters:
        renames - A Map with the map key being the header name before and the map value being what you want that header renamed to. Map key is case sensitive!
      • setColumnRemovals

        public void setColumnRemovals​(java.util.Collection<java.lang.String> columnHeaders)
        Allows you to provide a list of header names to specify columns to remove. Intended to provide a way to remove columns that Nuix automatically adds to DAT files it generates:
        DOCID
        PARENT_DOCID
        ATTACH_DOCID
        BEGINBATES
        ENDBATES
        BEGINGROUP
        ENDGROUP
        PAGECOUNT
        ITEMPATH (when exporting natives)
        TEXTPATH (when exporting text)
        PDFPATH (when exporting PDFs)
        TIFFPATH (when exporting TIFFs)
        Case sensitive and takes priority over column renaming, so make sure you provide original pre-rename headers.
        Parameters:
        columnHeaders - Collection of column header names for columns to be removed. Case sensitive and takes priority over column renaming, so make sure you provide original pre-rename headers.
      • exportItems

        public void exportItems​(nuix.Case nuixCase,
                                java.lang.String exportDirectory,
                                java.util.List<nuix.Item> items)
                         throws java.lang.Exception
        Exports given items in custom structure. This is accomplished by first performing a temporary "legal export" using the API object BatchExporter. Once that export is complete, files are restructured into final format. Load file paths are updated to reflect restructuring.
        Parameters:
        nuixCase - The relevant Nuix case, needed to resolve GUIDs in temp export DAT file to actual items.
        exportDirectory - Where the final export should reside.
        items - The items to export
        Throws:
        java.lang.Exception - If something goes wrong
      • exportItems

        public void exportItems​(nuix.Case nuixCase,
                                java.io.File exportDirectory,
                                java.util.List<nuix.Item> items)
                         throws java.lang.Exception
        Exports given items in custom structure. This is accomplished by first performing a temporary "legal export" using the API object BatchExporter. Once that export is complete, files are restructured into final format. Load file paths are updated to reflect restructuring.
        Parameters:
        nuixCase - The relevant Nuix case, needed to resolve GUIDs in temp export DAT file to actual items.
        exportDirectory - Where the final export should reside.
        items - The items to export
        Throws:
        java.lang.Exception - If something goes wrong
      • setParallelProcessingSettings

        public void setParallelProcessingSettings​(java.util.Map<?,​?> settings)
        Sets the Map of settings which will be passed to BatchExporter.setParallelProcessingSettings(Map) when performing the temporary export before restructuring.
        Parameters:
        settings - A map of settings, see API documentation for BatchExporter.setParallelProcessingSettings for a list of settings accepted.
      • setImagingOptions

        public void setImagingOptions​(java.util.Map<?,​?> settings)
        Sets the Map of settings which will be passed to BatchExporter.setImagingOptions(Map) when performing the temporary export before restructuring.
        Parameters:
        settings - A map of settings, see API documentation for BatchExporter.setImagingOptions for a list of settings accepted.
      • setStampingOptions

        public void setStampingOptions​(java.util.Map<?,​?> settings)
        Sets the Map of settings which will be passed to BatchExporter.setStampingOptions(Map) when performing the temporary export before restructuring.
        Parameters:
        settings - A map of settings, see API documentation for BatchExporter.setStampingOptions for a list of settings accepted.
      • getExportXlsx

        public boolean getExportXlsx()
        Gets whether DAT contents should additionally be exported as an XLSX spreadsheet.
        Returns:
        Whether DAT contents should additionally be exported as an XLSX spreadsheet.
      • setExportXlsx

        public void setExportXlsx​(boolean exportXlsx)
        Sets whether DAT contents should additionally be exported as an XLSX spreadsheet.
        Parameters:
        exportXlsx - Whether DAT contents should additionally be exported as an XLSX spreadsheet.
      • getKeepOriginalDat

        public boolean getKeepOriginalDat()
        Gets whether original DAT will be kept by moving it to final export directory.
        Returns:
        True if final DAT will be kept
      • setKeepOriginalDat

        public void setKeepOriginalDat​(boolean keepOriginalDat)
        Sets whether final DAT will be kept by moving it to final export directory/
        Parameters:
        keepOriginalDat - True if final DAT should be kept