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;
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))));
51 if (dataSource instanceof Image) {
52 Image image = (Image) dataSource;
54 super.setName(image.getName());
55 super.setDisplayName(image.getName());
56 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/image.png");
57 }
else if (dataSource instanceof LocalFilesDataSource) {
58 LocalFilesDataSource localFilesDataSource = (LocalFilesDataSource) dataSource;
60 super.setName(localFilesDataSource.getName());
61 super.setDisplayName(localFilesDataSource.getName());
62 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/fileset-icon-16.png");
68 public boolean isLeafTypeNode() {
72 private static RootContentChildren createDSGroupingNodeChildren(DataSource dataSource) {
74 long dsObjId = dataSource.getId();
76 return new RootContentChildren(Arrays.asList(
77 new DataSources(dsObjId),
78 new Views(Case.getCurrentCaseThrows().getSleuthkitCase(), dsObjId),
79 new Results(Case.getCurrentCaseThrows().getSleuthkitCase(), dsObjId),
84 }
catch (NoCurrentCaseException ex) {
85 logger.log(Level.SEVERE,
"Error getting open case.", ex);
91 public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
92 return visitor.visit(
this);
96 public String getItemType() {
97 return getClass().getName();