Sleuth Kit Java Bindings (JNI)  4.8.0
Java bindings for using The Sleuth Kit
TimelineEvent.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2018-2019 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.datamodel;
20 
21 import java.util.Optional;
22 
26 public final class TimelineEvent {
27 
31  private final long eventID;
32 
40  private final long contentObjID;
41 
46  private final Long artifactID;
47 
51  private final long dataSourceObjID;
52 
56  private final long time;
57 
61  private final TimelineEventType type;
62 
68  private final TimelineEventDescription descriptions;
69 
74  private final boolean eventSourceHashHitDetected;
75 
80  private final boolean eventSourceTagged;
81 
118  TimelineEvent(long eventID,
119  long dataSourceObjID,
120  long contentObjID,
121  Long artifactID,
122  long time,
123  TimelineEventType type,
124  String fullDescription,
125  String medDescription,
126  String shortDescription,
127  boolean eventSourceHashHitDetected,
128  boolean eventSourceTagged) {
129  this.eventID = eventID;
130  this.dataSourceObjID = dataSourceObjID;
131  this.contentObjID = contentObjID;
132  this.artifactID = Long.valueOf(0).equals(artifactID) ? null : artifactID;
133  this.time = time;
134  this.type = type;
135  /*
136  * The cast that follows reflects the fact that we have not decided
137  * whether or not to add the parseDescription method to the
138  * TimelineEventType interface yet. Currently (9/18/19), this method is
139  * part of TimelineEventTypeImpl and all implementations of
140  * TimelineEventType are subclasses of TimelineEventTypeImpl.
141  */
142  if (type instanceof TimelineEventTypeImpl) {
143  this.descriptions = ((TimelineEventTypeImpl) type).parseDescription(fullDescription, medDescription, shortDescription);
144  } else {
145  this.descriptions = new TimelineEventDescription(fullDescription, medDescription, shortDescription);
146  }
147  this.eventSourceHashHitDetected = eventSourceHashHitDetected;
148  this.eventSourceTagged = eventSourceTagged;
149  }
150 
157  public boolean eventSourceIsTagged() {
158  return eventSourceTagged;
159  }
160 
168  public boolean eventSourceHasHashHits() {
169  return eventSourceHashHitDetected;
170  }
171 
178  public Optional<Long> getArtifactID() {
179  return Optional.ofNullable(artifactID);
180  }
181 
187  public long getEventID() {
188  return eventID;
189  }
190 
200  public long getContentObjID() {
201  return contentObjID;
202  }
203 
209  public long getTime() {
210  return time;
211  }
212 
219  return type;
220  }
221 
229  public String getDescription(TimelineLevelOfDetail levelOfDetail) {
230  return descriptions.getDescription(levelOfDetail);
231  }
232 
239  public long getDataSourceObjID() {
240  return dataSourceObjID;
241  }
242 
248  public long getEventTimeInMs() {
249  return time * 1000;
250  }
251 
252  @Override
253  public int hashCode() {
254  int hash = 7;
255  hash = 13 * hash + (int) (this.eventID ^ (this.eventID >>> 32));
256  return hash;
257  }
258 
259  @Override
260  public boolean equals(Object obj) {
261  if (obj == null) {
262  return false;
263  }
264  if (getClass() != obj.getClass()) {
265  return false;
266  }
267  final TimelineEvent other = (TimelineEvent) obj;
268  return this.eventID == other.getEventID();
269  }
270 
271 }
String getDescription(TimelineLevelOfDetail levelOfDetail)

Copyright © 2011-2020 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.