mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 02:07:42 +00:00
Remove legacy unused GUI code
This commit is contained in:
parent
fc16cbf14f
commit
d851e45aa9
@ -19,7 +19,6 @@
|
||||
package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.swing.Action;
|
||||
import org.openide.nodes.FilterNode;
|
||||
@ -27,7 +26,6 @@ import org.openide.nodes.Node;
|
||||
import org.openide.nodes.Node.Property;
|
||||
import org.openide.nodes.PropertySupport;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.lookup.Lookups;
|
||||
import org.openide.util.lookup.ProxyLookup;
|
||||
import org.sleuthkit.autopsy.directorytree.ExternalViewerAction;
|
||||
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Node;
|
||||
import org.sleuthkit.autopsy.datamodel.RootContentChildren;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
|
||||
/**
|
||||
* Root Node for keyword search results
|
||||
*/
|
||||
class KeywordSearchNode extends AbstractNode {
|
||||
|
||||
KeywordSearchNode(final Map<AbstractFile,Integer> keys, final String solrQuery) {
|
||||
|
||||
super(new RootContentChildren(new ArrayList(keys.keySet())) {
|
||||
|
||||
@Override
|
||||
protected Node[] createNodes(Object key) {
|
||||
Node[] originalNodes = super.createNodes(key);
|
||||
Node[] filterNodes = new Node[originalNodes.length];
|
||||
|
||||
// Use filter node to add a MarkupSource for the search results
|
||||
// to the lookup
|
||||
int i = 0;
|
||||
for (Node original : originalNodes) {
|
||||
HighlightedMatchesSource markup = new HighlightedMatchesSource((Content)key, solrQuery, false);
|
||||
int previewChunk = keys.get((AbstractFile)key);
|
||||
filterNodes[i++] = new KeywordSearchFilterNode(markup, original, solrQuery, previewChunk);
|
||||
}
|
||||
|
||||
return filterNodes;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -48,12 +48,6 @@ public interface KeywordSearchQuery {
|
||||
*/
|
||||
public void setFilter(KeywordQueryFilter filter);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* execute the query and publish results
|
||||
*/
|
||||
public void execute();
|
||||
|
||||
/**
|
||||
* escape the query string and use the escaped string in the query
|
||||
|
@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.keywordsearch;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
@ -34,12 +33,7 @@ import org.apache.solr.client.solrj.response.QueryResponse;
|
||||
import org.apache.solr.client.solrj.response.TermsResponse.Term;
|
||||
import org.apache.solr.common.SolrDocument;
|
||||
import org.apache.solr.common.SolrDocumentList;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.windows.TopComponent;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent;
|
||||
import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
|
||||
import org.sleuthkit.autopsy.keywordsearch.KeywordSearchResultFactory.ResultWriter;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
@ -118,41 +112,6 @@ public class LuceneQuery implements KeywordSearchQuery {
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
escape();
|
||||
|
||||
final Map<String, List<ContentHit>> matches;
|
||||
|
||||
try {
|
||||
matches = performQuery();
|
||||
} catch (NoOpenCoreException ex) {
|
||||
return;
|
||||
}
|
||||
|
||||
String pathText = "Keyword query: " + query;
|
||||
|
||||
if (matches.isEmpty()) {
|
||||
KeywordSearchUtil.displayDialog("Keyword Search", "No results for keyword: " + query, KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||
return;
|
||||
}
|
||||
|
||||
//map of unique fs hit and chunk id or 0
|
||||
LinkedHashMap<AbstractFile, Integer> fsMatches = ContentHit.flattenResults(matches);
|
||||
|
||||
//get listname
|
||||
String listName = "";
|
||||
|
||||
Node rootNode = new KeywordSearchNode(fsMatches, queryEscaped);
|
||||
Node filteredRootNode = new TableFilterNode(rootNode, true);
|
||||
|
||||
TopComponent searchResultWin = DataResultTopComponent.createInstance("Keyword search", pathText, filteredRootNode, matches.size());
|
||||
searchResultWin.requestActive(); // make it the active top component
|
||||
|
||||
//write to bb
|
||||
new ResultWriter(matches, this, listName).execute();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
|
@ -262,101 +262,5 @@ public class TermComponentQuery implements KeywordSearchQuery {
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
SolrQuery q = createQuery();
|
||||
|
||||
logger.log(Level.INFO, "Executing TermsComponent query: " + q.toString());
|
||||
|
||||
final SwingWorker<List<Term>, Void> worker = new TermsQueryWorker(q);
|
||||
worker.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* map Terms to generic Nodes with key/value pairs properties
|
||||
* @param terms
|
||||
*/
|
||||
private void publishNodes(List<Term> terms) {
|
||||
|
||||
Collection<KeyValueQuery> things = new ArrayList<KeyValueQuery>();
|
||||
|
||||
Iterator<Term> it = terms.iterator();
|
||||
int termID = 0;
|
||||
//long totalMatches = 0;
|
||||
while (it.hasNext()) {
|
||||
Term term = it.next();
|
||||
Map<String, Object> kvs = new LinkedHashMap<String, Object>();
|
||||
//long matches = term.getFrequency();
|
||||
final String match = term.getTerm();
|
||||
KeywordSearchResultFactory.setCommonProperty(kvs, KeywordSearchResultFactory.CommonPropertyTypes.MATCH, match);
|
||||
//setCommonProperty(kvs, CommonPropertyTypes.MATCH_RANK, Long.toString(matches));
|
||||
//things.add(new KeyValue(match, kvs, ++termID));
|
||||
things.add(new KeyValueQuery(match, kvs, ++termID, this));
|
||||
//totalMatches += matches;
|
||||
}
|
||||
|
||||
Node rootNode = null;
|
||||
if (things.size() > 0) {
|
||||
Children childThingNodes =
|
||||
Children.create(new KeywordSearchResultFactory(new Keyword(termsQuery, false), things, Presentation.DETAIL), true);
|
||||
|
||||
rootNode = new AbstractNode(childThingNodes);
|
||||
} else {
|
||||
rootNode = Node.EMPTY;
|
||||
}
|
||||
|
||||
final String pathText = "Term query";
|
||||
// String pathText = "RegEx query: " + termsQuery
|
||||
//+ " Files with exact matches: " + Long.toString(totalMatches) + " (also listing approximate matches)";
|
||||
|
||||
TopComponent searchResultWin = DataResultTopComponent.createInstance("Keyword search", pathText, rootNode, things.size());
|
||||
searchResultWin.requestActive(); // make it the active top component
|
||||
|
||||
}
|
||||
|
||||
class TermsQueryWorker extends SwingWorker<List<Term>, Void> {
|
||||
|
||||
private SolrQuery q;
|
||||
private ProgressHandle progress;
|
||||
|
||||
TermsQueryWorker(SolrQuery q) {
|
||||
this.q = q;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Term> doInBackground() throws Exception {
|
||||
progress = ProgressHandleFactory.createHandle("Terms query task");
|
||||
progress.start();
|
||||
progress.progress("Running Terms query.");
|
||||
|
||||
terms = executeQuery(q);
|
||||
|
||||
progress.progress("Terms query completed.");
|
||||
|
||||
return terms;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
if (!this.isCancelled()) {
|
||||
try {
|
||||
List<Term> terms = get();
|
||||
if (terms.isEmpty()) {
|
||||
KeywordSearchUtil.displayDialog("Keyword Search", "No results for regex search: " + termsQuery, KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||
|
||||
} else {
|
||||
publishNodes(terms);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
logger.log(Level.INFO, "Exception while executing regex query,", e);
|
||||
|
||||
} catch (ExecutionException e) {
|
||||
logger.log(Level.INFO, "Exception while executing regex query,", e);
|
||||
} finally {
|
||||
progress.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user