This commit is contained in:
Greg DiCristofaro 2022-02-16 15:09:59 -05:00
parent 822d79f573
commit d15bbdfb81
5 changed files with 41 additions and 29 deletions

View File

@ -91,12 +91,6 @@ public interface DisplayableItemNodeVisitor<T> {
*/ */
T visit(Tags.RootNode node); T visit(Tags.RootNode node);
T visit(Tags.TagNameNode node);
T visit(Tags.ContentTagTypeNode node);
T visit(Tags.BlackboardArtifactTagTypeNode node);
/* /*
* Reports * Reports
@ -270,21 +264,6 @@ public interface DisplayableItemNodeVisitor<T> {
return defaultVisit(node); return defaultVisit(node);
} }
@Override
public T visit(Tags.TagNameNode node) {
return defaultVisit(node);
}
@Override
public T visit(Tags.ContentTagTypeNode node) {
return defaultVisit(node);
}
@Override
public T visit(Tags.BlackboardArtifactTagTypeNode node) {
return defaultVisit(node);
}
@Override @Override
public T visit(Reports.ReportsListNode node) { public T visit(Reports.ReportsListNode node) {
return defaultVisit(node); return defaultVisit(node);

View File

@ -97,7 +97,7 @@ public class RootContentChildren extends Children.Keys<Object> {
public static Node createNode(Object key) { public static Node createNode(Object key) {
if (key instanceof Tags) { if (key instanceof Tags) {
Tags tagsNodeKey = (Tags) key; Tags tagsNodeKey = (Tags) key;
return tagsNodeKey.new RootNode(tagsNodeKey.filteringDataSourceObjId()); return new Tags.RootNode(tagsNodeKey.filteringDataSourceObjId());
} else if (key instanceof DataSources) { } else if (key instanceof DataSources) {
DataSources dataSourcesKey = (DataSources) key; DataSources dataSourcesKey = (DataSources) key;
return new DataSourceFilesNode(dataSourcesKey.filteringDataSourceObjId()); return new DataSourceFilesNode(dataSourcesKey.filteringDataSourceObjId());

View File

@ -31,6 +31,30 @@ import org.sleuthkit.autopsy.mainui.nodes.TagNameFactory;
* factory built on top of the NetBeans Children.Keys class. * factory built on top of the NetBeans Children.Keys class.
*/ */
public class Tags { public class Tags {
private final static String DISPLAY_NAME = NbBundle.getMessage(RootNode.class, "TagsNode.displayName.text");
private final long filteringDSObjId; // 0 if not filtering/grouping by data source
Tags() {
this(0);
}
Tags(long dsObjId) {
this.filteringDSObjId = dsObjId;
}
/**
* Return the display name used by the tags node in the tree.
*
* @return - DISPLAY_NAME
*/
public static String getTagsDisplayName() {
return DISPLAY_NAME;
}
long filteringDataSourceObjId() {
return this.filteringDSObjId;
}
/** /**
* Instances of this class are the root nodes of tree that is a sub-tree of * Instances of this class are the root nodes of tree that is a sub-tree of
* the Autopsy presentation of the SleuthKit data model. The sub-tree * the Autopsy presentation of the SleuthKit data model. The sub-tree
@ -38,16 +62,16 @@ public class Tags {
* type, then by tag name. * type, then by tag name.
*/ */
public static class RootNode extends DisplayableItemNode { public static class RootNode extends DisplayableItemNode {
private final static String DISPLAY_NAME = NbBundle.getMessage(RootNode.class, "TagsNode.displayName.text");
private final static String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; //NON-NLS private final static String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; //NON-NLS
private final Long dataSourceObjId; private final Long dataSourceObjId;
public RootNode(Long dsId) { public RootNode(Long dsId) {
super(Children.create(new TagNameFactory(dsId > 0 ? dsId : null), true), Lookups.singleton(DISPLAY_NAME)); super(Children.create(new TagNameFactory(dsId != null && dsId> 0 ? dsId : null), true), Lookups.singleton(DISPLAY_NAME));
super.setName(DISPLAY_NAME); super.setName(DISPLAY_NAME);
super.setDisplayName(DISPLAY_NAME); super.setDisplayName(DISPLAY_NAME);
this.setIconBaseWithExtension(ICON_PATH); this.setIconBaseWithExtension(ICON_PATH);
this.dataSourceObjId = dsId > 0 ? dsId : null; this.dataSourceObjId = dsId != null && dsId> 0 ? dsId : null;
} }
@Override @Override
@ -81,5 +105,12 @@ public class Tags {
public Node clone() { public Node clone() {
return new RootNode(dataSourceObjId); return new RootNode(dataSourceObjId);
} }
/**
* Cause the contents of the RootNode and its children to be updated.
*/
public void refresh() {
this.refresh();
}
} }
} }

View File

@ -117,3 +117,5 @@ TagsDAO.tagColumns.sourceNameColLbl=Source Name
TagsDAO.tagColumns.sourcePathColLbl=Source File Path TagsDAO.tagColumns.sourcePathColLbl=Source File Path
TagsDAO.tagColumns.typeColLbl=Result Type TagsDAO.tagColumns.typeColLbl=Result Type
TagsDAO.tagColumns.userNameColLbl=User Name TagsDAO.tagColumns.userNameColLbl=User Name
TagType_File_displayName=File Tags
TagType_Result_displayName=Result Tags

View File

@ -361,9 +361,9 @@ public class TagsDAO extends AbstractDAO {
Collection<TagsEvent> daoEvents = Collections.singletonList(data); Collection<TagsEvent> daoEvents = Collections.singletonList(data);
Collection<TreeEvent> treeEvents = this.treeCounts.enqueueAll(daoEvents).stream() Collection<TreeEvent> treeEvents = daoEvents.stream()
.map(arEvt -> new TreeEvent(getTreeItem(arEvt, TreeResultsDTO.TreeDisplayCount.INDETERMINATE), false)) .map(arEvt -> new TreeEvent(getTreeItem(arEvt, TreeResultsDTO.TreeDisplayCount.UNSPECIFIED), true))
.collect(Collectors.toList()); .collect(Collectors.toSet());
return Stream.of(daoEvents, treeEvents) return Stream.of(daoEvents, treeEvents)
.flatMap(lst -> lst.stream()) .flatMap(lst -> lst.stream())
@ -610,7 +610,7 @@ public class TagsDAO extends AbstractDAO {
return new TreeItemDTO<>( return new TreeItemDTO<>(
TagsSearchParams.getTypeId(), TagsSearchParams.getTypeId(),
new TagsSearchParams(tagName, tagType, dataSourceId), new TagsSearchParams(tagName, tagType, dataSourceId),
tagName.getId(), tagName.getId() + "_" + tagType.name(),
tagType.getDisplayName(), tagType.getDisplayName(),
treeDisplayCount treeDisplayCount
); );