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 ProgressIndicator progressIndicator;
private volatile boolean cancelRequested;
private final boolean isNewCase;
/**
* Constructs the context for the creation/opening/upgrading of
@ -100,9 +101,23 @@ public interface AutopsyService {
* case-level resources
*/
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.progressIndicator = progressIndicator;
this.cancelRequested = false;
this.isNewCase = isNewCase;
}
/**

View File

@ -1956,7 +1956,7 @@ public class Case {
checkForCancellation();
openCaseLevelServices(progressIndicator);
checkForCancellation();
openAppServiceCaseResources(progressIndicator);
openAppServiceCaseResources(progressIndicator, true);
checkForCancellation();
openCommunicationChannels(progressIndicator);
return null;
@ -2005,7 +2005,7 @@ public class Case {
checkForCancellation();
openCaseLevelServices(progressIndicator);
checkForCancellation();
openAppServiceCaseResources(progressIndicator);
openAppServiceCaseResources(progressIndicator, false);
checkForCancellation();
openCommunicationChannels(progressIndicator);
checkForCancellation();
@ -2514,7 +2514,7 @@ public class Case {
"# {0} - service name", "Case.serviceOpenCaseResourcesProgressIndicator.cancellingMessage=Cancelling opening case resources by {0}...",
"# {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
* task, running in a named thread managed by an executor service, with
@ -2546,7 +2546,7 @@ public class Case {
appServiceProgressIndicator = new LoggingProgressIndicator();
}
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
threadNameSuffix = threadNameSuffix.toLowerCase();
TaskThreadFactory threadFactory = new TaskThreadFactory(String.format(CASE_RESOURCES_THREAD_NAME, threadNameSuffix));