mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Added counts to tag sub-tree nodes
This commit is contained in:
parent
3ef3ce3da2
commit
4cd68f99a1
@ -227,6 +227,21 @@ public class TagsManager implements Closeable {
|
||||
tskCase.deleteContentTag(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets content tags count by tag name.
|
||||
* @param [in] tagName The tag name of interest.
|
||||
* @return A count of the content tags with the specified tag name.
|
||||
* @throws TskCoreException
|
||||
*/
|
||||
public synchronized long getContentTagsCountByTagName(TagName tagName) throws TskCoreException {
|
||||
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
|
||||
if (!tagNamesInitialized) {
|
||||
getExistingTagNames();
|
||||
}
|
||||
|
||||
return tskCase.getContentTagsCountByTagName(tagName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets content tags by tag name.
|
||||
* @param [in] tagName The tag name of interest.
|
||||
@ -282,6 +297,21 @@ public class TagsManager implements Closeable {
|
||||
tskCase.deleteBlackboardArtifactTag(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blackboard artifact tags count by tag name.
|
||||
* @param [in] tagName The tag name of interest.
|
||||
* @return A count of the blackboard artifact tags with the specified tag name.
|
||||
* @throws TskCoreException
|
||||
*/
|
||||
public synchronized long getBlackboardArtifactTagsCountByTagName(TagName tagName) throws TskCoreException {
|
||||
// @@@ This is a work around to be removed when database access on the EDT is correctly synchronized.
|
||||
if (!tagNamesInitialized) {
|
||||
getExistingTagNames();
|
||||
}
|
||||
|
||||
return tskCase.getBlackboardArtifactTagsCountByTagName(tagName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blackboard artifact tags by tag name.
|
||||
* @param [in] tagName The tag name of interest.
|
||||
|
@ -41,8 +41,17 @@ public class ContentTagTypeNode extends DisplayableItemNode {
|
||||
|
||||
public ContentTagTypeNode(TagName tagName) {
|
||||
super(Children.create(new ContentTagNodeFactory(tagName), true));
|
||||
super.setName(DISPLAY_NAME);
|
||||
super.setDisplayName(DISPLAY_NAME);
|
||||
|
||||
long tagsCount = 0;
|
||||
try {
|
||||
tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(ContentTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get content tags count for " + tagName.getDisplayName() + " tag name", ex);
|
||||
}
|
||||
|
||||
super.setName(DISPLAY_NAME + " (" + tagsCount + ")");
|
||||
super.setDisplayName(DISPLAY_NAME + " (" + tagsCount + ")");
|
||||
this.setIconBaseWithExtension(ICON_PATH);
|
||||
}
|
||||
|
||||
|
@ -19,12 +19,16 @@
|
||||
package org.sleuthkit.autopsy.datamodel;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.nodes.ChildFactory;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.directorytree.BlackboardArtifactTagTypeNode;
|
||||
import org.sleuthkit.datamodel.TagName;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* Instances of this class are elements of Node hierarchies consisting of
|
||||
@ -32,8 +36,6 @@ import org.sleuthkit.datamodel.TagName;
|
||||
* tag name.
|
||||
*/
|
||||
public class TagNameNode extends DisplayableItemNode {
|
||||
private static final String CONTENT_TAG_TYPE_NODE_KEY = "Content Tags";
|
||||
private static final String BLACKBOARD_ARTIFACT_TAG_TYPE_NODE_KEY = "Result Tags";
|
||||
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
|
||||
private static final String BOOKMARK_TAG_ICON_PATH = "org/sleuthkit/autopsy/images/star-bookmark-icon-16.png";
|
||||
private final TagName tagName;
|
||||
@ -41,8 +43,18 @@ public class TagNameNode extends DisplayableItemNode {
|
||||
public TagNameNode(TagName tagName) {
|
||||
super(Children.create(new TagTypeNodeFactory(tagName), true));
|
||||
this.tagName = tagName;
|
||||
super.setName(tagName.getDisplayName());
|
||||
super.setDisplayName(tagName.getDisplayName());
|
||||
|
||||
long tagsCount = 0;
|
||||
try {
|
||||
tagsCount = Case.getCurrentCase().getServices().getTagsManager().getContentTagsCountByTagName(tagName);
|
||||
tagsCount += Case.getCurrentCase().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(TagNameNode.class.getName()).log(Level.SEVERE, "Failed to get tags count for " + tagName.getDisplayName() + " tag name", ex);
|
||||
}
|
||||
|
||||
super.setName(tagName.getDisplayName() + " (" + tagsCount + ")");
|
||||
super.setDisplayName(tagName.getDisplayName() + " (" + tagsCount + ")");
|
||||
if (tagName.getDisplayName().equals("Bookmark")) {
|
||||
setIconBaseWithExtension(BOOKMARK_TAG_ICON_PATH);
|
||||
}
|
||||
@ -78,6 +90,8 @@ public class TagNameNode extends DisplayableItemNode {
|
||||
}
|
||||
|
||||
private static class TagTypeNodeFactory extends ChildFactory<String> {
|
||||
private static final String CONTENT_TAG_TYPE_NODE_KEY = "Content Tags";
|
||||
private static final String BLACKBOARD_ARTIFACT_TAG_TYPE_NODE_KEY = "Result Tags";
|
||||
private final TagName tagName;
|
||||
|
||||
TagTypeNodeFactory(TagName tagName) {
|
||||
|
@ -42,12 +42,21 @@ import org.sleuthkit.datamodel.TskCoreException;
|
||||
*/
|
||||
public class BlackboardArtifactTagTypeNode extends DisplayableItemNode {
|
||||
private static final String DISPLAY_NAME = "Result Tags";
|
||||
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; // RJCTODO: Different icon?
|
||||
private static final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png";
|
||||
|
||||
public BlackboardArtifactTagTypeNode(TagName tagName) {
|
||||
super(Children.create(new BlackboardArtifactTagNodeFactory(tagName), true));
|
||||
super.setName(DISPLAY_NAME);
|
||||
super.setDisplayName(DISPLAY_NAME);
|
||||
|
||||
long tagsCount = 0;
|
||||
try {
|
||||
tagsCount = Case.getCurrentCase().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(BlackboardArtifactTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get blackboard artifact tags count for " + tagName.getDisplayName() + " tag name", ex);
|
||||
}
|
||||
|
||||
super.setName(DISPLAY_NAME + " (" + tagsCount + ")");
|
||||
super.setDisplayName(DISPLAY_NAME + " (" + tagsCount + ")");
|
||||
this.setIconBaseWithExtension(ICON_PATH);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user