Added tag events to sleuthkit

This commit is contained in:
Kelly Kelly 2022-02-16 16:09:33 -05:00
parent 92ec7b2e42
commit eb2a720354
2 changed files with 43 additions and 105 deletions

View File

@ -671,6 +671,38 @@ public class Case {
public void publishAnalysisResultDeleted(TskEvent.AnalysisResultsDeletedTskEvent event) { public void publishAnalysisResultDeleted(TskEvent.AnalysisResultsDeletedTskEvent event) {
eventPublisher.publish(new AnalysisResultDeletedEvent(event.getAnalysisResultObjectIds())); eventPublisher.publish(new AnalysisResultDeletedEvent(event.getAnalysisResultObjectIds()));
} }
@Subscribe
public void publishBlackboardArtifactTagDeleted(TskEvent.BlackboardArtifactTagsDeletedTskEvent event) {
List<BlackboardArtifactTag> tags = event.getTags();
for(BlackboardArtifactTag tag: tags) {
eventPublisher.publish(new BlackBoardArtifactTagDeletedEvent(tag));
}
}
@Subscribe
public void publishBlackboardTagAdded(TskEvent.BlackboardArtifactTagsAddedTskEvent event) {
List<BlackboardArtifactTag> tags = event.getTags();
for(BlackboardArtifactTag tag: tags) {
eventPublisher.publish(new BlackBoardArtifactTagAddedEvent(tag));
}
}
@Subscribe
public void publishContentTagAdded(TskEvent.ContentTagsAddedTskEvent event) {
List<ContentTag> tags = event.getTags();
for(ContentTag tag: tags) {
eventPublisher.publish(new ContentTagAddedEvent(tag));
}
}
@Subscribe
public void publishContentTagDeleted(TskEvent.ContentTagsDeletedTskEvent event) {
List<ContentTag> tags = event.getTags();
for(ContentTag tag: tags) {
eventPublisher.publish(new ContentTagDeletedEvent(tag));
}
}
} }
/** /**
@ -1820,41 +1852,6 @@ public class Case {
eventPublisher.publish(new DataSourceNameChangedEvent(dataSource, newName)); eventPublisher.publish(new DataSourceNameChangedEvent(dataSource, newName));
} }
/**
* Notifies case event subscribers that a content tag has been added.
*
* This should not be called from the event dispatch thread (EDT)
*
* @param newTag new ContentTag added
*/
public void notifyContentTagAdded(ContentTag newTag) {
notifyContentTagAdded(newTag, null);
}
/**
* Notifies case event subscribers that a content tag has been added.
*
* This should not be called from the event dispatch thread (EDT)
*
* @param newTag The added ContentTag.
* @param deletedTagList List of ContentTags that were removed as a result
* of the addition of newTag.
*/
public void notifyContentTagAdded(ContentTag newTag, List<ContentTag> deletedTagList) {
eventPublisher.publish(new ContentTagAddedEvent(newTag, deletedTagList));
}
/**
* Notifies case event subscribers that a content tag has been deleted.
*
* This should not be called from the event dispatch thread (EDT)
*
* @param deletedTag ContentTag deleted
*/
public void notifyContentTagDeleted(ContentTag deletedTag) {
eventPublisher.publish(new ContentTagDeletedEvent(deletedTag));
}
/** /**
* Notifies case event subscribers that a tag definition has changed. * Notifies case event subscribers that a tag definition has changed.
* *
@ -1885,41 +1882,6 @@ public class Case {
} }
} }
/**
* Notifies case event subscribers that an artifact tag has been added.
*
* This should not be called from the event dispatch thread (EDT)
*
* @param newTag new BlackboardArtifactTag added
*/
public void notifyBlackBoardArtifactTagAdded(BlackboardArtifactTag newTag) {
notifyBlackBoardArtifactTagAdded(newTag, null);
}
/**
* Notifies case event subscribers that an artifact tag has been added.
*
* This should not be called from the event dispatch thread (EDT)
*
* @param newTag The added ContentTag.
* @param removedTagList List of ContentTags that were removed as a result
* of the addition of newTag.
*/
public void notifyBlackBoardArtifactTagAdded(BlackboardArtifactTag newTag, List<BlackboardArtifactTag> removedTagList) {
eventPublisher.publish(new BlackBoardArtifactTagAddedEvent(newTag, removedTagList));
}
/**
* Notifies case event subscribers that an artifact tag has been deleted.
*
* This should not be called from the event dispatch thread (EDT)
*
* @param deletedTag BlackboardArtifactTag deleted
*/
public void notifyBlackBoardArtifactTagDeleted(BlackboardArtifactTag deletedTag) {
eventPublisher.publish(new BlackBoardArtifactTagDeletedEvent(deletedTag));
}
/** /**
* Adds a report to the case. * Adds a report to the case.
* *

View File

@ -319,7 +319,7 @@ public class TagsManager implements Closeable {
} }
} }
for(TagName tagName: caseDb.getAllTagNames()) { for (TagName tagName : caseDb.getAllTagNames()) {
allTagNameMap.put(tagName.getDisplayName(), tagName); allTagNameMap.put(tagName.getDisplayName(), tagName);
} }
@ -636,14 +636,6 @@ public class TagsManager implements Closeable {
*/ */
public ContentTag addContentTag(Content content, TagName tagName, String comment, long beginByteOffset, long endByteOffset) throws TskCoreException { public ContentTag addContentTag(Content content, TagName tagName, String comment, long beginByteOffset, long endByteOffset) throws TskCoreException {
TaggingManager.ContentTagChange tagChange = caseDb.getTaggingManager().addContentTag(content, tagName, comment, beginByteOffset, endByteOffset); TaggingManager.ContentTagChange tagChange = caseDb.getTaggingManager().addContentTag(content, tagName, comment, beginByteOffset, endByteOffset);
try {
Case currentCase = Case.getCurrentCaseThrows();
currentCase.notifyContentTagAdded(tagChange.getAddedTag(), tagChange.getRemovedTags().isEmpty() ? null : tagChange.getRemovedTags());
} catch (NoCurrentCaseException ex) {
throw new TskCoreException("Added a tag to a closed case", ex);
}
return tagChange.getAddedTag(); return tagChange.getAddedTag();
} }
@ -657,11 +649,6 @@ public class TagsManager implements Closeable {
*/ */
public void deleteContentTag(ContentTag tag) throws TskCoreException { public void deleteContentTag(ContentTag tag) throws TskCoreException {
caseDb.deleteContentTag(tag); caseDb.deleteContentTag(tag);
try {
Case.getCurrentCaseThrows().notifyContentTagDeleted(tag);
} catch (NoCurrentCaseException ex) {
throw new TskCoreException("Deleted a tag from a closed case", ex);
}
} }
/** /**
@ -857,12 +844,6 @@ public class TagsManager implements Closeable {
*/ */
public BlackboardArtifactTag addBlackboardArtifactTag(BlackboardArtifact artifact, TagName tagName, String comment) throws TskCoreException { public BlackboardArtifactTag addBlackboardArtifactTag(BlackboardArtifact artifact, TagName tagName, String comment) throws TskCoreException {
TaggingManager.BlackboardArtifactTagChange tagChange = caseDb.getTaggingManager().addArtifactTag(artifact, tagName, comment); TaggingManager.BlackboardArtifactTagChange tagChange = caseDb.getTaggingManager().addArtifactTag(artifact, tagName, comment);
try {
Case currentCase = Case.getCurrentCaseThrows();
currentCase.notifyBlackBoardArtifactTagAdded(tagChange.getAddedTag(), tagChange.getRemovedTags().isEmpty() ? null : tagChange.getRemovedTags());
} catch (NoCurrentCaseException ex) {
throw new TskCoreException("Added a tag to a closed case", ex);
}
return tagChange.getAddedTag(); return tagChange.getAddedTag();
} }
@ -876,11 +857,6 @@ public class TagsManager implements Closeable {
*/ */
public void deleteBlackboardArtifactTag(BlackboardArtifactTag tag) throws TskCoreException { public void deleteBlackboardArtifactTag(BlackboardArtifactTag tag) throws TskCoreException {
caseDb.deleteBlackboardArtifactTag(tag); caseDb.deleteBlackboardArtifactTag(tag);
try {
Case.getCurrentCaseThrows().notifyBlackBoardArtifactTagDeleted(tag);
} catch (NoCurrentCaseException ex) {
throw new TskCoreException("Deleted a tag from a closed case", ex);
}
} }
/** /**