Autopsy  4.19.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
TagNamesEvent.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.List;
24 import org.sleuthkit.datamodel.SleuthkitCase;
25 import org.sleuthkit.datamodel.TagName;
26 import org.sleuthkit.datamodel.TaggingManager;
27 import org.sleuthkit.datamodel.TskCoreException;
28 
32 public class TagNamesEvent extends TskDataModelChangedEvent<TagName, TagName> {
33 
34  private static final long serialVersionUID = 1L;
35 
42  private TagNamesEvent(String eventName, List<TagName> tagNames) {
43  super(eventName, null, null, tagNames, TagName::getId);
44  }
45 
51  public List<TagName> getTagNames() {
52  return getNewValue();
53  }
54 
55  @Override
56  protected List<TagName> getNewValueObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
57  List<TagName> tagNames = new ArrayList<>();
58  TaggingManager taggingMrg = caseDb.getTaggingManager();
59  for (Long id : ids) {
60  tagNames.add(taggingMrg.getTagName(id));
61  }
62 
63  return tagNames;
64  }
65 
70  public static class TagNamesAddedEvent extends TagNamesEvent {
71 
72  private static final long serialVersionUID = 1L;
73 
80  public TagNamesAddedEvent(List<TagName> tagNames) {
81  super(Case.Events.TAG_NAMES_ADDED.name(), tagNames);
82  }
83  }
84 
89  public static class TagNamesUpdatedEvent extends TagNamesEvent {
90 
91  private static final long serialVersionUID = 1L;
92 
99  public TagNamesUpdatedEvent(List<TagName> tagNames) {
100  super(Case.Events.TAG_NAMES_UPDATED.name(), tagNames);
101  }
102  }
103 
109 
110  private static final long serialVersionUID = 1L;
111 
118  public TagNamesDeletedEvent(List<Long> tagNameIds) {
119  super(Case.Events.TAG_NAMES_DELETED.name(), tagNameIds);
120  }
121 
122  public List<Long> getTagNameIds() {
123  return getOldValue();
124  }
125  }
126 }
TagNamesEvent(String eventName, List< TagName > tagNames)
List< TagName > getNewValueObjects(SleuthkitCase caseDb, List< Long > ids)

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