Keyword Hits Directory Node design changes

This commit is contained in:
Dick Fickling 2012-03-07 17:12:28 -05:00
parent 62083d9306
commit 960f96366b

View File

@ -219,20 +219,21 @@ public class KeywordHits implements AutopsyVisitableItem {
@Override @Override
protected Node createNodeForKey(String key) { protected Node createNodeForKey(String key) {
if(key.equals(SIMPLE_LITERAL_SEARCH) || key.equals(SIMPLE_REGEX_SEARCH)){ if(key.equals(SIMPLE_LITERAL_SEARCH) || key.equals(SIMPLE_REGEX_SEARCH)){
return new KeywordHitsMultiLevelNode(key); return new KeywordHitsMultiLevelNode(key, artifactMaps.get(key));
}else }else
return new KeywordHitsSetNode(key, listMap); return new KeywordHitsSetNode(key, listMap.get(key));
} }
} }
public class KeywordHitsMultiLevelNode extends AbstractNode implements DisplayableItemNode { public class KeywordHitsMultiLevelNode extends AbstractNode implements DisplayableItemNode {
String key; String name;
public KeywordHitsMultiLevelNode(String key) { Map<String, Set<Long>> map;
super(Children.create(new KeywordHitsMultiLevelChildren(key), true), Lookups.singleton(key)); public KeywordHitsMultiLevelNode(String name, Map<String, Set<Long>> map) {
super.setName(key); super(Children.create(new KeywordHitsMultiLevelChildren(map), true), Lookups.singleton(name));
super.setDisplayName(key + " (" + artifactMaps.get(key).size() + ")"); super.setName(name);
this.key = key; super.setDisplayName(name + " (" +map.size() + ")");
this.name = name;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword-search-icon.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword-search-icon.png");
} }
@ -248,13 +249,13 @@ public class KeywordHits implements AutopsyVisitableItem {
ss.put(new NodeProperty("List Name", ss.put(new NodeProperty("List Name",
"List Name", "List Name",
"no description", "no description",
key)); name));
ss.put(new NodeProperty("Number of Children", ss.put(new NodeProperty("Number of Children",
"Number of Children", "Number of Children",
"no description", "no description",
artifactMaps.get(key).size())); map.size()));
return s; return s;
} }
@ -268,35 +269,35 @@ public class KeywordHits implements AutopsyVisitableItem {
class KeywordHitsMultiLevelChildren extends ChildFactory<String> { class KeywordHitsMultiLevelChildren extends ChildFactory<String> {
String key; Map<String, Set<Long>> map;
KeywordHitsMultiLevelChildren(String key) { KeywordHitsMultiLevelChildren(Map<String, Set<Long>> map) {
super(); super();
this.key = key; this.map = map;
} }
@Override @Override
protected boolean createKeys(List<String> list) { protected boolean createKeys(List<String> list) {
list.addAll(artifactMaps.get(this.key).keySet()); list.addAll(map.keySet());
return true; return true;
} }
@Override @Override
protected Node createNodeForKey(String key) { protected Node createNodeForKey(String key) {
return new KeywordHitsSetNode(key, artifactMaps.get(this.key)); return new KeywordHitsSetNode(key, map.get(key));
} }
} }
public class KeywordHitsSetNode extends AbstractNode implements DisplayableItemNode { public class KeywordHitsSetNode extends AbstractNode implements DisplayableItemNode {
String setName; String setName;
Map<String, Set<Long>> parent; Set<Long> artifacts;
public KeywordHitsSetNode(String child, Map<String, Set<Long>> parent) { public KeywordHitsSetNode(String name, Set<Long> artifacts) {
super(Children.create(new KeywordHitsSetChildren(child, parent), true), Lookups.singleton(child)); super(Children.create(new KeywordHitsSetChildren(name, artifacts), true), Lookups.singleton(name));
super.setName(child); super.setName(name);
super.setDisplayName(child + " (" + parent.get(child).size() + ")"); super.setDisplayName(name + " (" + artifacts.size() + ")");
setName = child; setName = name;
this.parent = parent; this.artifacts = artifacts;
this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword-search-icon.png"); this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/keyword-search-icon.png");
} }
@ -323,7 +324,7 @@ public class KeywordHits implements AutopsyVisitableItem {
ss.put(new NodeProperty("Number of Hits", ss.put(new NodeProperty("Number of Hits",
"Number of Hits", "Number of Hits",
"no description", "no description",
parent.get(setName).size())); artifacts.size()));
return s; return s;
} }
@ -332,16 +333,16 @@ public class KeywordHits implements AutopsyVisitableItem {
class KeywordHitsSetChildren extends ChildFactory<BlackboardArtifact> { class KeywordHitsSetChildren extends ChildFactory<BlackboardArtifact> {
String setName; String setName;
Map<String, Set<Long>> parent; Set<Long> artifacts;
KeywordHitsSetChildren(String child, Map<String, Set<Long>> parent) { KeywordHitsSetChildren(String child, Set<Long> artifacts) {
super(); super();
this.setName = child; this.setName = child;
this.parent = parent; this.artifacts = artifacts;
} }
@Override @Override
protected boolean createKeys(List<BlackboardArtifact> list) { protected boolean createKeys(List<BlackboardArtifact> list) {
for (long l : parent.get(setName)) { for (long l :artifacts) {
try { try {
//TODO: bulk artifact gettings //TODO: bulk artifact gettings
list.add(skCase.getBlackboardArtifact(l)); list.add(skCase.getBlackboardArtifact(l));