19 package org.sleuthkit.autopsy.timeline.explorernodes;
21 import java.lang.reflect.InvocationTargetException;
22 import java.text.MessageFormat;
23 import java.util.ArrayList;
24 import java.util.Arrays;
25 import java.util.List;
26 import java.util.logging.Level;
27 import javax.swing.Action;
28 import org.joda.time.DateTime;
29 import org.joda.time.DateTimeZone;
30 import org.openide.nodes.Children;
31 import org.openide.nodes.PropertySupport;
32 import org.openide.nodes.Sheet;
33 import org.openide.util.NbBundle;
34 import org.openide.util.lookup.Lookups;
65 super(Children.LEAF, Lookups.fixed(event, file, artifact));
71 super(Children.LEAF, Lookups.fixed(event, file));
78 "NodeProperty.displayName.icon=Icon",
79 "NodeProperty.displayName.description=Description",
80 "NodeProperty.displayName.baseType=Base Type",
81 "NodeProperty.displayName.subType=Sub Type",
82 "NodeProperty.displayName.known=Known",
83 "NodeProperty.displayName.dateTime=Date/Time"})
85 Sheet sheet = super.createSheet();
86 Sheet.Set properties = sheet.get(Sheet.PROPERTIES);
87 if (properties == null) {
88 properties = Sheet.createPropertiesSet();
89 sheet.put(properties);
92 properties.put(
new NodeProperty<>(
"icon", Bundle.NodeProperty_displayName_icon(),
"icon",
true));
94 properties.put(
new NodeProperty<>(
"description", Bundle.NodeProperty_displayName_description(),
"description",
event.getFullDescription()));
95 properties.put(
new NodeProperty<>(
"eventBaseType", Bundle.NodeProperty_displayName_baseType(),
"base type",
event.getEventType().getSuperType().getDisplayName()));
96 properties.put(
new NodeProperty<>(
"eventSubType", Bundle.NodeProperty_displayName_subType(),
"sub type",
event.getEventType().getDisplayName()));
97 properties.put(
new NodeProperty<>(
"Known", Bundle.NodeProperty_displayName_known(),
"known",
event.getKnown().toString()));
115 "EventNode.getAction.errorTitle=Error getting actions",
116 "EventNode.getAction.linkedFileMessage=There was a problem getting actions for the selected result. "
117 +
" The 'View File in Timeline' action will not be available."})
119 Action[] superActions = super.getActions(context);
120 List<Action> actionsList =
new ArrayList<>();
121 actionsList.addAll(Arrays.asList(superActions));
123 final AbstractFile sourceFile = getLookup().lookup(AbstractFile.class);
129 final BlackboardArtifact artifact = getLookup().lookup(BlackboardArtifact.class);
130 if (artifact != null) {
132 AbstractFile linkedfile = findLinked(artifact);
133 if (linkedfile != null) {
136 }
catch (TskCoreException ex) {
137 LOGGER.log(Level.SEVERE, MessageFormat.format(
"Error getting linked file from blackboard artifact{0}.", artifact.getArtifactID()), ex);
142 if (null != sourceFile) {
150 actionsList.addAll(factoryActions);
151 return actionsList.toArray(
new Action[actionsList.size()]);
161 throw new UnsupportedOperationException(
"Not supported yet.");
166 return getClass().getName();
173 final private class TimeProperty extends PropertySupport.ReadWrite<String> {
182 TimeProperty(String name, String displayName, String shortDescription, String value) {
183 super(name, String.class, displayName, shortDescription);
184 setValue(
"suppressCustomEditor", Boolean.TRUE);
189 }
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
190 LOGGER.log(Level.SEVERE,
"Unexpected error setting date/time property on EventNode explorer node", ex);
197 public String
getValue() throws IllegalAccessException, InvocationTargetException {
202 public void setValue(String t)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
205 firePropertyChange(
"time", oldValue, t);
224 final SingleEvent eventById = eventsModel.getEventById(eventID);
227 AbstractFile file = sleuthkitCase.getAbstractFileById(eventById.
getFileID());
230 BlackboardArtifact blackboardArtifact = sleuthkitCase.getBlackboardArtifact(eventById.
getArtifactID().get());
231 return new EventNode(eventById, file, blackboardArtifact);
249 static AbstractFile findLinked(BlackboardArtifact artifact)
throws TskCoreException {
251 BlackboardAttribute pathIDAttribute = artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID));
253 if (pathIDAttribute != null) {
254 long contentID = pathIDAttribute.getValueLong();
255 if (contentID != -1) {
256 return artifact.getSleuthkitCase().getAbstractFileById(contentID);
Optional< Long > getArtifactID()
static EventNode createEventNode(final Long eventID, FilteredEventsModel eventsModel)
Action[] getActions(boolean context)
static ReadOnlyObjectProperty< TimeZone > getTimeZone()
static List< Action > getActions(File file, boolean isArtifactSource)
static Case getOpenCase()
String getDateTimeString()
static ViewFileInTimelineAction createViewSourceFileAction(AbstractFile file)
static final long serialVersionUID
SleuthkitCase getSleuthkitCase()
static void error(String title, String message)
synchronized static Logger getLogger(String name)
static final Logger LOGGER
static DateTimeFormatter getZonedFormatter()
static ViewFileInTimelineAction createViewFileAction(AbstractFile file)