mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 00:16:16 +00:00
Wrapper Child factory in callable to further delay execution. Still doesn't make Search lazy since DataResultFilterNode will gather all children and do lookups which triggers the children queries.
This commit is contained in:
parent
71ab71410c
commit
fecfc8df70
@ -22,6 +22,7 @@ package org.sleuthkit.autopsy.datamodel;
|
|||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.openide.nodes.ChildFactory;
|
import org.openide.nodes.ChildFactory;
|
||||||
import org.openide.nodes.Children;
|
import org.openide.nodes.Children;
|
||||||
@ -53,16 +54,33 @@ public class Md5Node extends DisplayableItemNode {
|
|||||||
private final String dataSources;
|
private final String dataSources;
|
||||||
|
|
||||||
public Md5Node(Md5Metadata data) {
|
public Md5Node(Md5Metadata data) {
|
||||||
super(Children.create(
|
super(Children.createLazy(new Md5ChildCallable(data)), Lookups.singleton(data.getMd5()));
|
||||||
new FileInstanceNodeFactory(data), true),
|
|
||||||
Lookups.singleton(data.getMd5()));
|
|
||||||
|
|
||||||
this.commonFileCount = data.size();
|
this.commonFileCount = data.size();
|
||||||
this.dataSources = String.join(", ", data.getDataSources());
|
this.dataSources = String.join(", ", data.getDataSources());
|
||||||
this.md5Hash = data.getMd5();
|
this.md5Hash = data.getMd5();
|
||||||
|
|
||||||
this.setDisplayName(this.md5Hash);
|
this.setDisplayName(this.md5Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class Md5ChildCallable implements Callable<Children> {
|
||||||
|
private final Md5Metadata key;
|
||||||
|
private Md5ChildCallable(Md5Metadata key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Children call() throws Exception {
|
||||||
|
//Check, somehow, that your key has children,
|
||||||
|
//e.g., create "hasChildren" on the object
|
||||||
|
//to look in the database to see whether
|
||||||
|
//the object has children;
|
||||||
|
//if it doesn't have children, return a leaf:
|
||||||
|
if (key.getMetadata().isEmpty()) {
|
||||||
|
return Children.LEAF;
|
||||||
|
} else {
|
||||||
|
return Children.create(new FileInstanceNodeFactory(key), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int getCommonFileCount() {
|
int getCommonFileCount() {
|
||||||
return this.commonFileCount;
|
return this.commonFileCount;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user