mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Add parent node to results containing query.
This commit is contained in:
parent
777ed02452
commit
accf9a6133
@ -159,7 +159,7 @@ public class KeywordSearchSimpleTopComponent extends TopComponent implements Key
|
||||
* Overwrite when you want to change default persistence type. Default
|
||||
* persistence type is PERSISTENCE_ALWAYS
|
||||
*
|
||||
* @return TopComponent.PERSISTENCE_ALWAYS
|
||||
* @return TopComponent.PERSISTENCE_NEVER
|
||||
*/
|
||||
@Override
|
||||
public int getPersistenceType() {
|
||||
|
@ -122,7 +122,7 @@ public class RegexQuery implements KeywordSearchQuery {
|
||||
Node rootNode = null;
|
||||
if (things.size() > 0) {
|
||||
Children childThingNodes =
|
||||
Children.create(new RegexResultChildFactory(things), true);
|
||||
Children.create(new RegexResultQueryChildFactory(regexQuery, things), true);
|
||||
|
||||
rootNode = new AbstractNode(childThingNodes);
|
||||
} else {
|
||||
@ -137,6 +137,44 @@ public class RegexQuery implements KeywordSearchQuery {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* factory produces top level result nodes showing query used
|
||||
*/
|
||||
class RegexResultQueryChildFactory extends ChildFactory<KeyValueThing> {
|
||||
|
||||
Collection<String> queries;
|
||||
Collection<KeyValueThing> things;
|
||||
|
||||
|
||||
RegexResultQueryChildFactory(Collection<String>queries, Collection<KeyValueThing> things) {
|
||||
this.queries = queries;
|
||||
this.things = things;
|
||||
}
|
||||
|
||||
RegexResultQueryChildFactory(String query, Collection<KeyValueThing> things) {
|
||||
queries = new ArrayList<String>();
|
||||
queries.add(query);
|
||||
this.things = things;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean createKeys(List<KeyValueThing> toPopulate) {
|
||||
int id = 0;
|
||||
for (String query : queries) {
|
||||
LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>();
|
||||
map.put("Query", query);
|
||||
toPopulate.add(new KeyValueThing(query, map, ++id));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node createNodeForKey(KeyValueThing thing) {
|
||||
return new KeyValueNode(thing, Children.create(new RegexResultChildFactory(things), true));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* factory produces top level result nodes showing *exact* regex match result
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user