Autopsy  4.15.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
DiscoveryEventUtils.java
Go to the documentation of this file.
1 /*
2  * Autopsy
3  *
4  * Copyright 2019-2020 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.discovery;
20 
21 import com.google.common.eventbus.EventBus;
22 import java.util.Collections;
23 import java.util.List;
24 import java.util.Map;
27 import org.sleuthkit.datamodel.AbstractFile;
28 
32 final class DiscoveryEventUtils {
33 
34  private final static EventBus discoveryEventBus = new EventBus();
35 
41  static EventBus getDiscoveryEventBus() {
42  return discoveryEventBus;
43  }
44 
48  private DiscoveryEventUtils() {
49  //Utility class private constructor intentionally left blank.
50  }
51 
55  static final class SearchStartedEvent {
56 
57  private final FileType fileType;
58 
64  SearchStartedEvent(FileType type) {
65  this.fileType = type;
66  }
67 
73  FileType getType() {
74  return fileType;
75  }
76  }
77 
81  static final class ClearInstanceSelectionEvent {
82 
86  ClearInstanceSelectionEvent() {
87  //no arg constructor
88  }
89  }
90 
94  static final class PopulateInstancesListEvent {
95 
96  private final List<AbstractFile> instances;
97 
101  PopulateInstancesListEvent(List<AbstractFile> files) {
102  instances = files;
103  }
104 
108  List<AbstractFile> getInstances() {
109  return Collections.unmodifiableList(instances);
110  }
111  }
112 
116  static final class SearchCompleteEvent {
117 
118  private final Map<GroupKey, Integer> groupMap;
119  private final List<FileSearchFiltering.FileFilter> searchFilters;
120  private final FileSearch.AttributeType groupingAttribute;
121  private final FileGroup.GroupSortingAlgorithm groupSort;
122  private final FileSorter.SortingMethod fileSortMethod;
123 
135  SearchCompleteEvent(Map<GroupKey, Integer> groupMap, List<FileSearchFiltering.FileFilter> searchfilters,
136  FileSearch.AttributeType groupingAttribute, FileGroup.GroupSortingAlgorithm groupSort,
137  FileSorter.SortingMethod fileSortMethod) {
138  this.groupMap = groupMap;
139  this.searchFilters = searchfilters;
140  this.groupingAttribute = groupingAttribute;
141  this.groupSort = groupSort;
142  this.fileSortMethod = fileSortMethod;
143  }
144 
150  Map<GroupKey, Integer> getGroupMap() {
151  return Collections.unmodifiableMap(groupMap);
152  }
153 
159  List<FileSearchFiltering.FileFilter> getFilters() {
160  return Collections.unmodifiableList(searchFilters);
161  }
162 
168  FileSearch.AttributeType getGroupingAttr() {
169  return groupingAttribute;
170  }
171 
177  FileGroup.GroupSortingAlgorithm getGroupSort() {
178  return groupSort;
179  }
180 
186  FileSorter.SortingMethod getFileSort() {
187  return fileSortMethod;
188  }
189 
190  }
191 
196  static final class PageRetrievedEvent {
197 
198  private final List<ResultFile> results;
199  private final int page;
200  private final FileType resultType;
201 
209  PageRetrievedEvent(FileType resultType, int page, List<ResultFile> results) {
210  this.results = results;
211  this.page = page;
212  this.resultType = resultType;
213  }
214 
220  List<ResultFile> getSearchResults() {
221  return Collections.unmodifiableList(results);
222  }
223 
229  int getPageNumber() {
230  return page;
231  }
232 
238  FileType getType() {
239  return resultType;
240  }
241  }
242 
246  static final class NoResultsEvent {
247 
251  NoResultsEvent() {
252  //no arg constructor
253  }
254  }
255 
259  static final class SearchCancelledEvent {
260 
264  SearchCancelledEvent() {
265  //no arg constructor
266  }
267 
268  }
269 
273  static final class GroupSelectedEvent {
274 
275  private final FileType resultType;
276  private final GroupKey groupKey;
277  private final int groupSize;
278  private final List<FileSearchFiltering.FileFilter> searchfilters;
279  private final FileSearch.AttributeType groupingAttribute;
280  private final FileGroup.GroupSortingAlgorithm groupSort;
281  private final FileSorter.SortingMethod fileSortMethod;
282 
297  GroupSelectedEvent(List<FileSearchFiltering.FileFilter> searchfilters,
298  FileSearch.AttributeType groupingAttribute, FileGroup.GroupSortingAlgorithm groupSort,
299  FileSorter.SortingMethod fileSortMethod, GroupKey groupKey, int groupSize, FileType resultType) {
300  this.searchfilters = searchfilters;
301  this.groupingAttribute = groupingAttribute;
302  this.groupSort = groupSort;
303  this.fileSortMethod = fileSortMethod;
304  this.groupKey = groupKey;
305  this.groupSize = groupSize;
306  this.resultType = resultType;
307  }
308 
314  FileType getResultType() {
315  return resultType;
316  }
317 
325  GroupKey getGroupKey() {
326  return groupKey;
327  }
328 
334  int getGroupSize() {
335  return groupSize;
336  }
337 
343  FileGroup.GroupSortingAlgorithm getGroupSort() {
344  return groupSort;
345  }
346 
352  FileSorter.SortingMethod getFileSort() {
353  return fileSortMethod;
354  }
355 
361  List<FileSearchFiltering.FileFilter> getFilters() {
362  return Collections.unmodifiableList(searchfilters);
363  }
364 
370  FileSearch.AttributeType getGroupingAttr() {
371  return groupingAttribute;
372  }
373 
374  }
375 
379  static class DetailsVisibleEvent {
380 
381  private final boolean showDetailsArea;
382 
389  DetailsVisibleEvent(boolean isVisible) {
390  showDetailsArea = isVisible;
391  }
392 
398  boolean isShowDetailsArea() {
399  return showDetailsArea;
400  }
401  }
402 
403 }

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