Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
HostsRemovedFromPersonEvent.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 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.autopsy.casemodule.events;
20 
21 import java.util.ArrayList;
22 import java.util.Collections;
23 import java.util.List;
24 import java.util.Optional;
26 import org.sleuthkit.datamodel.Host;
27 import org.sleuthkit.datamodel.Person;
28 import org.sleuthkit.datamodel.SleuthkitCase;
29 import org.sleuthkit.datamodel.TskCoreException;
30 
35 public class HostsRemovedFromPersonEvent extends TskDataModelChangedEvent<Person, Long> {
36 
37  private static final long serialVersionUID = 1L;
38 
46  public HostsRemovedFromPersonEvent(Person person, List<Long> hostIds) {
47  super(Case.Events.HOSTS_REMOVED_FROM_PERSON.toString(), Collections.singletonList(person), Person::getPersonId, hostIds, (id -> id));
48  }
49 
55  public Person getPerson() {
56  return getOldValue().get(0);
57  }
58 
64  public List<Long> getHostIds() {
65  return getNewValue();
66  }
67 
68  @Override
69  protected List<Person> getOldValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
70  List<Person> persons = new ArrayList<>();
71  for (Long id : ids) {
72  Optional<Person> person = caseDb.getPersonManager().getPerson(id);
73  if (person.isPresent()) {
74  persons.add(person.get());
75  }
76  }
77  return persons;
78  }
79 
80  @Override
81  protected List<Long> getNewValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
82  return ids;
83  }
84 
85 }
List< Person > getOldValueObjects(SleuthkitCase caseDb, List< Long > ids)
List< Long > getNewValueObjects(SleuthkitCase caseDb, List< Long > ids)

Copyright © 2012-2022 Basis Technology. Generated on: Fri Oct 7 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.