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;
37 class DataSourceGroupingNode
extends DisplayableItemNode {
39 private static final Logger logger = Logger.getLogger(DataSourceGroupingNode.class.getName());
46 DataSourceGroupingNode(DataSource dataSource) {
48 super(Optional.ofNullable(createDSGroupingNodeChildren(dataSource))
49 .orElse(
new RootContentChildren(Arrays.asList(Collections.EMPTY_LIST))),
50 Lookups.singleton(dataSource));
52 if (dataSource instanceof Image) {
53 Image image = (Image) dataSource;
55 super.setName(image.getName());
56 super.setDisplayName(image.getName());
57 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/image.png");
58 }
else if (dataSource instanceof LocalFilesDataSource) {
59 LocalFilesDataSource localFilesDataSource = (LocalFilesDataSource) dataSource;
61 super.setName(localFilesDataSource.getName());
62 super.setDisplayName(localFilesDataSource.getName());
63 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/fileset-icon-16.png");
69 public boolean isLeafTypeNode() {
73 private static RootContentChildren createDSGroupingNodeChildren(DataSource dataSource) {
75 long dsObjId = dataSource.getId();
77 return new RootContentChildren(Arrays.asList(
78 new DataSources(dsObjId),
79 new Views(Case.getCurrentCaseThrows().getSleuthkitCase(), dsObjId),
80 new DataArtifacts(dsObjId),
81 new AnalysisResults(dsObjId),
82 new OsAccounts(Case.getCurrentCaseThrows().getSleuthkitCase(), dsObjId),
86 }
catch (NoCurrentCaseException ex) {
87 logger.log(Level.SEVERE,
"Error getting open case.", ex);
93 public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
94 return visitor.visit(
this);
98 public String getItemType() {
99 return getClass().getName();