mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Remove ContentNode stuff (runs now)
This commit is contained in:
parent
9fa01015a4
commit
1a122c97ec
@ -76,6 +76,6 @@ public interface DataContentViewer {
|
||||
* as determined by a previous check
|
||||
* @return True if viewer preferred, else false
|
||||
*/
|
||||
public boolean isPreferred(ContentNode node, boolean isSupported);
|
||||
public boolean isPreferred(Node node, boolean isSupported);
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import java.awt.Cursor;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
@ -99,7 +98,7 @@ public final class DataContentTopComponent extends TopComponent implements DataC
|
||||
return this.wrapped.isSupported(node);
|
||||
}
|
||||
|
||||
boolean isPreferred(ContentNode node, boolean isSupported) {
|
||||
boolean isPreferred(Node node, boolean isSupported) {
|
||||
return this.wrapped.isPreferred(node, isSupported);
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreferred(ContentNode node, boolean isSupported) {
|
||||
public boolean isPreferred(Node node, boolean isSupported) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class DataContentViewerPicture extends javax.swing.JPanel implements Data
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreferred(ContentNode node, boolean isSupported) {
|
||||
public boolean isPreferred(Node node, boolean isSupported) {
|
||||
return isSupported;
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ public class DataContentViewerString extends javax.swing.JPanel implements DataC
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreferred(ContentNode node, boolean isSupported) {
|
||||
public boolean isPreferred(Node node, boolean isSupported) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
|
||||
import org.sleuthkit.autopsy.datamodel.ContentNode;
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
|
||||
/**
|
||||
* Displays marked-up (HTML) content for a Node. The sources are all the
|
||||
@ -52,7 +52,7 @@ public class ExtractedContentViewer implements DataContentViewer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNode(final ContentNode selectedNode) {
|
||||
public void setNode(final Node selectedNode) {
|
||||
|
||||
// to clear the viewer
|
||||
if (selectedNode == null) {
|
||||
@ -64,7 +64,7 @@ public class ExtractedContentViewer implements DataContentViewer {
|
||||
// markup is fetched from solr
|
||||
List<MarkupSource> sources = new ArrayList<MarkupSource>();
|
||||
|
||||
sources.addAll(((Node) selectedNode).getLookup().lookupAll(MarkupSource.class));
|
||||
sources.addAll(selectedNode.getLookup().lookupAll(MarkupSource.class));
|
||||
|
||||
|
||||
if (solrHasContent(selectedNode)) {
|
||||
@ -141,18 +141,18 @@ public class ExtractedContentViewer implements DataContentViewer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(ContentNode node) {
|
||||
public boolean isSupported(Node node) {
|
||||
if (node == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Collection<? extends MarkupSource> sources = ((Node) node).getLookup().lookupAll(MarkupSource.class);
|
||||
Collection<? extends MarkupSource> sources = node.getLookup().lookupAll(MarkupSource.class);
|
||||
|
||||
return !sources.isEmpty() || solrHasContent(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreferred(ContentNode node, boolean isSupported) {
|
||||
public boolean isPreferred(Node node, boolean isSupported) {
|
||||
return isSupported;
|
||||
}
|
||||
|
||||
@ -172,11 +172,11 @@ public class ExtractedContentViewer implements DataContentViewer {
|
||||
* @param node
|
||||
* @return true if Solr has content, else false
|
||||
*/
|
||||
private boolean solrHasContent(ContentNode node) {
|
||||
private boolean solrHasContent(Node node) {
|
||||
Server.Core solrCore = KeywordSearch.getServer().getCore();
|
||||
SolrQuery q = new SolrQuery();
|
||||
q.setQuery("*:*");
|
||||
q.addFilterQuery("id:" + node.getContent().getId());
|
||||
q.addFilterQuery("id:" + node.getLookup().lookup(Content.class).getId());
|
||||
q.setFields("id");
|
||||
|
||||
try {
|
||||
@ -194,11 +194,11 @@ public class ExtractedContentViewer implements DataContentViewer {
|
||||
* @return the extracted content
|
||||
* @throws SolrServerException if something goes wrong
|
||||
*/
|
||||
private String getSolrContent(ContentNode cNode) throws SolrServerException {
|
||||
private String getSolrContent(Node node) throws SolrServerException {
|
||||
Server.Core solrCore = KeywordSearch.getServer().getCore();
|
||||
SolrQuery q = new SolrQuery();
|
||||
q.setQuery("*:*");
|
||||
q.addFilterQuery("id:" + cNode.getContent().getId());
|
||||
q.addFilterQuery("id:" + node.getLookup().lookup(Content.class).getId());
|
||||
q.setFields("content");
|
||||
|
||||
String content = (String) solrCore.query(q).getResults().get(0).getFieldValue("content");
|
||||
|
@ -23,13 +23,13 @@ import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.solr.client.solrj.SolrQuery;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||
import org.openide.nodes.FilterNode;
|
||||
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.lookup.Lookups;
|
||||
import org.openide.util.lookup.ProxyLookup;
|
||||
import org.sleuthkit.autopsy.datamodel.ContentFilterNode;
|
||||
import org.sleuthkit.autopsy.datamodel.ContentNode;
|
||||
import org.sleuthkit.autopsy.keywordsearch.Server.Core;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
|
||||
@ -38,20 +38,20 @@ import org.sleuthkit.datamodel.Content;
|
||||
* content matching the search that the Node was found with, and to provide
|
||||
* the full highlighted content as a MarkupSource
|
||||
*/
|
||||
class KeywordSearchFilterNode extends ContentFilterNode {
|
||||
class KeywordSearchFilterNode extends FilterNode {
|
||||
|
||||
private static final int SNIPPET_LENGTH = 45;
|
||||
String solrQuery;
|
||||
|
||||
KeywordSearchFilterNode(HighlightedMatchesSource highlights, Node original, String solrQuery) {
|
||||
super((ContentNode) original, null, new ProxyLookup(Lookups.singleton(highlights), original.getLookup()));
|
||||
super(original, null, new ProxyLookup(Lookups.singleton(highlights), original.getLookup()));
|
||||
this.solrQuery = solrQuery;
|
||||
}
|
||||
|
||||
String getSnippet() {
|
||||
Core solrCore = KeywordSearch.getServer().getCore();
|
||||
|
||||
Content content = this.getContent();
|
||||
Content content = this.getOriginal().getLookup().lookup(Content.class);
|
||||
|
||||
SolrQuery q = new SolrQuery();
|
||||
q.setQuery(solrQuery);
|
||||
|
@ -18,28 +18,21 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Node;
|
||||
import org.sleuthkit.autopsy.datamodel.ContentNode;
|
||||
import org.sleuthkit.autopsy.datamodel.ContentNodeVisitor;
|
||||
import org.sleuthkit.autopsy.datamodel.RootContentChildren;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.FsContent;
|
||||
import org.sleuthkit.datamodel.TskException;
|
||||
|
||||
/**
|
||||
* Root Node for keyword search results
|
||||
*/
|
||||
class KeywordSearchNode extends AbstractNode implements ContentNode {
|
||||
|
||||
private String solrQuery;
|
||||
class KeywordSearchNode extends AbstractNode {
|
||||
|
||||
KeywordSearchNode(List<FsContent> keys, final String solrQuery) {
|
||||
super(new RootContentChildren(keys) {
|
||||
|
||||
|
||||
@Override
|
||||
protected Node[] createNodes(Content key) {
|
||||
Node[] originalNodes = super.createNodes(key);
|
||||
@ -56,68 +49,5 @@ class KeywordSearchNode extends AbstractNode implements ContentNode {
|
||||
return filterNodes;
|
||||
}
|
||||
});
|
||||
|
||||
this.solrQuery = solrQuery;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getID() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[][] getRowValues(int rows) throws SQLException {
|
||||
int totalNodes = getChildren().getNodesCount();
|
||||
|
||||
Object[][] objs;
|
||||
int maxRows = 0;
|
||||
if (totalNodes > rows) {
|
||||
objs = new Object[rows][];
|
||||
maxRows = rows;
|
||||
} else {
|
||||
objs = new Object[totalNodes][];
|
||||
maxRows = totalNodes;
|
||||
}
|
||||
|
||||
for (int i = 0; i < maxRows; i++) {
|
||||
PropertySet[] props = getChildren().getNodeAt(i).getPropertySets();
|
||||
Property[] property = props[0].getProperties();
|
||||
objs[i] = new Object[property.length];
|
||||
|
||||
for (int j = 0; j < property.length; j++) {
|
||||
try {
|
||||
objs[i][j] = property[j].getValue();
|
||||
} catch (Exception ex) {
|
||||
objs[i][j] = "n/a";
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] read(long offset, long len) throws TskException {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getContent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getDisplayPath() {
|
||||
return new String[]{"Solr query: " + this.solrQuery};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSystemPath() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T accept(ContentNodeVisitor<T> v) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user