Autopsy  4.9.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
ViewArtifactInTimelineAction.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2016 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.timeline.actions;
20 
21 import java.awt.event.ActionEvent;
22 import java.util.Set;
23 import java.util.stream.Collectors;
24 import javax.swing.AbstractAction;
25 import org.openide.util.NbBundle;
26 import org.openide.util.actions.SystemAction;
30 import org.sleuthkit.datamodel.BlackboardArtifact;
31 import org.sleuthkit.datamodel.BlackboardAttribute;
32 import org.sleuthkit.datamodel.TskCoreException;
33 
37 public final class ViewArtifactInTimelineAction extends AbstractAction {
38 
39  private static final long serialVersionUID = 1L;
40 
41  private static final Set<ArtifactEventType> ARTIFACT_EVENT_TYPES =
42  EventType.allTypes.stream()
43  .filter((EventType t) -> t instanceof ArtifactEventType)
44  .map(ArtifactEventType.class::cast)
45  .collect(Collectors.toSet());
46 
47  private final BlackboardArtifact artifact;
48 
49  @NbBundle.Messages({"ViewArtifactInTimelineAction.displayName=View Result in Timeline... "})
50  public ViewArtifactInTimelineAction(BlackboardArtifact artifact) {
51  super(Bundle.ViewArtifactInTimelineAction_displayName());
52  this.artifact = artifact;
53  }
54 
55  @Override
56  public void actionPerformed(ActionEvent e) {
57  SystemAction.get(OpenTimelineAction.class).showArtifactInTimeline(artifact);
58  }
59 
68  public static boolean hasSupportedTimeStamp(BlackboardArtifact artifact) throws TskCoreException {
69  //see if the given artifact is a supported type ...
70  for (ArtifactEventType artEventType : ARTIFACT_EVENT_TYPES) {
71  if (artEventType.getArtifactTypeID() == artifact.getArtifactTypeID()) {
72  //... and has a non-bogus timestamp in the supported attribute
73  BlackboardAttribute attribute = artifact.getAttribute(artEventType.getDateTimeAttributeType());
74  if (null != attribute && attribute.getValueLong() > 0) {
75  return true;
76  }
77  }
78  }
79  return false;
80  }
81 }
static final List<?extends EventType > allTypes
Definition: EventType.java:35

Copyright © 2012-2018 Basis Technology. Generated on: Tue Dec 18 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.