From 6817c5e3e7c99dfeb8b04fc894c5865484c52f73 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 28 Apr 2020 13:39:12 -0400 Subject: [PATCH] Codacy fixes and small interface changes --- .../autopsy/report/GeneralReportModule.java | 16 ++++++++-------- .../autopsy/report/GeneralReportSettings.java | 9 +++++++++ .../report/infrastructure/ReportGenerator.java | 3 ++- .../infrastructure/ReportWizardPanel1.java | 2 +- .../autopsy/report/modules/kml/KMLReport.java | 10 ++++++---- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java b/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java index c7553c9d64..daed772123 100644 --- a/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java +++ b/Core/src/org/sleuthkit/autopsy/report/GeneralReportModule.java @@ -45,16 +45,16 @@ public interface GeneralReportModule extends ReportModule { /** * Called to generate the report. Method is responsible for saving the file - * at the path specified and updating progress via the progressPanel object. - * Configuration parameters can be passed in the settings class. Modules should - * try to respond to all configuration parameters. + * and updating progress via the progressPanel object. Configuration + * parameters are passed in the settings class, most notably the directory + * to save the report. Modules should try to respond to all configuration + * parameters. * - * @param baseReportDir Base directory that reports are being stored in. - * Report should go into baseReportDir + getRelativeFilePath(). - * @param settings Configuration parameters to customize the report generation process + * @param settings Configuration parameters to customize the report + * generation process * @param progressPanel panel to update the report's progress with */ - default void generateReport(String baseReportDir, GeneralReportSettings settings, ReportProgressPanel progressPanel) { - generateReport(baseReportDir, progressPanel); + default void generateReport(GeneralReportSettings settings, ReportProgressPanel progressPanel) { + generateReport(settings.getReportDirectoryPath(), progressPanel); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java b/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java index 34c7b20139..0aabf50fbb 100755 --- a/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java +++ b/Core/src/org/sleuthkit/autopsy/report/GeneralReportSettings.java @@ -29,6 +29,7 @@ public class GeneralReportSettings implements Serializable { private static final long serialVersionUID = 1L; private List dataSourcesToProcess; + private String reportDirectoryPath; public List getDataSourcesToProcess() { return dataSourcesToProcess; @@ -37,4 +38,12 @@ public class GeneralReportSettings implements Serializable { public void setDataSourcesToProcess(List dataSourcesToProcess) { this.dataSourcesToProcess = new ArrayList<>(dataSourcesToProcess); } + + public String getReportDirectoryPath() { + return this.reportDirectoryPath; + } + + public void setReportDirectoryPath(String reportDirectoryPath) { + this.reportDirectoryPath = reportDirectoryPath; + } } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java index 022b2a8667..e3f6f186ab 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportGenerator.java @@ -302,7 +302,8 @@ public class ReportGenerator { if (generalReportModule != null) { String reportDir = createReportDirectory(generalReportModule); setupProgressPanel(generalReportModule, reportDir); - generalReportModule.generateReport(reportDir, reportSettings, progressIndicator); + reportSettings.setReportDirectoryPath(reportDir); + generalReportModule.generateReport(reportSettings, progressIndicator); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java index 1b023c7815..106745c182 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPanel1.java @@ -130,7 +130,7 @@ class ReportWizardPanel1 implements WizardDescriptor.FinishablePanel selections = currentCase.getDataSources() .stream() .map(Content::getId) .collect(Collectors.toList()); - settings.setDataSourcesToProcess(selections); - generateReport(baseReportDir, settings, progressPanel); + reportSettings.setDataSourcesToProcess(selections); + reportSettings.setReportDirectoryPath(baseReportDir); + generateReport(reportSettings, progressPanel); } catch (NoCurrentCaseException | TskCoreException ex) { logger.log(Level.SEVERE, "Exception while accessing case resources.", ex); //NON-NLS }