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
|
* Overwrite when you want to change default persistence type. Default
|
||||||
* persistence type is PERSISTENCE_ALWAYS
|
* persistence type is PERSISTENCE_ALWAYS
|
||||||
*
|
*
|
||||||
* @return TopComponent.PERSISTENCE_ALWAYS
|
* @return TopComponent.PERSISTENCE_NEVER
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getPersistenceType() {
|
public int getPersistenceType() {
|
||||||
|
@ -120,9 +120,9 @@ public class RegexQuery implements KeywordSearchQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Node rootNode = null;
|
Node rootNode = null;
|
||||||
if (things.size() > 0) {
|
if (things.size() > 0) {
|
||||||
Children childThingNodes =
|
Children childThingNodes =
|
||||||
Children.create(new RegexResultChildFactory(things), true);
|
Children.create(new RegexResultQueryChildFactory(regexQuery, things), true);
|
||||||
|
|
||||||
rootNode = new AbstractNode(childThingNodes);
|
rootNode = new AbstractNode(childThingNodes);
|
||||||
} else {
|
} else {
|
||||||
@ -136,6 +136,44 @@ public class RegexQuery implements KeywordSearchQuery {
|
|||||||
searchResultWin.requestActive(); // make it the active top component
|
searchResultWin.requestActive(); // make it the active top component
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* factory produces top level result nodes showing *exact* regex match result
|
||||||
|
Loading…
x
Reference in New Issue
Block a user