Updated cancellation policy.

This commit is contained in:
Oliver Spohngellert 2016-05-03 12:01:17 -04:00
parent c29f106d3e
commit 25f954c4d3
2 changed files with 22 additions and 43 deletions

View File

@ -318,7 +318,7 @@ class ReportGenerator {
List<AbstractFile> files = getFiles(); List<AbstractFile> files = getFiles();
int numFiles = files.size(); int numFiles = files.size();
if (fileReportModule != null) { if (progressPanel.getStatus() != ReportStatus.CANCELED) {
fileReportModule.startReport(reportPath); fileReportModule.startReport(reportPath);
fileReportModule.startTable(enabledInfo); fileReportModule.startTable(enabledInfo);
} }
@ -329,12 +329,8 @@ class ReportGenerator {
// Add files to report. // Add files to report.
for (AbstractFile file : files) { for (AbstractFile file : files) {
// Check to see if any reports have been cancelled. // Check to see if any reports have been cancelled.
if (fileReportModule == null) {
break;
}
// Remove cancelled reports, add files to report otherwise.
if (progressPanel.getStatus() == ReportStatus.CANCELED) { if (progressPanel.getStatus() == ReportStatus.CANCELED) {
fileReportModule = null; return 0;
} else { } else {
fileReportModule.addRow(file, enabledInfo); fileReportModule.addRow(file, enabledInfo);
progressPanel.increment(); progressPanel.increment();
@ -428,22 +424,28 @@ class ReportGenerator {
@Override @Override
protected Integer doInBackground() throws Exception { protected Integer doInBackground() throws Exception {
// Start the progress indicators for each active TableReportModule. // Start the progress indicators for each active TableReportModule.
if (progressPanel.getStatus() == ReportStatus.CANCELED) { tableReportModule.startReport(reportPath);
} else { progressPanel.start();
tableReportModule.startReport(reportPath); progressPanel.setIndeterminate(false);
progressPanel.start(); progressPanel.setMaximumProgress(this.artifactTypes.size() + 2); // +2 for content and blackboard artifact tags
progressPanel.setIndeterminate(false);
progressPanel.setMaximumProgress(this.artifactTypes.size() + 2); // +2 for content and blackboard artifact tags
}
// report on the blackboard results // report on the blackboard results
makeBlackboardArtifactTables(); if (progressPanel.getStatus() != ReportStatus.CANCELED) {
makeBlackboardArtifactTables();
}
// report on the tagged files and artifacts // report on the tagged files and artifacts
makeContentTagsTables(); if (progressPanel.getStatus() != ReportStatus.CANCELED) {
makeBlackboardArtifactTagsTables(); makeContentTagsTables();
}
// report on the tagged images if (progressPanel.getStatus() != ReportStatus.CANCELED) {
makeThumbnailTable(); makeBlackboardArtifactTagsTables();
}
if (progressPanel.getStatus() != ReportStatus.CANCELED) {
// report on the tagged images
makeThumbnailTable();
}
// finish progress, wrap up // finish progress, wrap up
progressPanel.complete(ReportStatus.COMPLETE); progressPanel.complete(ReportStatus.COMPLETE);
@ -466,8 +468,8 @@ class ReportGenerator {
// Add a table to the report for every enabled blackboard artifact type. // Add a table to the report for every enabled blackboard artifact type.
for (BlackboardArtifact.Type type : artifactTypes) { for (BlackboardArtifact.Type type : artifactTypes) {
// Check for cancellaton. // Check for cancellaton.
removeCancelledTableReportModules();
if (tableReportModule == null) { if (progressPanel.getStatus() == ReportStatus.CANCELED) {
return; return;
} }
@ -543,11 +545,6 @@ class ReportGenerator {
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
private void makeContentTagsTables() { private void makeContentTagsTables() {
// Check for cancellaton.
removeCancelledTableReportModules();
if (tableReportModule == null) {
return;
}
// Get the content tags. // Get the content tags.
List<ContentTag> tags; List<ContentTag> tags;
@ -660,11 +657,6 @@ class ReportGenerator {
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
private void makeBlackboardArtifactTagsTables() { private void makeBlackboardArtifactTagsTables() {
// Check for cancellaton.
removeCancelledTableReportModules();
if (tableReportModule == null) {
return;
}
List<BlackboardArtifactTag> tags; List<BlackboardArtifactTag> tags;
try { try {
@ -724,12 +716,6 @@ class ReportGenerator {
return tagNamesFilter.isEmpty() || tagNamesFilter.contains(tagName); return tagNamesFilter.isEmpty() || tagNamesFilter.contains(tagName);
} }
void removeCancelledTableReportModules() {
if (progressPanel.getStatus() == ReportStatus.CANCELED) {
tableReportModule = null;
}
}
/** /**
* Make a report for the files that were previously found to be images. * Make a report for the files that were previously found to be images.
*/ */

View File

@ -82,10 +82,6 @@ class ReportKML implements GeneralReportModule {
String reportPath2 = baseReportDir + "ReportKML.txt"; //NON-NLS String reportPath2 = baseReportDir + "ReportKML.txt"; //NON-NLS
currentCase = Case.getCurrentCase(); currentCase = Case.getCurrentCase();
skCase = currentCase.getSleuthkitCase(); skCase = currentCase.getSleuthkitCase();
if (progressPanel.getStatus() == ReportProgressPanel.ReportStatus.CANCELED) {
return;
}
progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportKML.progress.loading")); progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportKML.progress.loading"));
// Check if ingest has finished // Check if ingest has finished
String ingestwarning = ""; String ingestwarning = "";
@ -99,9 +95,6 @@ class ReportKML implements GeneralReportModule {
// Why not just print the coordinates as we find them and make some utility methods to do the printing? // Why not just print the coordinates as we find them and make some utility methods to do the printing?
// Should pull out time values for all of these points and store in TimeSpan element // Should pull out time values for all of these points and store in TimeSpan element
try { try {
if (progressPanel.getStatus() == ReportProgressPanel.ReportStatus.CANCELED) {
return;
}
try (BufferedWriter out = new BufferedWriter(new FileWriter(reportPath2))) { try (BufferedWriter out = new BufferedWriter(new FileWriter(reportPath2))) {
double lat = 0; // temp latitude double lat = 0; // temp latitude