Package com.nuix.superutilities.export
Class CustomExporter
- java.lang.Object
-
- com.nuix.superutilities.export.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)
Enables export of JSON files using the provided settings.void
exportJson(java.lang.String fileNameTemplate, JsonExporter jsonExporter)
Enables export of JSON files using the provided settings.void
exportNatives(java.lang.String fileNameTemplate, java.util.Map<java.lang.String,java.lang.Object> emailExportSettings)
Enables export of natives using the provided settings.void
exportPdfs(java.lang.String fileNameTemplate, java.util.Map<java.lang.String,java.lang.Object> pdfExportSettings)
Enables export of PDF files using the provided settings.void
exportText(java.lang.String fileNameTemplate, java.util.Map<java.lang.String,java.lang.Object> textExportSettings)
Enables export of text files using the provided settings.void
exportTiffs(java.lang.String fileNameTemplate, java.util.Map<java.lang.String,java.lang.Object> tiffExportSettings)
Enables export of TIFF files using the provided settings.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.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
setImagingOptions(java.util.Map<java.lang.String,java.lang.Object> settings)
Sets the Map of settings which will be passed toBatchExporter.setImagingOptions(Map)
when performing the temporary export before restructuring.void
setStampingOptions(java.util.Map<java.lang.String,java.lang.Object> settings)
Sets the Map of settings which will be passed toBatchExporter.setStampingOptions(Map)
when performing the temporary export before restructuring.void
whenMessageLogged(java.util.function.Consumer<java.lang.String> messageLoggedCallback)
void
whenProgressEventOccurs(java.util.function.Consumer<BoundedProgressInfo> progressCallback)
Provides a callback to be invoked when progress is made during initial batch export or during restructuring phase.
-
-
-
Method Detail
-
whenProgressEventOccurs
public void whenProgressEventOccurs(java.util.function.Consumer<BoundedProgressInfo> progressCallback)
Provides a callback to be invoked when progress is made during initial batch export or during restructuring phase. Will be wrapped in aPeriodicGatedConsumer
with an interval of 5 seconds if not already an instance ofPeriodicGatedConsumer
.- Parameters:
progressCallback
- The progress info consumer.
-
whenMessageLogged
public void whenMessageLogged(java.util.function.Consumer<java.lang.String> messageLoggedCallback)
-
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)
Enables export of natives using the provided settings. SeePlaceholderResolver.setFromItem(Item)
to see what placeholders are inherently supported by fileNameTemplate- Parameters:
fileNameTemplate
- A filename template that dictates the ultimate export structure. SeePlaceholderResolver.setFromItem(Item)
for a baseline set of built-in per-item placeholders.emailExportSettings
- Email native export settings as supported by BatchExporter
-
exportText
public void exportText(java.lang.String fileNameTemplate, java.util.Map<java.lang.String,java.lang.Object> textExportSettings)
Enables export of text files using the provided settings. SeePlaceholderResolver.setFromItem(Item)
to see what placeholders are inherently supported by fileNameTemplate- Parameters:
fileNameTemplate
- A filename template that dictates the ultimate export structure. SeePlaceholderResolver.setFromItem(Item)
for a baseline set of built-in per-item placeholders.textExportSettings
- Text file export settings as supported by BatchExporter
-
exportPdfs
public void exportPdfs(java.lang.String fileNameTemplate, java.util.Map<java.lang.String,java.lang.Object> pdfExportSettings)
Enables export of PDF files using the provided settings. SeePlaceholderResolver.setFromItem(Item)
to see what placeholders are inherently supported by fileNameTemplate- Parameters:
fileNameTemplate
- A filename template that dictates the ultimate export structure. SeePlaceholderResolver.setFromItem(Item)
for a baseline set of built-in per-item placeholders.pdfExportSettings
- PDF export settings as supported by BatchExporter
-
exportTiffs
public void exportTiffs(java.lang.String fileNameTemplate, java.util.Map<java.lang.String,java.lang.Object> tiffExportSettings)
Enables export of TIFF files using the provided settings. SeePlaceholderResolver.setFromItem(Item)
to see what placeholders are inherently supported by fileNameTemplate- Parameters:
fileNameTemplate
- A filename template that dictates the ultimate export structure. SeePlaceholderResolver.setFromItem(Item)
for a baseline set of built-in per-item placeholders.tiffExportSettings
- TIFF export settings as supported by BatchExporter
-
exportJson
public void exportJson(java.lang.String fileNameTemplate)
Enables export of JSON files using the provided settings. SeePlaceholderResolver.setFromItem(Item)
to see what placeholders are inherently supported by fileNameTemplate- Parameters:
fileNameTemplate
- A filename template that dictates the ultimate export structure. SeePlaceholderResolver.setFromItem(Item)
for a baseline set of built-in per-item placeholders.
-
exportJson
public void exportJson(java.lang.String fileNameTemplate, JsonExporter jsonExporter)
Enables export of JSON files using the provided settings. SeePlaceholderResolver.setFromItem(Item)
to see what placeholders are inherently supported by fileNameTemplate- Parameters:
fileNameTemplate
- A filename template that dictates the ultimate export structure. SeePlaceholderResolver.setFromItem(Item)
for a baseline set of built-in per-item placeholders.jsonExporter
- AJsonExporter
instance in case you wish to customize serialization.
-
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
-
setImagingOptions
public void setImagingOptions(java.util.Map<java.lang.String,java.lang.Object> settings)
Sets the Map of settings which will be passed toBatchExporter.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<java.lang.String,java.lang.Object> settings)
Sets the Map of settings which will be passed toBatchExporter.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.
-
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
-
-