19 package org.sleuthkit.autopsy.datamodel;
21 import java.util.Arrays;
22 import java.util.Collections;
23 import java.util.Optional;
24 import java.util.logging.Level;
25 import org.openide.util.lookup.Lookups;
38 class DataSourceGroupingNode
extends DisplayableItemNode {
40 private static final Logger logger = Logger.getLogger(DataSourceGroupingNode.class.getName());
47 DataSourceGroupingNode(DataSource dataSource) {
49 super(Optional.ofNullable(createDSGroupingNodeChildren(dataSource))
50 .orElse(
new RootContentChildren(Arrays.asList(Collections.EMPTY_LIST))),
51 Lookups.singleton(dataSource));
53 if (dataSource instanceof Image) {
54 Image image = (Image) dataSource;
56 super.setName(image.getName());
57 super.setDisplayName(image.getName());
58 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/image.png");
59 }
else if (dataSource instanceof LocalFilesDataSource) {
60 LocalFilesDataSource localFilesDataSource = (LocalFilesDataSource) dataSource;
62 super.setName(localFilesDataSource.getName());
63 super.setDisplayName(localFilesDataSource.getName());
64 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/fileset-icon-16.png");
70 public boolean isLeafTypeNode() {
74 private static RootContentChildren createDSGroupingNodeChildren(DataSource dataSource) {
76 long dsObjId = dataSource.getId();
78 SleuthkitCase skCase = Case.getCurrentCaseThrows().getSleuthkitCase();
79 return new RootContentChildren(Arrays.asList(
80 new DataSources(dsObjId),
81 new Views(skCase, dsObjId),
82 new DataArtifacts(dsObjId),
83 new AnalysisResults(dsObjId),
84 new OsAccounts(skCase, dsObjId),
86 new ScoreContent(skCase, dsObjId)
89 }
catch (NoCurrentCaseException ex) {
90 logger.log(Level.SEVERE,
"Error getting open case.", ex);
96 public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
97 return visitor.visit(
this);
101 public String getItemType() {
102 return getClass().getName();