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.List;
27 import java.util.logging.Level;
28 import javax.swing.AbstractAction;
29 import javax.swing.Action;
30 import org.openide.nodes.Sheet;
31 import org.openide.util.NbBundle;
32 import org.openide.util.NbBundle.Messages;
41 import org.
sleuthkit.datamodel.SleuthkitCase.CaseDbQuery;
60 static String nameForImage(Image i) {
71 String imgName = nameForImage(img);
72 this.setDisplayName(imgName);
73 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/hard-drive-icon.jpg");
84 @Messages({
"ImageNode.action.runIngestMods.text=Run Ingest Modules",
85 "ImageNode.getActions.openFileSearchByAttr.text=Open File Search by Attributes",})
90 List<Action> actionsList =
new ArrayList<Action>();
91 for (Action a : super.getActions(
true)) {
96 Bundle.ImageNode_getActions_openFileSearchByAttr_text()));
97 actionsList.add(
new AbstractAction(
98 Bundle.ImageNode_action_runIngestMods_text()) {
100 public void actionPerformed(ActionEvent e) {
107 NbBundle.getMessage(
this.getClass(),
"ImageNode.getActions.viewInNewWin.text"),
this));
108 return actionsList.toArray(
new Action[0]);
112 @Messages({
"ImageNode.createSheet.size.name=Size (Bytes)",
113 "ImageNode.createSheet.size.displayName=Size (Bytes)",
114 "ImageNode.createSheet.size.desc=Size of the data source in bytes.",
115 "ImageNode.createSheet.type.name=Type",
116 "ImageNode.createSheet.type.displayName=Type",
117 "ImageNode.createSheet.type.desc=Type of the image.",
118 "ImageNode.createSheet.type.text=Image",
119 "ImageNode.createSheet.sectorSize.name=Sector Size (Bytes)",
120 "ImageNode.createSheet.sectorSize.displayName=Sector Size (Bytes)",
121 "ImageNode.createSheet.sectorSize.desc=Sector size of the image in bytes.",
122 "ImageNode.createSheet.md5.name=MD5 Hash",
123 "ImageNode.createSheet.md5.displayName=MD5 Hash",
124 "ImageNode.createSheet.md5.desc=MD5 Hash of the image",
125 "ImageNode.createSheet.timezone.name=Timezone",
126 "ImageNode.createSheet.timezone.displayName=Timezone",
127 "ImageNode.createSheet.timezone.desc=Timezone of the image",
128 "ImageNode.createSheet.deviceId.name=Device ID",
129 "ImageNode.createSheet.deviceId.displayName=Device ID",
130 "ImageNode.createSheet.deviceId.desc=Device ID of the image"})
132 Sheet s = super.createSheet();
133 Sheet.Set ss = s.get(Sheet.PROPERTIES);
135 ss = Sheet.createPropertiesSet();
139 ss.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ImageNode.createSheet.name.name"),
140 NbBundle.getMessage(
this.getClass(),
"ImageNode.createSheet.name.displayName"),
141 NbBundle.getMessage(
this.getClass(),
"ImageNode.createSheet.name.desc"),
144 ss.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_type_name(),
145 Bundle.ImageNode_createSheet_type_displayName(),
146 Bundle.ImageNode_createSheet_type_desc(),
147 Bundle.ImageNode_createSheet_type_text()));
149 ss.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_size_name(),
150 Bundle.ImageNode_createSheet_size_displayName(),
151 Bundle.ImageNode_createSheet_size_desc(),
152 this.content.getSize()));
153 ss.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_sectorSize_name(),
154 Bundle.ImageNode_createSheet_sectorSize_displayName(),
155 Bundle.ImageNode_createSheet_sectorSize_desc(),
156 this.content.getSsize()));
158 ss.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_md5_name(),
159 Bundle.ImageNode_createSheet_md5_displayName(),
160 Bundle.ImageNode_createSheet_md5_desc(),
161 this.content.getMd5()));
163 ss.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_timezone_name(),
164 Bundle.ImageNode_createSheet_timezone_displayName(),
165 Bundle.ImageNode_createSheet_timezone_desc(),
166 this.content.getTimeZone()));
169 ResultSet deviceIdSet = query.getResultSet();
170 if (deviceIdSet.next()) {
171 ss.put(
new NodeProperty<>(Bundle.ImageNode_createSheet_deviceId_name(),
172 Bundle.ImageNode_createSheet_deviceId_displayName(),
173 Bundle.ImageNode_createSheet_deviceId_desc(),
174 deviceIdSet.getString(
"device_id")));
176 }
catch (SQLException | TskCoreException ex) {
177 logger.log(Level.SEVERE,
"Failed to get device id for the following image: " +
this.content.getId(), ex);
184 public <T> T accept(ContentNodeVisitor<T> v) {
185 return v.visit(
this);
195 return v.
visit(
this);
static List< Action > getActions(Content c)
Action[] getActions(boolean context)
T visit(DataSourcesNode in)
SleuthkitCase getSleuthkitCase()
static final Logger logger
static Case getCurrentCase()
synchronized static Logger getLogger(String name)