4700 Correctly set curent case to null when case is closed

This commit is contained in:
Richard Cordovano 2021-04-01 11:23:39 -04:00
parent 9248c9dd7e
commit f135aa8f87

View File

@ -440,45 +440,38 @@ public class Case {
*/
OS_ACCOUNT_ADDED,
/**
* OSAccount associated with the current case has changed.
* Call getOsAccount to get the changed account;
* OSAccount associated with the current case has changed. Call
* getOsAccount to get the changed account;
*/
OS_ACCOUNT_CHANGED,
/**
* OSAccount associated with the current case has been deleted.
* OSAccount associated with the current case has been deleted.
*/
OS_ACCOUNT_REMOVED,
/**
* Hosts associated with the current case added.
*/
HOSTS_ADDED,
/**
* Hosts associated with the current case has changed.
* Hosts associated with the current case has changed.
*/
HOSTS_CHANGED,
/**
* Hosts associated with the current case has been deleted.
* Hosts associated with the current case has been deleted.
*/
HOSTS_DELETED,
/**
* Persons associated with the current case added.
*/
PERSONS_ADDED,
/**
* Persons associated with the current case has changed.
* Persons associated with the current case has changed.
*/
PERSONS_CHANGED,
/**
* Persons associated with the current case has been deleted.
* Persons associated with the current case has been deleted.
*/
PERSONS_DELETED
;
PERSONS_DELETED;
};
/**
@ -511,95 +504,95 @@ public class Case {
event.getArtifacts(artifactType)));
}
}
@Subscribe
@Subscribe
public void publishOsAccountAddedEvent(OsAccountsCreationEvent event) {
for(OsAccount account: event.getOsAcounts()) {
for (OsAccount account : event.getOsAcounts()) {
eventPublisher.publish(new OsAccountAddedEvent(account));
}
}
@Subscribe
@Subscribe
public void publishOsAccountChangedEvent(OsAccountsUpdateEvent event) {
for(OsAccount account: event.getOsAcounts()) {
for (OsAccount account : event.getOsAcounts()) {
eventPublisher.publish(new OsAccountChangedEvent(account));
}
}
@Subscribe
@Subscribe
public void publishOsAccountDeletedEvent(OsAccountsDeleteEvent event) {
for(Long accountId: event.getOsAcountObjectIds()) {
for (Long accountId : event.getOsAcountObjectIds()) {
eventPublisher.publish(new OsAccountRemovedEvent(accountId));
}
}
}
/**
* Publishes an autopsy event from the sleuthkit HostCreationEvent
* Publishes an autopsy event from the sleuthkit HostCreationEvent
* indicating that hosts have been created.
*
*
* @param event The sleuthkit event for the creation of hosts.
*/
@Subscribe
@Subscribe
public void publishHostsAddedEvent(HostsCreationEvent event) {
eventPublisher.publish(new HostsAddedEvent(
event == null ? Collections.emptyList() : event.getHosts()));
}
/**
* Publishes an autopsy event from the sleuthkit HostUpdateEvent
* Publishes an autopsy event from the sleuthkit HostUpdateEvent
* indicating that hosts have been updated.
*
*
* @param event The sleuthkit event for the updating of hosts.
*/
@Subscribe
*/
@Subscribe
public void publishHostsChangedEvent(HostsUpdateEvent event) {
eventPublisher.publish(new HostsChangedEvent(
event == null ? Collections.emptyList() : event.getHosts()));
}
/**
* Publishes an autopsy event from the sleuthkit HostDeletedEvent
* Publishes an autopsy event from the sleuthkit HostDeletedEvent
* indicating that hosts have been deleted.
*
*
* @param event The sleuthkit event for the deleting of hosts.
*/
@Subscribe
*/
@Subscribe
public void publishHostsDeletedEvent(HostsDeletionEvent event) {
eventPublisher.publish(new HostsRemovedEvent(
event == null ? Collections.emptyList() : event.getHosts()));
}
/**
* Publishes an autopsy event from the sleuthkit PersonCreationEvent
* Publishes an autopsy event from the sleuthkit PersonCreationEvent
* indicating that persons have been created.
*
*
* @param event The sleuthkit event for the creation of persons.
*/
@Subscribe
@Subscribe
public void publishPersonsAddedEvent(PersonsCreationEvent event) {
eventPublisher.publish(new PersonsAddedEvent(
event == null ? Collections.emptyList() : event.getPersons()));
}
/**
* Publishes an autopsy event from the sleuthkit PersonUpdateEvent
* Publishes an autopsy event from the sleuthkit PersonUpdateEvent
* indicating that persons have been updated.
*
*
* @param event The sleuthkit event for the updating of persons.
*/
@Subscribe
*/
@Subscribe
public void publishPersonsChangedEvent(PersonsUpdateEvent event) {
eventPublisher.publish(new PersonsChangedEvent(
event == null ? Collections.emptyList() : event.getPersons()));
}
/**
* Publishes an autopsy event from the sleuthkit PersonDeletedEvent
* Publishes an autopsy event from the sleuthkit PersonDeletedEvent
* indicating that persons have been deleted.
*
*
* @param event The sleuthkit event for the deleting of persons.
*/
@Subscribe
*/
@Subscribe
public void publishPersonsDeletedEvent(PersonsDeletionEvent event) {
eventPublisher.publish(new PersonsRemovedEvent(
event == null ? Collections.emptyList() : event.getPersons()));
@ -882,12 +875,12 @@ public class Case {
eventPublisher.publishLocally(new AutopsyEvent(Events.CURRENT_CASE.toString(), closedCase, null));
logger.log(Level.INFO, "Closing current case {0} ({1}) in {2}", new Object[]{closedCase.getDisplayName(), closedCase.getName(), closedCase.getCaseDirectory()}); //NON-NLS
closedCase.doCloseCaseAction();
currentCase = null;
logger.log(Level.INFO, "Closed current case {0} ({1}) in {2}", new Object[]{closedCase.getDisplayName(), closedCase.getName(), closedCase.getCaseDirectory()}); //NON-NLS
} catch (CaseActionException ex) {
logger.log(Level.SEVERE, String.format("Error closing current case %s (%s) in %s", closedCase.getDisplayName(), closedCase.getName(), closedCase.getCaseDirectory()), ex); //NON-NLS
throw ex;
} finally {
currentCase = null;
if (RuntimeProperties.runningWithGUI()) {
updateGUIForCaseClosed();
}
@ -1793,7 +1786,7 @@ public class Case {
public void notifyBlackBoardArtifactTagDeleted(BlackboardArtifactTag deletedTag) {
eventPublisher.publish(new BlackBoardArtifactTagDeletedEvent(deletedTag));
}
public void notifyOsAccountAdded(OsAccount account) {
eventPublisher.publish(new OsAccountAddedEvent(account));
}
@ -1801,13 +1794,14 @@ public class Case {
public void notifyOsAccountChanged(OsAccount account) {
eventPublisher.publish(new OsAccountChangedEvent(account));
}
public void notifyOsAccountRemoved(Long osAccountObjectId) {
eventPublisher.publish(new OsAccountRemovedEvent(osAccountObjectId));
}
/**
* Notify via an autopsy event that a host has been added.
*
* @param host The host that has been added.
*/
public void notifyHostAdded(Host host) {
@ -1816,22 +1810,25 @@ public class Case {
/**
* Notify via an autopsy event that a host has been changed.
*
* @param newValue The host that has been updated.
*/
public void notifyHostChanged(Host newValue) {
eventPublisher.publish(new HostsChangedEvent(Collections.singletonList(newValue)));
}
/**
* Notify via an autopsy event that a host has been deleted.
*
* @param host The host that has been deleted.
*/
public void notifyHostDeleted(Host host) {
eventPublisher.publish(new HostsRemovedEvent(Collections.singletonList(host)));
}
/**
* Notify via an autopsy event that a person has been added.
*
* @param person The person that has been added.
*/
public void notifyPersonAdded(Person person) {
@ -1840,20 +1837,22 @@ public class Case {
/**
* Notify via an autopsy event that a person has been changed.
*
* @param newValue The person that has been updated.
*/
public void notifyPersonChanged(Person newValue) {
eventPublisher.publish(new PersonsChangedEvent(Collections.singletonList(newValue)));
}
/**
* Notify via an autopsy event that a person has been deleted.
*
* @param person The person that has been deleted.
*/
public void notifyPersonDeleted(Person person) {
eventPublisher.publish(new PersonsRemovedEvent(Collections.singletonList(person)));
}
/**
* Adds a report to the case.
*