Skip to content

Commit

Permalink
custom exporter calls to clear were messing with stable date placehol…
Browse files Browse the repository at this point in the history
…ders, now captures at start of exportItems
  • Loading branch information
JuicyDragon committed Aug 22, 2024
1 parent b4607e7 commit 9b5a578
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -377,6 +378,7 @@ public void exportItems(Case nuixCase, String exportDirectory, List<Item> items)
* @throws Exception If something goes wrong
*/
public void exportItems(Case nuixCase, File exportDirectory, List<Item> 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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -546,7 +548,7 @@ public void accept(LinkedHashMap<String, String> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ public void setFromItem(Item item) {
* <code>{date_day}</code> - The datetime of invocation, as 2 digit day of the month<br>
* <code>{nuix_version}</code> - The Nuix version as defined in <code>NUIX_VERSION</code><br>
*/
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"));
Expand Down

0 comments on commit 9b5a578

Please sign in to comment.