19 package org.sleuthkit.autopsy.datamodel;
21 import java.awt.event.ActionEvent;
22 import java.sql.ResultSet;
23 import java.sql.SQLException;
24 import java.util.ArrayList;
25 import java.util.Collections;
26 import java.util.LinkedHashMap;
27 import java.util.List;
29 import java.util.logging.Level;
30 import javax.swing.AbstractAction;
31 import javax.swing.Action;
32 import org.openide.nodes.Sheet;
33 import org.openide.util.NbBundle;
34 import org.openide.util.NbBundle.Messages;
66 String name = ld.getName();
69 if (name.equals(VirtualDirectory.NAME_UNALLOC)) {
70 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/folder-icon-deleted.png");
71 }
else if (ld.isDataSource()) {
72 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/fileset-icon-16.png");
73 }
else if (name.equals(VirtualDirectory.NAME_CARVED)) {
74 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/Folder-icon.png");
76 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/Folder-icon.png");
89 @NbBundle.Messages({
"VirtualDirectoryNode.action.runIngestMods.text=Run Ingest Modules"})
91 List<Action> actions =
new ArrayList<>();
92 for (Action a : super.getActions(
true)) {
97 NbBundle.getMessage(
this.getClass(),
"VirtualDirectoryNode.getActions.viewInNewWin.text"),
this));
102 Bundle.ImageNode_getActions_openFileSearchByAttr_text()));
103 actions.add(
new AbstractAction(
104 Bundle.VirtualDirectoryNode_action_runIngestMods_text()) {
106 public void actionPerformed(ActionEvent e) {
112 return actions.toArray(
new Action[0]);
116 @Messages({
"VirtualDirectoryNode.createSheet.size.name=Size (Bytes)",
117 "VirtualDirectoryNode.createSheet.size.displayName=Size (Bytes)",
118 "VirtualDirectoryNode.createSheet.size.desc=Size of the data source in bytes.",
119 "VirtualDirectoryNode.createSheet.type.name=Type",
120 "VirtualDirectoryNode.createSheet.type.displayName=Type",
121 "VirtualDirectoryNode.createSheet.type.desc=Type of the image.",
122 "VirtualDirectoryNode.createSheet.type.text=Logical File Set",
123 "VirtualDirectoryNode.createSheet.timezone.name=Timezone",
124 "VirtualDirectoryNode.createSheet.timezone.displayName=Timezone",
125 "VirtualDirectoryNode.createSheet.timezone.desc=Timezone of the image",
126 "VirtualDirectoryNode.createSheet.deviceId.name=Device ID",
127 "VirtualDirectoryNode.createSheet.deviceId.displayName=Device ID",
128 "VirtualDirectoryNode.createSheet.deviceId.desc=Device ID of the image"})
130 Sheet s = super.createSheet();
131 Sheet.Set ss = s.get(Sheet.PROPERTIES);
133 ss = Sheet.createPropertiesSet();
137 ss.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"VirtualDirectoryNode.createSheet.name.name"),
138 NbBundle.getMessage(
this.getClass(),
139 "VirtualDirectoryNode.createSheet.name.displayName"),
140 NbBundle.getMessage(
this.getClass(),
"VirtualDirectoryNode.createSheet.name.desc"),
143 if (!this.content.isDataSource()) {
144 Map<String, Object> map =
new LinkedHashMap<>();
147 final String NO_DESCR = NbBundle.getMessage(this.getClass(),
"VirtualDirectoryNode.createSheet.noDesc");
148 for (Map.Entry<String, Object> entry : map.entrySet()) {
149 ss.put(
new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
152 ss.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_type_name(),
153 Bundle.VirtualDirectoryNode_createSheet_type_displayName(),
154 Bundle.VirtualDirectoryNode_createSheet_type_desc(),
155 Bundle.VirtualDirectoryNode_createSheet_type_text()));
156 ss.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_size_name(),
157 Bundle.VirtualDirectoryNode_createSheet_size_displayName(),
158 Bundle.VirtualDirectoryNode_createSheet_size_desc(),
159 this.content.getSize()));
160 try (SleuthkitCase.CaseDbQuery query =
Case.
getCurrentCase().
getSleuthkitCase().executeQuery(
"SELECT time_zone FROM data_source_info WHERE obj_id = " + this.content.getId())) {
161 ResultSet timeZoneSet = query.getResultSet();
162 if (timeZoneSet.next()) {
163 ss.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_timezone_name(),
164 Bundle.VirtualDirectoryNode_createSheet_timezone_displayName(),
165 Bundle.VirtualDirectoryNode_createSheet_timezone_desc(),
166 timeZoneSet.getString(
"time_zone")));
168 }
catch (SQLException | TskCoreException ex) {
169 logger.log(Level.SEVERE,
"Failed to get time zone for the following image: " +
this.content.getId(), ex);
171 try (SleuthkitCase.CaseDbQuery query =
Case.
getCurrentCase().
getSleuthkitCase().executeQuery(
"SELECT device_id FROM data_source_info WHERE obj_id = " + this.content.getId());) {
172 ResultSet deviceIdSet = query.getResultSet();
173 if (deviceIdSet.next()) {
174 ss.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_deviceId_name(),
175 Bundle.VirtualDirectoryNode_createSheet_deviceId_displayName(),
176 Bundle.VirtualDirectoryNode_createSheet_deviceId_desc(),
177 deviceIdSet.getString(
"device_id")));
179 }
catch (SQLException | TskCoreException ex) {
180 logger.log(Level.SEVERE,
"Failed to get device id for the following image: " +
this.content.getId(), ex);
189 public <T> T accept(ContentNodeVisitor<T> v) {
190 return v.visit(
this);
194 public <T> T accept(DisplayableItemNodeVisitor<T> v) {
195 return v.visit(
this);
214 short allocFlag = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.getValue();
215 short unallocFlag = TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.getValue();
217 if ((metaFlag & allocFlag) == allocFlag) {
218 result = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.toString();
220 if ((metaFlag & unallocFlag) == unallocFlag) {
221 result = TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.toString();
static String metaFlagToString(short metaFlag)
Action[] getActions(boolean popup)
static void fillPropertyMap(Map< String, Object > map, AbstractFile content)
VirtualDirectoryNode(VirtualDirectory ld)
SleuthkitCase getSleuthkitCase()
static Case getCurrentCase()
synchronized static Logger getLogger(String name)
static final String LOGICAL_FILE_SET_PREFIX
static String nameForLayoutFile(VirtualDirectory ld)