From 9b5a57872c3adcd3b46e8b8100a2cfc7eaf58b2f Mon Sep 17 00:00:00 2001 From: Jason Wells Date: Thu, 22 Aug 2024 16:26:00 -0700 Subject: [PATCH] custom exporter calls to clear were messing with stable date placeholders, now captures at start of exportItems --- .../java/com/nuix/superutilities/export/CustomExporter.java | 6 ++++-- .../com/nuix/superutilities/misc/PlaceholderResolver.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Java/SuperUtilities/src/main/java/com/nuix/superutilities/export/CustomExporter.java b/Java/SuperUtilities/src/main/java/com/nuix/superutilities/export/CustomExporter.java index d75d8be..4f8a21a 100644 --- a/Java/SuperUtilities/src/main/java/com/nuix/superutilities/export/CustomExporter.java +++ b/Java/SuperUtilities/src/main/java/com/nuix/superutilities/export/CustomExporter.java @@ -16,6 +16,7 @@ import nuix.*; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; +import org.joda.time.DateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -377,6 +378,7 @@ public void exportItems(Case nuixCase, String exportDirectory, List items) * @throws Exception If something goes wrong */ public void exportItems(Case nuixCase, File exportDirectory, List items) throws Exception { + DateTime exportStart = DateTime.now(); // Used by PlaceholderResolver.setStandardValues Utilities util = SuperUtilities.getInstance().getNuixUtilities(); File exportTempDirectory = new File(exportDirectory, "_TEMP_"); BatchExporter exporter = util.createBatchExporter(exportTempDirectory); @@ -475,7 +477,7 @@ public void itemProcessed(ItemEventInfo info) { // Used to resolve naming templates to final path structure PlaceholderResolver resolver = new PlaceholderResolver(); - resolver.setStandardValues(); + resolver.setStandardValues(exportStart); resolver.setFromCase(nuixCase); // Tracks old relative path and new relative path so that OPT file can be updated @@ -546,7 +548,7 @@ public void accept(LinkedHashMap record) { resolver.clear(); resolver.setPath("export_directory", exportDirectory.getAbsolutePath()); resolver.setFromItem(currentItem); - resolver.setStandardValues(); + resolver.setStandardValues(exportStart); resolver.setFromCase(nuixCase); // Restructure text files if we have them diff --git a/Java/SuperUtilities/src/main/java/com/nuix/superutilities/misc/PlaceholderResolver.java b/Java/SuperUtilities/src/main/java/com/nuix/superutilities/misc/PlaceholderResolver.java index 3e194c3..6cc1b3b 100644 --- a/Java/SuperUtilities/src/main/java/com/nuix/superutilities/misc/PlaceholderResolver.java +++ b/Java/SuperUtilities/src/main/java/com/nuix/superutilities/misc/PlaceholderResolver.java @@ -134,8 +134,10 @@ public void setFromItem(Item item) { * {date_day} - The datetime of invocation, as 2 digit day of the month
* {nuix_version} - The Nuix version as defined in NUIX_VERSION
*/ - public void setStandardValues() { - DateTime now = DateTime.now(); + public void setStandardValues(DateTime now) { + if(now == null) { + now = DateTime.now(); + } set("date_short", now.toString("YYYYMMdd")); set("date_long", now.toString("YYYYMMdd-HHmmss")); set("date_year", now.toString("YYYY"));