Updates to TableReportGenerator

This commit is contained in:
Eugene Livis 2019-08-07 15:22:52 -04:00
parent 1d1f1597b0
commit c0740b09fb
4 changed files with 29 additions and 8 deletions

View File

@ -142,13 +142,13 @@ class ReportGenerator {
* @param tagSelections the enabled/disabled state of the tag names to be
* included in the report
*/
void generateTableReport(TableReportModule tableReport, Map<BlackboardArtifact.Type, Boolean> artifactTypeSelections, Map<String, Boolean> tagNameSelections) throws IOException {
if (tableReport != null && null != artifactTypeSelections) {
void generateTableReport(TableReportModule tableReport, TableReportSettings tableReportSettings) throws IOException {
if (tableReport != null && tableReportSettings != null && null != tableReportSettings.getArtifactSelections()) {
String reportDir = createReportDirectory(tableReport);
setupProgressPanel(tableReport, reportDir);
ReportWorker worker = new ReportWorker(() -> {
tableReport.startReport(reportDir);
TableReportGenerator generator = new TableReportGenerator(artifactTypeSelections, tagNameSelections, progressPanel, tableReport);
TableReportGenerator generator = new TableReportGenerator(tableReportSettings, progressPanel, tableReport);
generator.execute();
tableReport.endReport();
// finish progress, wrap up

View File

@ -75,7 +75,7 @@ public final class ReportWizardAction extends CallableSystemAction implements Pr
PortableCaseReportModule portableCaseReport = (PortableCaseReportModule) wiz.getProperty("portableCaseModule"); // NON-NLS
try {
if (tableReport != null) {
generator.generateTableReport(tableReport, (Map<BlackboardArtifact.Type, Boolean>) wiz.getProperty("artifactStates"), (Map<String, Boolean>) wiz.getProperty("tagStates")); //NON-NLS
generator.generateTableReport(tableReport, new TableReportSettings((Map<BlackboardArtifact.Type, Boolean>) wiz.getProperty("artifactStates"), (Map<String, Boolean>) wiz.getProperty("tagStates"))); //NON-NLS
} else if (generalReport != null) {
generator.generateGeneralReport(generalReport);
} else if (fileReport != null) {

View File

@ -72,22 +72,24 @@ class TableReportGenerator {
private final List<String> errorList;
TableReportGenerator(Map<BlackboardArtifact.Type, Boolean> artifactTypeSelections, Map<String, Boolean> tagNameSelections, ReportProgressPanel progressPanel, TableReportModule tableReport) {
TableReportGenerator(TableReportSettings settings, ReportProgressPanel progressPanel, TableReportModule tableReport) {
// ELTODO Map<BlackboardArtifact.Type, Boolean> artifactTypeSelections, Map<String, Boolean> tagNameSelections
this.progressPanel = progressPanel;
this.tableReport = tableReport;
this.columnHeaderMap = new HashMap<>();
errorList = new ArrayList<>();
// Get the artifact types selected by the user.
for (Map.Entry<BlackboardArtifact.Type, Boolean> entry : artifactTypeSelections.entrySet()) {
for (Map.Entry<BlackboardArtifact.Type, Boolean> entry : settings.getArtifactSelections().entrySet()) {
if (entry.getValue()) {
artifactTypes.add(entry.getKey());
}
}
// Get the tag names selected by the user and make a tag names filter.
if (null != tagNameSelections) {
for (Map.Entry<String, Boolean> entry : tagNameSelections.entrySet()) {
if (null != settings.getTagSelections()) {
for (Map.Entry<String, Boolean> entry : settings.getTagSelections().entrySet()) {
if (entry.getValue() == true) {
tagNamesFilter.add(entry.getKey());
}

View File

@ -18,6 +18,10 @@
*/
package org.sleuthkit.autopsy.report;
import java.util.HashMap;
import java.util.Map;
import org.sleuthkit.datamodel.BlackboardArtifact;
/**
* Class for persisting the selection of the tag types and artifact types used
* by the TableReportGenerator class to drive report generation by
@ -25,4 +29,19 @@ package org.sleuthkit.autopsy.report;
*/
class TableReportSettings {
private Map<BlackboardArtifact.Type, Boolean> artifactTypeSelections = new HashMap<>();
private Map<String, Boolean> tagNameSelections = new HashMap<>();
TableReportSettings(Map<BlackboardArtifact.Type, Boolean> artifactTypeSelections, Map<String, Boolean> tagNameSelections) {
this.artifactTypeSelections = artifactTypeSelections;
this.tagNameSelections = tagNameSelections;
}
Map<BlackboardArtifact.Type, Boolean> getArtifactSelections(){
return artifactTypeSelections;
}
Map<String, Boolean> getTagSelections() {
return tagNameSelections;
}
}