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()));
153 ss.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_type_name(),
154 Bundle.VirtualDirectoryNode_createSheet_type_displayName(),
155 Bundle.VirtualDirectoryNode_createSheet_type_desc(),
156 Bundle.VirtualDirectoryNode_createSheet_type_text()));
157 ss.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_size_name(),
158 Bundle.VirtualDirectoryNode_createSheet_size_displayName(),
159 Bundle.VirtualDirectoryNode_createSheet_size_desc(),
160 this.content.getSize()));
161 try (SleuthkitCase.CaseDbQuery query =
Case.
getCurrentCase().
getSleuthkitCase().executeQuery(
"SELECT time_zone FROM data_source_info WHERE obj_id = " + this.content.getId())) {
162 ResultSet timeZoneSet = query.getResultSet();
163 if (timeZoneSet.next()) {
164 ss.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_timezone_name(),
165 Bundle.VirtualDirectoryNode_createSheet_timezone_displayName(),
166 Bundle.VirtualDirectoryNode_createSheet_timezone_desc(),
167 timeZoneSet.getString(
"time_zone")));
169 }
catch (SQLException | TskCoreException ex) {
170 logger.log(Level.SEVERE,
"Failed to get time zone for the following image: " +
this.content.getId(), ex);
172 try (SleuthkitCase.CaseDbQuery query =
Case.
getCurrentCase().
getSleuthkitCase().executeQuery(
"SELECT device_id FROM data_source_info WHERE obj_id = " + this.content.getId());) {
173 ResultSet deviceIdSet = query.getResultSet();
174 if (deviceIdSet.next()) {
175 ss.put(
new NodeProperty<>(Bundle.VirtualDirectoryNode_createSheet_deviceId_name(),
176 Bundle.VirtualDirectoryNode_createSheet_deviceId_displayName(),
177 Bundle.VirtualDirectoryNode_createSheet_deviceId_desc(),
178 deviceIdSet.getString(
"device_id")));
180 }
catch (SQLException | TskCoreException ex) {
181 logger.log(Level.SEVERE,
"Failed to get device id for the following image: " +
this.content.getId(), ex);
190 public <T> T accept(ContentNodeVisitor<T> v) {
191 return v.visit(
this);
195 public <T> T accept(DisplayableItemNodeVisitor<T> v) {
196 return v.visit(
this);
215 short allocFlag = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.getValue();
216 short unallocFlag = TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.getValue();
218 if ((metaFlag & allocFlag) == allocFlag) {
219 result = TskData.TSK_FS_META_FLAG_ENUM.ALLOC.toString();
221 if ((metaFlag & unallocFlag) == unallocFlag) {
222 result = TskData.TSK_FS_META_FLAG_ENUM.UNALLOC.toString();
static String metaFlagToString(short metaFlag)
Action[] getActions(boolean popup)
void addTagProperty(Sheet.Set ss)
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)