Autopsy  4.17.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.search;
20 
21 import com.google.common.eventbus.EventBus;
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.List;
25 import java.util.Map;
28 import org.sleuthkit.datamodel.AbstractFile;
29 import org.sleuthkit.datamodel.BlackboardArtifact;
30 
34 public final class DiscoveryEventUtils {
35 
36  private final static EventBus discoveryEventBus = new EventBus();
37 
43  public static EventBus getDiscoveryEventBus() {
44  return discoveryEventBus;
45  }
46 
50  private DiscoveryEventUtils() {
51  //Utility class private constructor intentionally left blank.
52  }
53 
57  public static final class SearchStartedEvent {
58 
59  private final Type type;
60 
66  public SearchStartedEvent(Type type) {
67  this.type = type;
68  }
69 
75  public Type getType() {
76  return type;
77  }
78 
79  }
80 
84  public static final class ClearInstanceSelectionEvent {
85 
90  //no arg constructor
91  }
92  }
93 
98  public static final class CancelBackgroundTasksEvent {
99 
101  //no-arg constructor
102  }
103  }
104 
108  public static final class PopulateInstancesListEvent {
109 
110  private final List<AbstractFile> instances;
111 
115  public PopulateInstancesListEvent(List<AbstractFile> files) {
116  instances = files;
117  }
118 
124  public List<AbstractFile> getInstances() {
125  return Collections.unmodifiableList(instances);
126  }
127  }
128 
132  public static final class PopulateDomainTabsEvent {
133 
134  private final String domain;
135 
139  public PopulateDomainTabsEvent(String domain) {
140  this.domain = domain;
141  }
142 
148  public String getDomain() {
149  return domain;
150  }
151  }
152 
156  public static final class SearchCompleteEvent {
157 
158  private final Map<GroupKey, Integer> groupMap;
159  private final List<AbstractFilter> searchFilters;
163 
175  public SearchCompleteEvent(Map<GroupKey, Integer> groupMap, List<AbstractFilter> searchfilters,
178  this.groupMap = groupMap;
179  this.searchFilters = searchfilters;
181  this.groupSort = groupSort;
182  this.sortMethod = sortMethod;
183  }
184 
190  public Map<GroupKey, Integer> getGroupMap() {
191  return Collections.unmodifiableMap(groupMap);
192  }
193 
199  public List<AbstractFilter> getFilters() {
200  return Collections.unmodifiableList(searchFilters);
201  }
202 
209  return groupingAttribute;
210  }
211 
218  return groupSort;
219  }
220 
227  return sortMethod;
228  }
229 
230  }
231 
235  public static final class ArtifactSearchResultEvent {
236 
237  private final List<BlackboardArtifact> listOfArtifacts = new ArrayList<>();
238  private final BlackboardArtifact.ARTIFACT_TYPE artifactType;
239 
247  public ArtifactSearchResultEvent(BlackboardArtifact.ARTIFACT_TYPE artifactType, List<BlackboardArtifact> listOfArtifacts) {
248  if (listOfArtifacts != null) {
249  this.listOfArtifacts.addAll(listOfArtifacts);
250  }
251  this.artifactType = artifactType;
252  }
253 
259  public List<BlackboardArtifact> getListOfArtifacts() {
260  return Collections.unmodifiableList(listOfArtifacts);
261  }
262 
268  public BlackboardArtifact.ARTIFACT_TYPE getArtifactType() {
269  return artifactType;
270  }
271  }
272 
277  public static final class MiniTimelineResultEvent {
278 
279  private final List<MiniTimelineResult> results = new ArrayList<>();
280  private final String domain;
281 
289  public MiniTimelineResultEvent(List<MiniTimelineResult> results, String domain) {
290  if (results != null) {
291  this.results.addAll(results);
292  }
293  this.domain = domain;
294  }
295 
301  public List<MiniTimelineResult> getResultList() {
302  return Collections.unmodifiableList(results);
303  }
304 
310  public String getDomain() {
311  return domain;
312  }
313  }
314 
319  public static final class PageRetrievedEvent {
320 
321  private final List<Result> results;
322  private final int page;
323  private final Type resultType;
324 
332  public PageRetrievedEvent(Type resultType, int page, List<Result> results) {
333  this.results = results;
334  this.page = page;
335  this.resultType = resultType;
336  }
337 
343  public List<Result> getSearchResults() {
344  return Collections.unmodifiableList(results);
345  }
346 
352  public int getPageNumber() {
353  return page;
354  }
355 
361  public Type getType() {
362  return resultType;
363  }
364  }
365 
369  public static final class NoResultsEvent {
370 
374  public NoResultsEvent() {
375  //no arg constructor
376  }
377  }
378 
382  public static final class SearchCancelledEvent {
383 
388  //no arg constructor
389  }
390 
391  }
392 
396  public static final class GroupSelectedEvent {
397 
398  private final Type resultType;
399  private final GroupKey groupKey;
400  private final int groupSize;
401  private final List<AbstractFilter> searchfilters;
405 
421  public GroupSelectedEvent(List<AbstractFilter> searchfilters,
423  ResultsSorter.SortingMethod sortMethod, GroupKey groupKey, int groupSize, Type resultType) {
424  this.searchfilters = searchfilters;
426  this.groupSort = groupSort;
427  this.sortMethod = sortMethod;
428  this.groupKey = groupKey;
429  this.groupSize = groupSize;
430  this.resultType = resultType;
431  }
432 
438  public Type getResultType() {
439  return resultType;
440  }
441 
450  return groupKey;
451  }
452 
458  public int getGroupSize() {
459  return groupSize;
460  }
461 
468  return groupSort;
469  }
470 
477  return sortMethod;
478  }
479 
485  public List<AbstractFilter> getFilters() {
486  return Collections.unmodifiableList(searchfilters);
487  }
488 
495  return groupingAttribute;
496  }
497 
498  }
499 
503  public static class DetailsVisibleEvent {
504 
505  private final boolean showDetailsArea;
506 
513  public DetailsVisibleEvent(boolean isVisible) {
514  showDetailsArea = isVisible;
515  }
516 
522  public boolean isShowDetailsArea() {
523  return showDetailsArea;
524  }
525  }
526 
527 }
GroupSelectedEvent(List< AbstractFilter > searchfilters, DiscoveryAttributes.AttributeType groupingAttribute, Group.GroupSortingAlgorithm groupSort, ResultsSorter.SortingMethod sortMethod, GroupKey groupKey, int groupSize, Type resultType)
ArtifactSearchResultEvent(BlackboardArtifact.ARTIFACT_TYPE artifactType, List< BlackboardArtifact > listOfArtifacts)
SearchCompleteEvent(Map< GroupKey, Integer > groupMap, List< AbstractFilter > searchfilters, DiscoveryAttributes.AttributeType groupingAttribute, Group.GroupSortingAlgorithm groupSort, ResultsSorter.SortingMethod sortMethod)

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