mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Initial work on adding paging to data sources tree.
This commit is contained in:
parent
b7d1178e7a
commit
8594378a38
@ -169,10 +169,12 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
|
||||
// data sources branch of the tree. The parent nodes in other
|
||||
// branches of the tree (e.g. File Types and Deleted Files) do
|
||||
// not need to be refreshed.
|
||||
if (parentsChildren instanceof ContentChildren) {
|
||||
((ContentChildren) parentsChildren).refreshChildren();
|
||||
parentsChildren.getNodesCount();
|
||||
}
|
||||
|
||||
// TODO: How will this work with ChildFactory approach?
|
||||
// if (parentsChildren instanceof ContentChildren) {
|
||||
// ((ContentChildren) parentsChildren).refreshChildren();
|
||||
// parentsChildren.getNodesCount();
|
||||
// }
|
||||
} catch (NullPointerException ex) {
|
||||
// Skip
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2016 Basis Technology Corp.
|
||||
* Copyright 2011-2019 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -18,228 +18,28 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.datamodel;
|
||||
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Children.Keys;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.datamodel.FileTypes.FileTypesNode;
|
||||
import org.sleuthkit.autopsy.datamodel.accounts.Accounts;
|
||||
import org.sleuthkit.autopsy.datamodel.accounts.Accounts.AccountsRootNode;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.DerivedFile;
|
||||
import org.sleuthkit.datamodel.Directory;
|
||||
import org.sleuthkit.datamodel.File;
|
||||
import org.sleuthkit.datamodel.Image;
|
||||
import org.sleuthkit.datamodel.LayoutFile;
|
||||
import org.sleuthkit.datamodel.LocalFile;
|
||||
import org.sleuthkit.datamodel.LocalDirectory;
|
||||
import org.sleuthkit.datamodel.SlackFile;
|
||||
import org.sleuthkit.datamodel.SleuthkitItemVisitor;
|
||||
import org.sleuthkit.datamodel.SleuthkitVisitableItem;
|
||||
import org.sleuthkit.datamodel.VirtualDirectory;
|
||||
import org.sleuthkit.datamodel.Volume;
|
||||
|
||||
/**
|
||||
* Abstract subclass for ContentChildren and RootContentChildren implementations
|
||||
* Abstract subclass for ContentChildren implementation
|
||||
* that handles creating Nodes from Content objects.
|
||||
*/
|
||||
abstract class AbstractContentChildren<T> extends Keys<T> {
|
||||
abstract class AbstractContentChildren<T extends Content> extends BaseChildFactory<T> {
|
||||
|
||||
private final CreateSleuthkitNodeVisitor createSleuthkitNodeVisitor = new CreateSleuthkitNodeVisitor();
|
||||
private final CreateAutopsyNodeVisitor createAutopsyNodeVisitor = new CreateAutopsyNodeVisitor();
|
||||
|
||||
/**
|
||||
* Uses lazy Content.Keys
|
||||
*/
|
||||
AbstractContentChildren() {
|
||||
/*
|
||||
* This was turned off because we were getting out of memory errors when
|
||||
* the filter nodes were hiding nodes. Turning this off seemed to help
|
||||
*/
|
||||
super(false); //don't use lazy behavior
|
||||
AbstractContentChildren(String nodeName) {
|
||||
super(nodeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node[] createNodes(T key) {
|
||||
protected Node createNodeForKey(T key) {
|
||||
if (key instanceof SleuthkitVisitableItem) {
|
||||
return new Node[]{((SleuthkitVisitableItem) key).accept(createSleuthkitNodeVisitor)};
|
||||
return ((SleuthkitVisitableItem) key).accept(createSleuthkitNodeVisitor);
|
||||
} else {
|
||||
return new Node[]{((AutopsyVisitableItem) key).accept(createAutopsyNodeVisitor)};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates appropriate Node for each sub-class of Content
|
||||
*/
|
||||
public static class CreateSleuthkitNodeVisitor extends SleuthkitItemVisitor.Default<AbstractContentNode<? extends Content>> {
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(Directory drctr) {
|
||||
return new DirectoryNode(drctr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(File file) {
|
||||
return new FileNode(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(Image image) {
|
||||
return new ImageNode(image);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(Volume volume) {
|
||||
return new VolumeNode(volume);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(LayoutFile lf) {
|
||||
return new LayoutFileNode(lf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(DerivedFile df) {
|
||||
return new LocalFileNode(df);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(LocalFile lf) {
|
||||
return new LocalFileNode(lf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(VirtualDirectory ld) {
|
||||
return new VirtualDirectoryNode(ld);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(LocalDirectory ld) {
|
||||
return new LocalDirectoryNode(ld);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(SlackFile sf) {
|
||||
return new SlackFileNode(sf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(BlackboardArtifact art) {
|
||||
return new BlackboardArtifactNode(art);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractContentNode<? extends Content> defaultVisit(SleuthkitVisitableItem di) {
|
||||
throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(),
|
||||
"AbstractContentChildren.CreateTSKNodeVisitor.exception.noNodeMsg"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a DisplayableItemNode for use as a subtree root node for the Autopsy
|
||||
* tree view from each type of AutopsyVisitableItem visited. There are
|
||||
* AutopsyVisitableItems for the Data Sources, Views, Results, and Reports
|
||||
* subtrees, and for the subtrees of Results (e.g., Extracted Content, Hash
|
||||
* Set Hits, etc.).
|
||||
*/
|
||||
static class CreateAutopsyNodeVisitor extends AutopsyItemVisitor.Default<AbstractNode> {
|
||||
|
||||
@Override
|
||||
public ExtractedContent.RootNode visit(ExtractedContent ec) {
|
||||
return ec.new RootNode(ec.getSleuthkitCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(FileTypesByExtension sf) {
|
||||
return sf.new FileTypesByExtNode(sf.getSleuthkitCase(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(RecentFiles rf) {
|
||||
return new RecentFilesNode(rf.getSleuthkitCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(DeletedContent dc) {
|
||||
return new DeletedContent.DeletedContentsNode(dc.getSleuthkitCase(), dc.filteringDataSourceObjId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(FileSize dc) {
|
||||
return new FileSize.FileSizeRootNode(dc.getSleuthkitCase(), dc.filteringDataSourceObjId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(KeywordHits kh) {
|
||||
return kh.new RootNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(HashsetHits hh) {
|
||||
return hh.new RootNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(InterestingHits ih) {
|
||||
return ih.new RootNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(EmailExtracted ee) {
|
||||
return ee.new RootNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(Tags tagsNodeKey) {
|
||||
return tagsNodeKey.new RootNode(tagsNodeKey.filteringDataSourceObjId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(DataSources i) {
|
||||
return new DataSourcesNode(i.filteringDataSourceObjId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(DataSourceGrouping datasourceGrouping) {
|
||||
return new DataSourceGroupingNode(datasourceGrouping.getDataSource());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(Views v) {
|
||||
return new ViewsNode(v.getSleuthkitCase(), v.filteringDataSourceObjId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(Results results) {
|
||||
return new ResultsNode(results.getSleuthkitCase(), results.filteringDataSourceObjId() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(FileTypes ft) {
|
||||
return ft.new FileTypesNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(Reports reportsItem) {
|
||||
return new Reports.ReportsListNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(Accounts accountsItem) {
|
||||
return accountsItem.new AccountsRootNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractNode defaultVisit(AutopsyVisitableItem di) {
|
||||
throw new UnsupportedOperationException(
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AbstractContentChildren.createAutopsyNodeVisitor.exception.noNodeMsg"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(FileTypesByMimeType ftByMimeTypeItem) {
|
||||
return ftByMimeTypeItem.new ByMimeTypeNode();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2018 Basis Technology Corp.
|
||||
* Copyright 2011-2019 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -22,6 +22,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.nodes.Children;
|
||||
|
||||
import org.openide.util.lookup.Lookups;
|
||||
import org.openide.util.Lookup;
|
||||
@ -66,7 +67,7 @@ public abstract class AbstractContentNode<T extends Content> extends ContentNode
|
||||
*/
|
||||
AbstractContentNode(T content, Lookup lookup) {
|
||||
//TODO consider child factory for the content children
|
||||
super(new ContentChildren(content), lookup);
|
||||
super(Children.create(new ContentChildren(content), true), lookup);
|
||||
this.content = content;
|
||||
//super.setName(ContentUtils.getSystemName(content));
|
||||
super.setName("content_" + Long.toString(content.getId())); //NON-NLS
|
||||
|
@ -135,7 +135,7 @@ public final class AutopsyTreeChildFactory extends ChildFactory.Detachable<Objec
|
||||
protected Node createNodeForKey(Object key) {
|
||||
|
||||
if (key instanceof SleuthkitVisitableItem) {
|
||||
return ((SleuthkitVisitableItem) key).accept(new RootContentChildren.CreateSleuthkitNodeVisitor());
|
||||
return ((SleuthkitVisitableItem) key).accept(new CreateSleuthkitNodeVisitor());
|
||||
} else if (key instanceof AutopsyVisitableItem) {
|
||||
return ((AutopsyVisitableItem) key).accept(new RootContentChildren.CreateAutopsyNodeVisitor());
|
||||
}
|
||||
|
@ -99,10 +99,7 @@ public abstract class BaseChildFactory<T extends Content> extends ChildFactory.D
|
||||
if (!isPageChangeEvent && !isPageSizeChangeEvent) {
|
||||
List<T> allKeys = makeKeys();
|
||||
|
||||
// Filter keys
|
||||
allKeys.stream().filter(filter).collect(Collectors.toList());
|
||||
|
||||
pagingSupport.splitKeysIntoPages(allKeys);
|
||||
pagingSupport.splitKeysIntoPages(allKeys.stream().filter(filter).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
toPopulate.addAll(pagingSupport.getCurrentPage());
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2014 Basis Technology Corp.
|
||||
* Copyright 2011-2019 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -33,17 +33,15 @@ import org.sleuthkit.datamodel.VolumeSystem;
|
||||
/**
|
||||
* Makes the children nodes / keys for a given content object. Has knowledge
|
||||
* about the structure of the directory tree and what levels should be ignored.
|
||||
* TODO consider a ContentChildren child factory
|
||||
*/
|
||||
class ContentChildren extends AbstractContentChildren<Content> {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ContentChildren.class.getName());
|
||||
//private static final int MAX_CHILD_COUNT = 1000000;
|
||||
|
||||
private final Content parent;
|
||||
|
||||
ContentChildren(Content parent) {
|
||||
super(); //initialize lazy behavior
|
||||
super("content_" + Long.toString(parent.getId()));
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@ -90,7 +88,7 @@ class ContentChildren extends AbstractContentChildren<Content> {
|
||||
children.add(c);
|
||||
}
|
||||
} else if (c instanceof LocalDirectory) {
|
||||
LocalDirectory localDir = (LocalDirectory)c;
|
||||
LocalDirectory localDir = (LocalDirectory) c;
|
||||
if (localDir.isRoot()) {
|
||||
children.addAll(getDisplayChildren(localDir));
|
||||
} else {
|
||||
@ -104,27 +102,13 @@ class ContentChildren extends AbstractContentChildren<Content> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addNotify() {
|
||||
super.addNotify();
|
||||
|
||||
//TODO check global settings
|
||||
//if above limit, query and return subrange
|
||||
//StopWatch s2 = new StopWatch();
|
||||
//s2.start();
|
||||
//logger.log(Level.INFO, "GETTING CHILDREN CONTENT for parent: " + parent.getName());
|
||||
List<Content> children = getDisplayChildren(parent);
|
||||
//s2.stop();
|
||||
//logger.log(Level.INFO, "GOT CHILDREN CONTENTS:" + children.size() + ", took: " + s2.getElapsedTime());
|
||||
|
||||
//limit number children
|
||||
//setKeys(children.subList(0, Math.min(children.size(), MAX_CHILD_COUNT)));
|
||||
setKeys(children);
|
||||
protected List<Content> makeKeys() {
|
||||
return getDisplayChildren(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void removeNotify() {
|
||||
super.removeNotify();
|
||||
setKeys(new ArrayList<>());
|
||||
protected void onAdd() {
|
||||
// No-op
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,7 +117,11 @@ class ContentChildren extends AbstractContentChildren<Content> {
|
||||
* them).
|
||||
*/
|
||||
void refreshChildren() {
|
||||
List<Content> children = getDisplayChildren(parent);
|
||||
setKeys(children);
|
||||
refresh(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRemove() {
|
||||
// No-op
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2019 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.datamodel;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.DerivedFile;
|
||||
import org.sleuthkit.datamodel.Directory;
|
||||
import org.sleuthkit.datamodel.File;
|
||||
import org.sleuthkit.datamodel.Image;
|
||||
import org.sleuthkit.datamodel.LayoutFile;
|
||||
import org.sleuthkit.datamodel.LocalDirectory;
|
||||
import org.sleuthkit.datamodel.LocalFile;
|
||||
import org.sleuthkit.datamodel.SlackFile;
|
||||
import org.sleuthkit.datamodel.SleuthkitItemVisitor;
|
||||
import org.sleuthkit.datamodel.SleuthkitVisitableItem;
|
||||
import org.sleuthkit.datamodel.VirtualDirectory;
|
||||
import org.sleuthkit.datamodel.Volume;
|
||||
|
||||
/**
|
||||
* Creates appropriate Node for each sub-class of Content
|
||||
*/
|
||||
public class CreateSleuthkitNodeVisitor extends SleuthkitItemVisitor.Default<AbstractContentNode<? extends Content>> {
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(Directory drctr) {
|
||||
return new DirectoryNode(drctr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(File file) {
|
||||
return new FileNode(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(Image image) {
|
||||
return new ImageNode(image);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(Volume volume) {
|
||||
return new VolumeNode(volume);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(LayoutFile lf) {
|
||||
return new LayoutFileNode(lf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(DerivedFile df) {
|
||||
return new LocalFileNode(df);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(LocalFile lf) {
|
||||
return new LocalFileNode(lf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(VirtualDirectory ld) {
|
||||
return new VirtualDirectoryNode(ld);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(LocalDirectory ld) {
|
||||
return new LocalDirectoryNode(ld);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(SlackFile sf) {
|
||||
return new SlackFileNode(sf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContentNode<? extends Content> visit(BlackboardArtifact art) {
|
||||
return new BlackboardArtifactNode(art);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractContentNode<? extends Content> defaultVisit(SleuthkitVisitableItem di) {
|
||||
throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(),
|
||||
"AbstractContentChildren.CreateTSKNodeVisitor.exception.noNodeMsg"));
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@ import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.lookup.Lookups;
|
||||
@ -56,7 +57,7 @@ public class DataSourcesNode extends DisplayableItemNode {
|
||||
}
|
||||
|
||||
public DataSourcesNode(long dsObjId) {
|
||||
super(new DataSourcesNodeChildren(dsObjId), Lookups.singleton(NAME));
|
||||
super(Children.create(new DataSourcesNodeChildren(dsObjId), true), Lookups.singleton(NAME));
|
||||
displayName = (dsObjId > 0) ? NbBundle.getMessage(DataSourcesNode.class, "DataSourcesNode.group_by_datasource.name") : NAME;
|
||||
init();
|
||||
}
|
||||
@ -87,7 +88,7 @@ public class DataSourcesNode extends DisplayableItemNode {
|
||||
}
|
||||
|
||||
public DataSourcesNodeChildren(long dsObjId) {
|
||||
super();
|
||||
super("ds_" + Long.toString(dsObjId));
|
||||
this.currentKeys = new ArrayList<>();
|
||||
this.datasourceObjId = dsObjId;
|
||||
}
|
||||
@ -97,25 +98,24 @@ public class DataSourcesNode extends DisplayableItemNode {
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
String eventType = evt.getPropertyName();
|
||||
if (eventType.equals(Case.Events.DATA_SOURCE_ADDED.toString())) {
|
||||
reloadKeys();
|
||||
refresh(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void addNotify() {
|
||||
protected void onAdd() {
|
||||
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.DATA_SOURCE_ADDED), pcl);
|
||||
reloadKeys();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void removeNotify() {
|
||||
protected void onRemove() {
|
||||
Case.removeEventTypeSubscriber(EnumSet.of(Case.Events.DATA_SOURCE_ADDED), pcl);
|
||||
currentKeys.clear();
|
||||
setKeys(Collections.<Content>emptySet());
|
||||
}
|
||||
|
||||
private void reloadKeys() {
|
||||
@Override
|
||||
protected List<Content> makeKeys() {
|
||||
try {
|
||||
if (datasourceObjId == 0) {
|
||||
currentKeys = Case.getCurrentCaseThrows().getDataSources();
|
||||
@ -135,20 +135,11 @@ public class DataSourcesNode extends DisplayableItemNode {
|
||||
|
||||
});
|
||||
|
||||
setKeys(currentKeys);
|
||||
} catch (TskCoreException | NoCurrentCaseException | TskDataException ex) {
|
||||
logger.log(Level.SEVERE, "Error getting data sources: {0}", ex.getMessage()); // NON-NLS
|
||||
setKeys(Collections.<Content>emptySet());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh all content keys This creates new nodes of keys have changed.
|
||||
*/
|
||||
public void refreshContentKeys() {
|
||||
for (Content key : currentKeys) {
|
||||
refreshKey(key);
|
||||
}
|
||||
|
||||
return currentKeys;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ public class ImageNode extends AbstractContentNode<Image> {
|
||||
if (parent.getParent().getId() == getContent().getId()) {
|
||||
Children children = getChildren();
|
||||
if (children != null) {
|
||||
((ContentChildren) children).refreshChildren();
|
||||
// ((ContentChildren) children).refreshChildren();
|
||||
children.getNodesCount();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2017 Basis Technology Corp.
|
||||
* Copyright 2011-2019 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -20,14 +20,20 @@ package org.sleuthkit.autopsy.datamodel;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import org.openide.nodes.AbstractNode;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.datamodel.accounts.Accounts;
|
||||
|
||||
/**
|
||||
* Children implementation for the root node of a ContentNode tree. Accepts a
|
||||
* list of root Content objects for the tree.
|
||||
*/
|
||||
public class RootContentChildren extends AbstractContentChildren<Object> {
|
||||
public class RootContentChildren extends Children.Keys<Object> {
|
||||
|
||||
private final Collection<? extends Object> contentKeys;
|
||||
private final CreateAutopsyNodeVisitor createAutopsyNodeVisitor = new CreateAutopsyNodeVisitor();
|
||||
|
||||
/**
|
||||
* @param contentKeys root Content objects for the Node tree
|
||||
@ -56,4 +62,120 @@ public class RootContentChildren extends AbstractContentChildren<Object> {
|
||||
public void refreshContentKeys() {
|
||||
contentKeys.forEach(this::refreshKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node[] createNodes(Object key) {
|
||||
if (key instanceof AutopsyVisitableItem) {
|
||||
return new Node[] {((AutopsyVisitableItem)key).accept(createAutopsyNodeVisitor)};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a DisplayableItemNode for use as a subtree root node for the Autopsy
|
||||
* tree view from each type of AutopsyVisitableItem visited. There are
|
||||
* AutopsyVisitableItems for the Data Sources, Views, Results, and Reports
|
||||
* subtrees, and for the subtrees of Results (e.g., Extracted Content, Hash
|
||||
* Set Hits, etc.).
|
||||
*/
|
||||
static class CreateAutopsyNodeVisitor extends AutopsyItemVisitor.Default<AbstractNode> {
|
||||
|
||||
@Override
|
||||
public ExtractedContent.RootNode visit(ExtractedContent ec) {
|
||||
return ec.new RootNode(ec.getSleuthkitCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(FileTypesByExtension sf) {
|
||||
return sf.new FileTypesByExtNode(sf.getSleuthkitCase(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(RecentFiles rf) {
|
||||
return new RecentFilesNode(rf.getSleuthkitCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(DeletedContent dc) {
|
||||
return new DeletedContent.DeletedContentsNode(dc.getSleuthkitCase(), dc.filteringDataSourceObjId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(FileSize dc) {
|
||||
return new FileSize.FileSizeRootNode(dc.getSleuthkitCase(), dc.filteringDataSourceObjId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(KeywordHits kh) {
|
||||
return kh.new RootNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(HashsetHits hh) {
|
||||
return hh.new RootNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(InterestingHits ih) {
|
||||
return ih.new RootNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(EmailExtracted ee) {
|
||||
return ee.new RootNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(Tags tagsNodeKey) {
|
||||
return tagsNodeKey.new RootNode(tagsNodeKey.filteringDataSourceObjId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(DataSources i) {
|
||||
return new DataSourcesNode(i.filteringDataSourceObjId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(DataSourceGrouping datasourceGrouping) {
|
||||
return new DataSourceGroupingNode(datasourceGrouping.getDataSource());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(Views v) {
|
||||
return new ViewsNode(v.getSleuthkitCase(), v.filteringDataSourceObjId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(Results results) {
|
||||
return new ResultsNode(results.getSleuthkitCase(), results.filteringDataSourceObjId() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(FileTypes ft) {
|
||||
return ft.new FileTypesNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(Reports reportsItem) {
|
||||
return new Reports.ReportsListNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(Accounts accountsItem) {
|
||||
return accountsItem.new AccountsRootNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractNode defaultVisit(AutopsyVisitableItem di) {
|
||||
throw new UnsupportedOperationException(
|
||||
NbBundle.getMessage(this.getClass(),
|
||||
"AbstractContentChildren.createAutopsyNodeVisitor.exception.noNodeMsg"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode visit(FileTypesByMimeType ftByMimeTypeItem) {
|
||||
return ftByMimeTypeItem.new ByMimeTypeNode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class VolumeNode extends AbstractContentNode<Volume> {
|
||||
if (parent.getParent().getId() == getContent().getId()) {
|
||||
Children children = getChildren();
|
||||
if (children != null) {
|
||||
((ContentChildren) children).refreshChildren();
|
||||
// ((ContentChildren) children).refreshChildren();
|
||||
children.getNodesCount();
|
||||
}
|
||||
}
|
||||
|
@ -320,17 +320,17 @@ public class DataResultFilterNode extends FilterNode {
|
||||
|
||||
@Override
|
||||
protected Node[] createNodes(Node key) {
|
||||
AbstractFile file = key.getLookup().lookup(AbstractFile.class);
|
||||
if (file != null) {
|
||||
if (filterKnown && (file.getKnown() == TskData.FileKnown.KNOWN)) {
|
||||
// Filter out child nodes that represent known files
|
||||
return new Node[]{};
|
||||
}
|
||||
if (filterSlack && file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
|
||||
// Filter out child nodes that represent slack files
|
||||
return new Node[]{};
|
||||
}
|
||||
}
|
||||
// AbstractFile file = key.getLookup().lookup(AbstractFile.class);
|
||||
// if (file != null) {
|
||||
// if (filterKnown && (file.getKnown() == TskData.FileKnown.KNOWN)) {
|
||||
// // Filter out child nodes that represent known files
|
||||
// return new Node[]{};
|
||||
// }
|
||||
// if (filterSlack && file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
|
||||
// // Filter out child nodes that represent slack files
|
||||
// return new Node[]{};
|
||||
// }
|
||||
// }
|
||||
|
||||
// filter out all non-message artifacts, if displaying the results from the Data Source tree
|
||||
BlackboardArtifact art = key.getLookup().lookup(BlackboardArtifact.class);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011 Basis Technology Corp.
|
||||
* Copyright 2011-2019 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -22,7 +22,7 @@ import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import org.sleuthkit.autopsy.corecomponents.DataContentTopComponent;
|
||||
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
|
||||
import org.sleuthkit.autopsy.datamodel.RootContentChildren;
|
||||
import org.sleuthkit.autopsy.datamodel.CreateSleuthkitNodeVisitor;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
|
||||
/**
|
||||
@ -30,7 +30,7 @@ import org.sleuthkit.datamodel.Content;
|
||||
*/
|
||||
class ViewAssociatedContentAction extends AbstractAction {
|
||||
|
||||
private Content content;
|
||||
private final Content content;
|
||||
|
||||
public ViewAssociatedContentAction(String title, BlackboardArtifactNode node) {
|
||||
super(title);
|
||||
@ -39,6 +39,6 @@ class ViewAssociatedContentAction extends AbstractAction {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
DataContentTopComponent.getDefault().setNode(content.accept(new RootContentChildren.CreateSleuthkitNodeVisitor()));
|
||||
DataContentTopComponent.getDefault().setNode(content.accept(new CreateSleuthkitNodeVisitor()));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user