Merge in new data source deletion code from McKinnon

This commit is contained in:
Richard Cordovano
2019-10-28 14:10:39 -04:00
parent 9b4ad347bd
commit 5cb4348f34
3 changed files with 24 additions and 22 deletions
@@ -31,7 +31,7 @@ import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchServiceException;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Instances of this Action allow users to delete data sources.
* An Action that allows a user to delete a data source.
*/
public final class DeleteDataSourceAction extends AbstractAction {
@@ -60,7 +60,7 @@ public final class DeleteDataSourceAction extends AbstractAction {
kwsService.deleteDataSource(dataSourceID);
Case.getCurrentCaseThrows().notifyDataSourceDeleted(dataSourceID);
} catch (NoCurrentCaseException | TskCoreException | KeywordSearchServiceException e) {
logger.log(Level.WARNING, String.format("Error Deleting data source (obj_id=%d)", dataSourceID), e);
logger.log(Level.SEVERE, String.format("Error Deleting data source (obj_id=%d)", dataSourceID), e);
}
}
@@ -399,9 +399,9 @@ public class Case {
* TimelineEvent that was added.
*/
TIMELINE_EVENT_ADDED,
/* An item in the central repository has had its comment
* modified. The old value is null, the new value is string for current
* comment.
/*
* An item in the central repository has had its comment modified. The
* old value is null, the new value is string for current comment.
*/
CR_COMMENT_CHANGED;
@@ -536,8 +536,8 @@ public class Case {
*/
public static boolean isValidName(String caseName) {
return !(caseName.contains("\\") || caseName.contains("/") || caseName.contains(":")
|| caseName.contains("*") || caseName.contains("?") || caseName.contains("\"")
|| caseName.contains("<") || caseName.contains(">") || caseName.contains("|"));
|| caseName.contains("*") || caseName.contains("?") || caseName.contains("\"")
|| caseName.contains("<") || caseName.contains(">") || caseName.contains("|"));
}
/**
@@ -1484,12 +1484,12 @@ public class Case {
}
/**
* Notifies case event subscribers that a data source has been delete from
* Notifies case event subscribers that a data source has been deleted from
* the case database.
*
* This should not be called from the event dispatch thread (EDT)
*
* @param dataSourceId The data source that was deleted.
* @param dataSourceId The object ID of the data source that was deleted.
*/
public void notifyDataSourceDeleted(Long dataSourceId) {
eventPublisher.publish(new DataSourceDeletedEvent(dataSourceId));
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2015-2019 Basis Technology Corp.
* Copyright 2019 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,36 +16,38 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.casemodule.events;
import java.io.Serializable;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.events.AutopsyEvent;
/**
* An application event that is published when a data source has been deleted.
*/
public class DataSourceDeletedEvent extends AutopsyEvent implements Serializable {
private static final long serialVersionUID = 1L;
private final long dataSourceId;
private final long dataSourceID;
/**
* Constructs an event published when a data source is added to a case.
* Constructs an application event that is published when a data source has
* been deleted.
*
* @param dataSourceId The data source that was deleted.
* @param dataSourceId The object ID of the data source that was deleted.
*/
public DataSourceDeletedEvent(Long dataSourceId) {
super(Case.Events.DATA_SOURCE_DELETED.toString(), null, dataSourceId);
this.dataSourceId = dataSourceId;
}
this.dataSourceID = dataSourceId;
}
/**
* Gets the data source id that is being deleted
* Gets the object ID of the data source that was deleted.
*
* @return The data source id.
*/
public long getDataSourceId() {
return dataSourceId;
return dataSourceID;
}
}