Added isNewCase to CaseContext

This commit is contained in:
Kelly Kelly 2020-05-05 10:19:26 -04:00
parent 7b0861aec0
commit dc01c80bda
2 changed files with 19 additions and 4 deletions

View File

@ -90,6 +90,7 @@ public interface AutopsyService {
private final Case theCase; private final Case theCase;
private final ProgressIndicator progressIndicator; private final ProgressIndicator progressIndicator;
private volatile boolean cancelRequested; private volatile boolean cancelRequested;
private final boolean isNewCase;
/** /**
* Constructs the context for the creation/opening/upgrading of * Constructs the context for the creation/opening/upgrading of
@ -100,9 +101,23 @@ public interface AutopsyService {
* case-level resources * case-level resources
*/ */
public CaseContext(Case theCase, ProgressIndicator progressIndicator) { public CaseContext(Case theCase, ProgressIndicator progressIndicator) {
this(theCase, progressIndicator, false);
}
/**
* Constructs the context for the creation/opening/upgrading of
* case-level resources by a service.
*
* @param theCase The case.
* @param progressIndicator A progress indicator for the opening of the
* case-level resources.
* @param isNewCase True if theCase is a new case.
*/
public CaseContext(Case theCase, ProgressIndicator progressIndicator, boolean isNewCase) {
this.theCase = theCase; this.theCase = theCase;
this.progressIndicator = progressIndicator; this.progressIndicator = progressIndicator;
this.cancelRequested = false; this.cancelRequested = false;
this.isNewCase = isNewCase;
} }
/** /**

View File

@ -1956,7 +1956,7 @@ public class Case {
checkForCancellation(); checkForCancellation();
openCaseLevelServices(progressIndicator); openCaseLevelServices(progressIndicator);
checkForCancellation(); checkForCancellation();
openAppServiceCaseResources(progressIndicator); openAppServiceCaseResources(progressIndicator, true);
checkForCancellation(); checkForCancellation();
openCommunicationChannels(progressIndicator); openCommunicationChannels(progressIndicator);
return null; return null;
@ -2005,7 +2005,7 @@ public class Case {
checkForCancellation(); checkForCancellation();
openCaseLevelServices(progressIndicator); openCaseLevelServices(progressIndicator);
checkForCancellation(); checkForCancellation();
openAppServiceCaseResources(progressIndicator); openAppServiceCaseResources(progressIndicator, false);
checkForCancellation(); checkForCancellation();
openCommunicationChannels(progressIndicator); openCommunicationChannels(progressIndicator);
checkForCancellation(); checkForCancellation();
@ -2514,7 +2514,7 @@ public class Case {
"# {0} - service name", "Case.serviceOpenCaseResourcesProgressIndicator.cancellingMessage=Cancelling opening case resources by {0}...", "# {0} - service name", "Case.serviceOpenCaseResourcesProgressIndicator.cancellingMessage=Cancelling opening case resources by {0}...",
"# {0} - service name", "Case.servicesException.notificationTitle={0} Error" "# {0} - service name", "Case.servicesException.notificationTitle={0} Error"
}) })
private void openAppServiceCaseResources(ProgressIndicator progressIndicator) throws CaseActionException { private void openAppServiceCaseResources(ProgressIndicator progressIndicator, boolean isNewCase) throws CaseActionException {
/* /*
* Each service gets its own independently cancellable/interruptible * Each service gets its own independently cancellable/interruptible
* task, running in a named thread managed by an executor service, with * task, running in a named thread managed by an executor service, with
@ -2546,7 +2546,7 @@ public class Case {
appServiceProgressIndicator = new LoggingProgressIndicator(); appServiceProgressIndicator = new LoggingProgressIndicator();
} }
appServiceProgressIndicator.start(Bundle.Case_progressMessage_preparing()); appServiceProgressIndicator.start(Bundle.Case_progressMessage_preparing());
AutopsyService.CaseContext context = new AutopsyService.CaseContext(this, appServiceProgressIndicator); AutopsyService.CaseContext context = new AutopsyService.CaseContext(this, appServiceProgressIndicator, isNewCase);
String threadNameSuffix = service.getServiceName().replaceAll("[ ]", "-"); //NON-NLS String threadNameSuffix = service.getServiceName().replaceAll("[ ]", "-"); //NON-NLS
threadNameSuffix = threadNameSuffix.toLowerCase(); threadNameSuffix = threadNameSuffix.toLowerCase();
TaskThreadFactory threadFactory = new TaskThreadFactory(String.format(CASE_RESOURCES_THREAD_NAME, threadNameSuffix)); TaskThreadFactory threadFactory = new TaskThreadFactory(String.format(CASE_RESOURCES_THREAD_NAME, threadNameSuffix));