mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
KeyValue classes added to DataModel
This commit is contained in:
parent
f6e029935d
commit
2bad9d1603
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
package org.sleuthkit.autopsy.datamodel;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import org.openide.nodes.AbstractNode;
|
||||||
|
import org.openide.nodes.Children;
|
||||||
|
import org.openide.nodes.Sheet;
|
||||||
|
|
||||||
|
public class KeyValueNode extends AbstractNode {
|
||||||
|
|
||||||
|
KeyValueThing thing;
|
||||||
|
|
||||||
|
public KeyValueNode(KeyValueThing thing, Children children) {
|
||||||
|
super(children);
|
||||||
|
this.setName(thing.getName());
|
||||||
|
this.thing = thing;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Sheet createSheet() {
|
||||||
|
Sheet s = super.createSheet();
|
||||||
|
Sheet.Set ss = s.get(Sheet.PROPERTIES);
|
||||||
|
if (ss == null) {
|
||||||
|
ss = Sheet.createPropertiesSet();
|
||||||
|
s.put(ss);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map.Entry<String, Object> entry : thing.getMap().entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
ss.put(new NodeProperty(key, key, "n/a", value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package org.sleuthkit.autopsy.datamodel;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class KeyValueThing {
|
||||||
|
Map<String, Object> map;
|
||||||
|
int id;
|
||||||
|
String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param map must iterate it keys and values in a consistent order
|
||||||
|
* (use of LinkedHashMap is recommended)
|
||||||
|
* @param id an arbitrary id representing the type of the thing
|
||||||
|
*/
|
||||||
|
public KeyValueThing(String name, Map<String, Object> map, int id) {
|
||||||
|
this.name = name;
|
||||||
|
this.map = map;
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getMap() {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user