mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Changed ReportingConfig to use a Map, wizard configuration changes
This commit is contained in:
parent
5c670e2a6d
commit
f5b1f7b4c9
@ -1,6 +1,6 @@
|
||||
OpenIDE-Module-Name=Report
|
||||
CTL_ReportWizardAction=Run Report
|
||||
ArtifactSelectionDialog.titleLabel.text=Select which artifacts you would like to report on:
|
||||
ArtifactSelectionDialog.titleLabel.text=Select which result types you would like to report on:
|
||||
ArtifactSelectionDialog.okButton.text=OK
|
||||
PortableCaseInterestingItemsListPanel.error.errorLoadingTags=Error loading interesting item set names
|
||||
PortableCaseInterestingItemsListPanel.error.errorTitle=Error getting intesting item set names for case
|
||||
@ -77,7 +77,7 @@ ReportVisualPanel2.allResultsRadioButton.text=All Results
|
||||
ReportWizardFileOptionsVisualPanel.selectAllButton.text=Select All
|
||||
ReportWizardFileOptionsVisualPanel.deselectAllButton.text=Deselect All
|
||||
ReportWizardFileOptionsVisualPanel.jLabel1.text=Select items to include in File Report:
|
||||
ArtifactSelectionDialog.dlgTitle.text=Advanced Artifact Selection
|
||||
ArtifactSelectionDialog.dlgTitle.text=Result Type Selection
|
||||
FileReportDataTypes.filename.text=Name
|
||||
FileReportDataTypes.fileExt.text=File Extension
|
||||
FileReportDataTypes.fileType.text=File Type
|
||||
@ -331,5 +331,6 @@ ReportProgressDialog.reportLabel.text=reportLabel
|
||||
ReportProgressDialog.statusMessageLabel.text=processingLabel
|
||||
ReportVisualPanel2.specificTaggedResultsRadioButton.text=Specific Tagged Results
|
||||
ReportVisualPanel2.allTaggedResultsRadioButton.text=All Tagged Results
|
||||
ArtifactSelectionDialog.titleLabel.toolTipText=
|
||||
ReportWizardPortableCaseOptionsVisualPanel.getName.title=Choose Portable Case settings
|
||||
TableReportGenerator.StatusColumn.Header=Review Status
|
||||
|
@ -23,6 +23,7 @@ import java.awt.Component;
|
||||
import java.util.ArrayList;
|
||||
import static java.util.Collections.swap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
@ -49,13 +50,15 @@ final class ReportVisualPanel1 extends JPanel implements ListSelectionListener {
|
||||
private List<TableReportModule> tableModules = new ArrayList<>();
|
||||
private List<FileReportModule> fileModules = new ArrayList<>();
|
||||
private PortableCaseReportModule portableCaseModule;
|
||||
private Map<String, ReportModuleConfig> moduleConfigs;
|
||||
private Integer selectedIndex;
|
||||
|
||||
/**
|
||||
* Creates new form ReportVisualPanel1
|
||||
*/
|
||||
public ReportVisualPanel1(ReportWizardPanel1 wizPanel) {
|
||||
public ReportVisualPanel1(ReportWizardPanel1 wizPanel, Map<String, ReportModuleConfig> moduleConfigs) {
|
||||
this.wizPanel = wizPanel;
|
||||
this.moduleConfigs = moduleConfigs;
|
||||
initComponents();
|
||||
configurationPanel.setLayout(new BorderLayout());
|
||||
descriptionTextPane.setEditable(false);
|
||||
|
@ -54,6 +54,9 @@ import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
@ActionReference(path = "Toolbars/Case", position = 105)})
|
||||
public final class ReportWizardAction extends CallableSystemAction implements Presenter.Toolbar, ActionListener {
|
||||
|
||||
private static final String REPORTING_CONFIGURATION_NAME = "EXAMINER_MODE";
|
||||
private static final boolean DISPLAY_CASE_SPECIFIC_DATA = true;
|
||||
private static final boolean RUN_REPORTS = true;
|
||||
private final JButton toolbarButton = new JButton();
|
||||
private static final String ACTION_NAME = NbBundle.getMessage(ReportWizardAction.class, "ReportWizardAction.actionName.text");
|
||||
|
||||
@ -64,7 +67,7 @@ public final class ReportWizardAction extends CallableSystemAction implements Pr
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void doReportWizard() {
|
||||
WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator());
|
||||
WizardDescriptor wiz = new WizardDescriptor(new ReportWizardIterator(REPORTING_CONFIGURATION_NAME, DISPLAY_CASE_SPECIFIC_DATA, RUN_REPORTS));
|
||||
wiz.setTitleFormat(new MessageFormat("{0} {1}"));
|
||||
wiz.setTitle(NbBundle.getMessage(ReportWizardAction.class, "ReportWizardAction.reportWiz.title"));
|
||||
if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
|
||||
|
@ -37,7 +37,7 @@ class ReportWizardFileOptionsPanel implements WizardDescriptor.FinishablePanel<W
|
||||
private ReportWizardFileOptionsVisualPanel component;
|
||||
private JButton finishButton;
|
||||
|
||||
ReportWizardFileOptionsPanel() {
|
||||
ReportWizardFileOptionsPanel(FileReportSettings fileReportSettings) {
|
||||
finishButton = new JButton(
|
||||
NbBundle.getMessage(this.getClass(), "ReportWizardFileOptionsPanel.finishButton.text"));
|
||||
finishButton.setEnabled(false);
|
||||
|
@ -22,13 +22,16 @@ import java.awt.Component;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import org.openide.WizardDescriptor;
|
||||
import org.openide.util.NbPreferences;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
|
||||
final class ReportWizardIterator implements WizardDescriptor.Iterator<WizardDescriptor> {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ReportWizardIterator.class.getName());
|
||||
private int index;
|
||||
|
||||
private final ReportWizardPanel1 firstPanel;
|
||||
@ -55,11 +58,26 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator<WizardDesc
|
||||
private final WizardDescriptor.Panel<WizardDescriptor>[] portableCaseConfigPanels;
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
ReportWizardIterator() {
|
||||
firstPanel = new ReportWizardPanel1();
|
||||
tableConfigPanel = new ReportWizardPanel2();
|
||||
fileConfigPanel = new ReportWizardFileOptionsPanel();
|
||||
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel();
|
||||
ReportWizardIterator(String reportingConfigurationName, boolean displayCaseSpecificData, boolean runReports) {
|
||||
|
||||
ReportingConfig config = null;
|
||||
try {
|
||||
config = ReportingConfigLoader.loadConfig(reportingConfigurationName);
|
||||
} catch (ReportConfigException ex) {
|
||||
logger.log(Level.SEVERE, "Unable to load reporting configuration " + reportingConfigurationName + ". Using default settings", ex);
|
||||
}
|
||||
|
||||
if (config != null) {
|
||||
firstPanel = new ReportWizardPanel1(config.getModuleConfigs());
|
||||
tableConfigPanel = new ReportWizardPanel2(config.getTableReportSettings());
|
||||
fileConfigPanel = new ReportWizardFileOptionsPanel(config.getFileReportSettings());
|
||||
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(config.getModuleConfigs());
|
||||
} else {
|
||||
firstPanel = new ReportWizardPanel1(null);
|
||||
tableConfigPanel = new ReportWizardPanel2(null);
|
||||
fileConfigPanel = new ReportWizardFileOptionsPanel(null);
|
||||
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(null);
|
||||
}
|
||||
|
||||
allConfigPanels = new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel, fileConfigPanel, portableCaseConfigPanel};
|
||||
tableConfigPanels = new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel};
|
||||
|
@ -21,6 +21,8 @@ package org.sleuthkit.autopsy.report;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.prefs.Preferences;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.event.ChangeListener;
|
||||
@ -33,10 +35,12 @@ class ReportWizardPanel1 implements WizardDescriptor.FinishablePanel<WizardDescr
|
||||
|
||||
private WizardDescriptor wiz;
|
||||
private ReportVisualPanel1 component;
|
||||
private Map<String, ReportModuleConfig> moduleConfigs;
|
||||
private final JButton nextButton;
|
||||
private final JButton finishButton;
|
||||
|
||||
ReportWizardPanel1() {
|
||||
ReportWizardPanel1(Map<String, ReportModuleConfig> moduleConfigs) {
|
||||
this.moduleConfigs = moduleConfigs;
|
||||
nextButton = new JButton(NbBundle.getMessage(this.getClass(), "ReportWizardPanel1.nextButton.text"));
|
||||
finishButton = new JButton(NbBundle.getMessage(this.getClass(), "ReportWizardPanel1.finishButton.text"));
|
||||
finishButton.setEnabled(false);
|
||||
@ -60,7 +64,7 @@ class ReportWizardPanel1 implements WizardDescriptor.FinishablePanel<WizardDescr
|
||||
@Override
|
||||
public ReportVisualPanel1 getComponent() {
|
||||
if (component == null) {
|
||||
component = new ReportVisualPanel1(this);
|
||||
component = new ReportVisualPanel1(this, moduleConfigs);
|
||||
}
|
||||
return component;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class ReportWizardPanel2 implements WizardDescriptor.Panel<WizardDescriptor> {
|
||||
private final JButton nextButton;
|
||||
private WizardDescriptor wiz;
|
||||
|
||||
ReportWizardPanel2() {
|
||||
ReportWizardPanel2(TableReportSettings tableReportSettings) {
|
||||
finishButton = new JButton(NbBundle.getMessage(this.getClass(), "ReportWizardPanel2.finishButton.text"));
|
||||
|
||||
nextButton = new JButton(NbBundle.getMessage(this.getClass(), "ReportWizardPanel2.nextButton.text"));
|
||||
|
@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.report;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Map;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import org.openide.WizardDescriptor;
|
||||
@ -36,7 +37,7 @@ class ReportWizardPortableCaseOptionsPanel implements WizardDescriptor.Finishabl
|
||||
private ReportWizardPortableCaseOptionsVisualPanel component;
|
||||
private final JButton finishButton;
|
||||
|
||||
ReportWizardPortableCaseOptionsPanel() {
|
||||
ReportWizardPortableCaseOptionsPanel(Map<String, ReportModuleConfig> moduleConfigs) {
|
||||
finishButton = new JButton(
|
||||
NbBundle.getMessage(this.getClass(), "ReportWizardFileOptionsPanel.finishButton.text"));
|
||||
finishButton.setEnabled(false);
|
||||
|
@ -19,8 +19,9 @@
|
||||
package org.sleuthkit.autopsy.report;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A bundling of all the settings objects that define a report configuration.
|
||||
@ -29,7 +30,7 @@ final class ReportingConfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String configName;
|
||||
private List<ReportModuleConfig> moduleConfigs = new ArrayList<>();
|
||||
private Map<String, ReportModuleConfig> moduleConfigs = new HashMap<>();
|
||||
private TableReportSettings tableReportSettings;
|
||||
private FileReportSettings fileReportSettings;
|
||||
|
||||
@ -51,10 +52,12 @@ final class ReportingConfig implements Serializable {
|
||||
}
|
||||
|
||||
void setModuleConfigs(List<ReportModuleConfig> moduleConfigs) {
|
||||
this.moduleConfigs = moduleConfigs;
|
||||
for (ReportModuleConfig config : moduleConfigs) {
|
||||
this.moduleConfigs.put(config.getModuleClassName(), config);
|
||||
}
|
||||
}
|
||||
|
||||
List<ReportModuleConfig> getModuleConfigs() {
|
||||
Map<String, ReportModuleConfig> getModuleConfigs() {
|
||||
return this.moduleConfigs;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
@ -129,14 +130,14 @@ final class ReportingConfigLoader {
|
||||
* Serialize all of the settings that make up a reporting configuration in
|
||||
* an atomic, thread safe way.
|
||||
*
|
||||
* @param config ReportingConfig object to serialize to disk
|
||||
* @param reportConfig ReportingConfig object to serialize to disk
|
||||
* @throws ReportConfigException if an error occurred while saving the
|
||||
* configuration
|
||||
*/
|
||||
static synchronized void saveConfig(ReportingConfig config) throws ReportConfigException {
|
||||
static synchronized void saveConfig(ReportingConfig reportConfig) throws ReportConfigException {
|
||||
|
||||
// construct the configuration directory path
|
||||
Path pathToConfigDir = Paths.get(ReportingConfigLoader.REPORT_CONFIG_FOLDER_PATH, config.getName());
|
||||
Path pathToConfigDir = Paths.get(ReportingConfigLoader.REPORT_CONFIG_FOLDER_PATH, reportConfig.getName());
|
||||
|
||||
// create configuration directory
|
||||
try {
|
||||
@ -148,7 +149,7 @@ final class ReportingConfigLoader {
|
||||
// save table report settings
|
||||
String filePath = pathToConfigDir.toString() + File.separator + TABLE_REPORT_CONFIG_FILE;
|
||||
try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) {
|
||||
out.writeObject(config.getTableReportSettings());
|
||||
out.writeObject(reportConfig.getTableReportSettings());
|
||||
} catch (IOException ex) {
|
||||
throw new ReportConfigException("Unable to save table report configuration " + filePath, ex);
|
||||
}
|
||||
@ -156,14 +157,18 @@ final class ReportingConfigLoader {
|
||||
// save file report settings
|
||||
filePath = pathToConfigDir.toString() + File.separator + FILE_REPORT_CONFIG_FILE;
|
||||
try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) {
|
||||
out.writeObject(config.getFileReportSettings());
|
||||
out.writeObject(reportConfig.getFileReportSettings());
|
||||
} catch (IOException ex) {
|
||||
throw new ReportConfigException("Unable to save file report configuration " + filePath, ex);
|
||||
}
|
||||
|
||||
// save list of module configuration objects
|
||||
filePath = pathToConfigDir.toString() + File.separator + MODULE_CONFIG_FILE;
|
||||
List<ReportModuleConfig> moduleConfigs = config.getModuleConfigs();
|
||||
List<ReportModuleConfig> moduleConfigs = new ArrayList<>();
|
||||
for (ReportModuleConfig config : reportConfig.getModuleConfigs().values()) {
|
||||
moduleConfigs.add(config);
|
||||
}
|
||||
|
||||
try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) {
|
||||
out.writeObject(moduleConfigs);
|
||||
} catch (IOException ex) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user