Sleuth Kit Java Bindings (JNI)  4.12.1
Java bindings for using The Sleuth Kit
TskEvent.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2020-2021 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 com.google.common.collect.ImmutableSet;
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.List;
25 import java.util.Optional;
26 
30 public interface TskEvent {
31 
39  default Optional<Long> getDataSourceId() {
40  return Optional.ofNullable(null);
41  }
42 
50  abstract static class TskObjectsEvent<T> implements TskEvent {
51 
52  private final List<T> dataModelObjects;
53 
61  TskObjectsEvent(List<T> dataModelObjects) {
62  this.dataModelObjects = new ArrayList<>();
63  this.dataModelObjects.addAll(dataModelObjects);
64  }
65 
71  List<T> getDataModelObjects() {
72  return Collections.unmodifiableList(dataModelObjects);
73  }
74 
75  }
76 
81  public final static class AggregateScoresChangedEvent extends TskObjectsEvent<ScoreChange> {
82 
83  private final Long dataSourceObjectId;
84 
91  AggregateScoresChangedEvent(Long dataSourceObjectId, ImmutableSet<ScoreChange> scoreChanges) {
92  super(scoreChanges.asList());
93  this.dataSourceObjectId = dataSourceObjectId;
94  scoreChanges.stream().forEach(chg -> {
95  if (!chg.getDataSourceObjectId().equals(dataSourceObjectId)) {
96  throw new IllegalArgumentException("All data source object IDs in List<ScoreChange> must match dataSourceObjectId");
97  }
98  });
99  }
100 
101  @Override
102  public Optional<Long> getDataSourceId() {
103  return Optional.ofNullable(dataSourceObjectId);
104  }
105 
111  public List<ScoreChange> getScoreChanges() {
112  return getDataModelObjects();
113  }
114 
115  }
116 
120  public final static class AnalysisResultsDeletedTskEvent extends TskObjectsEvent<Long> {
121 
129  AnalysisResultsDeletedTskEvent(List<Long> deletedResultObjIds) {
130  super(deletedResultObjIds);
131  }
132 
138  public List<Long> getAnalysisResultObjectIds() {
139  return getDataModelObjects();
140  }
141 
142  }
143 
147  abstract static class HostsTskEvent extends TskObjectsEvent<Host> {
148 
154  HostsTskEvent(List<Host> hosts) {
155  super(hosts);
156  }
157 
163  public List<Host> getHosts() {
164  return getDataModelObjects();
165  }
166 
167  }
168 
172  public final static class HostsAddedTskEvent extends HostsTskEvent {
173 
179  HostsAddedTskEvent(List<Host> hosts) {
180  super(hosts);
181  }
182 
183  }
184 
188  public final static class HostsUpdatedTskEvent extends HostsTskEvent {
189 
195  HostsUpdatedTskEvent(List<Host> hosts) {
196  super(hosts);
197  }
198 
199  }
200 
204  public final static class HostsDeletedTskEvent extends TskObjectsEvent<Long> {
205 
211  HostsDeletedTskEvent(List<Long> hostIds) {
212  super(hostIds);
213  }
214 
220  public List<Long> getHostIds() {
221  return getDataModelObjects();
222  }
223 
224  }
225 
229  abstract static class OsAccountsTskEvent extends TskObjectsEvent<OsAccount> {
230 
236  OsAccountsTskEvent(List<OsAccount> osAccounts) {
237  super(osAccounts);
238  }
239 
245  public List<OsAccount> getOsAcounts() {
246  return getDataModelObjects();
247  }
248 
249  }
250 
254  public final static class OsAccountsAddedTskEvent extends OsAccountsTskEvent {
255 
261  OsAccountsAddedTskEvent(List<OsAccount> osAccounts) {
262  super(osAccounts);
263  }
264 
265  }
266 
270  public final static class OsAccountsUpdatedTskEvent extends OsAccountsTskEvent {
271 
277  OsAccountsUpdatedTskEvent(List<OsAccount> osAccounts) {
278  super(osAccounts);
279  }
280 
281  }
282 
286  public final static class OsAccountsDeletedTskEvent extends TskObjectsEvent<Long> {
287 
294  OsAccountsDeletedTskEvent(List<Long> accountObjectIds) {
295  super(accountObjectIds);
296  }
297 
303  public List<Long> getOsAccountObjectIds() {
304  return getDataModelObjects();
305  }
306 
307  }
308 
312  public final static class OsAccountsMergedTskEvent extends TskObjectsEvent<MergedAccountsPair> {
313 
320  OsAccountsMergedTskEvent(List<MergedAccountsPair> mergedAccounts) {
321  super(mergedAccounts);
322  }
323 
324 
330  public List<MergedAccountsPair> getMergedAccountPairs() {
331  return getDataModelObjects();
332  }
333 
334  }
335 
339  public final static class MergedAccountsPair {
340 
341  private final Long sourceOsAccountId;
342  private final Long destinationOsAccountId;
343 
344  public MergedAccountsPair(Long sourceOsAccountId, Long destinationOsAccountId) {
345  this.sourceOsAccountId = sourceOsAccountId;
346  this.destinationOsAccountId = destinationOsAccountId;
347  }
348 
353  public Long getSourceOsAccountId() {
354  return sourceOsAccountId;
355  }
356 
362  return destinationOsAccountId;
363  }
364  }
365 
369  public final static class OsAcctInstancesAddedTskEvent extends TskObjectsEvent<OsAccountInstance> {
370 
378  OsAcctInstancesAddedTskEvent(List<OsAccountInstance> osAcctInstances) {
379  super(osAcctInstances);
380  }
381 
387  public List<OsAccountInstance> getOsAccountInstances() {
388  return getDataModelObjects();
389  }
390 
391  }
392 
396  static abstract class PersonsTskEvent extends TskObjectsEvent<Person> {
397 
403  PersonsTskEvent(List<Person> persons) {
404  super(persons);
405  }
406 
412  public List<Person> getPersons() {
413  return getDataModelObjects();
414  }
415 
416  }
417 
421  public final static class PersonsAddedTskEvent extends PersonsTskEvent {
422 
428  PersonsAddedTskEvent(List<Person> persons) {
429  super(persons);
430  }
431 
432  }
433 
437  public final static class PersonsUpdatedTskEvent extends PersonsTskEvent {
438 
444  PersonsUpdatedTskEvent(List<Person> persons) {
445  super(persons);
446  }
447 
448  }
449 
453  public final static class PersonsDeletedTskEvent extends TskObjectsEvent<Long> {
454 
460  PersonsDeletedTskEvent(List<Long> personObjectIDs) {
461  super(personObjectIDs);
462  }
463 
469  public List<Long> getPersonIds() {
470  return getDataModelObjects();
471  }
472 
473  }
474 
478  public final static class HostsAddedToPersonTskEvent extends TskObjectsEvent<Host> {
479 
480  private final Person person;
481 
489  HostsAddedToPersonTskEvent(Person person, List<Host> hosts) {
490  super(hosts);
491  this.person = person;
492  }
493 
499  public Person getPerson() {
500  return person;
501  }
502 
508  public List<Host> getHosts() {
509  return getDataModelObjects();
510  }
511 
512  }
513 
517  public final static class HostsRemovedFromPersonTskEvent extends TskObjectsEvent<Long> {
518 
519  private final Person person;
520 
528  HostsRemovedFromPersonTskEvent(Person person, List<Long> hostIds) {
529  super(hostIds);
530  this.person = person;
531  }
532 
538  public Person getPerson() {
539  return person;
540  }
541 
547  public List<Long> getHostIds() {
548  return getDataModelObjects();
549  }
550 
551  }
552 
553  static abstract class TagNamesTskEvent extends TskObjectsEvent<TagName> {
554 
555  public TagNamesTskEvent(List<TagName> tagNames) {
556  super(tagNames);
557  }
558 
564  public List<TagName> getTagNames() {
565  return getDataModelObjects();
566  }
567 
568  }
569 
573  public final static class TagNamesAddedTskEvent extends TagNamesTskEvent {
574 
580  public TagNamesAddedTskEvent(List<TagName> tagNames) {
581  super(tagNames);
582  }
583  }
584 
588  public final static class TagNamesUpdatedTskEvent extends TagNamesTskEvent {
589 
595  public TagNamesUpdatedTskEvent(List<TagName> tagNames) {
596  super(tagNames);
597  }
598  }
599 
603  public final static class TagNamesDeletedTskEvent extends TskObjectsEvent<Long> {
604 
610  public TagNamesDeletedTskEvent(List<Long> tagNameIds) {
611  super(tagNameIds);
612  }
613 
619  public List<Long> getTagNameIds() {
620  return getDataModelObjects();
621  }
622 
623  }
624 
628  public final static class TagSetsAddedTskEvent extends TskObjectsEvent<TagSet> {
629 
635  public TagSetsAddedTskEvent(List<TagSet> tagSets) {
636  super(tagSets);
637  }
638 
644  public List<TagSet> getTagSets() {
645  return getDataModelObjects();
646  }
647  }
648 
652  public final static class TagSetsDeletedTskEvent extends TskObjectsEvent<Long> {
653 
659  public TagSetsDeletedTskEvent(List<Long> tagSetIds) {
660  super(tagSetIds);
661  }
662 
668  public List<Long> getTagSetIds() {
669  return getDataModelObjects();
670  }
671  }
672 }
default Optional< Long > getDataSourceId()
Definition: TskEvent.java:39
MergedAccountsPair(Long sourceOsAccountId, Long destinationOsAccountId)
Definition: TskEvent.java:344

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