Autopsy  4.19.3
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 
142  public PopulateDomainTabsEvent(String domain) {
143  this.domain = domain;
144  }
145 
151  public String getDomain() {
152  return domain;
153  }
154  }
155 
159  public static final class SearchCompleteEvent {
160 
161  private final Map<GroupKey, Integer> groupMap;
162  private final List<AbstractFilter> searchFilters;
166 
178  public SearchCompleteEvent(Map<GroupKey, Integer> groupMap, List<AbstractFilter> searchfilters,
181  this.groupMap = groupMap;
182  this.searchFilters = searchfilters;
184  this.groupSort = groupSort;
185  this.sortMethod = sortMethod;
186  }
187 
193  public Map<GroupKey, Integer> getGroupMap() {
194  return Collections.unmodifiableMap(groupMap);
195  }
196 
202  public List<AbstractFilter> getFilters() {
203  return Collections.unmodifiableList(searchFilters);
204  }
205 
212  return groupingAttribute;
213  }
214 
221  return groupSort;
222  }
223 
230  return sortMethod;
231  }
232 
233  }
234 
238  public static final class ArtifactSearchResultEvent {
239 
240  private final List<BlackboardArtifact> listOfArtifacts = new ArrayList<>();
241  private final BlackboardArtifact.ARTIFACT_TYPE artifactType;
242  private final boolean grabFocus;
243 
253  public ArtifactSearchResultEvent(BlackboardArtifact.ARTIFACT_TYPE artifactType, List<BlackboardArtifact> listOfArtifacts, boolean shouldGrabFocus) {
254  if (listOfArtifacts != null) {
255  this.listOfArtifacts.addAll(listOfArtifacts);
256  }
257  this.artifactType = artifactType;
258  this.grabFocus = shouldGrabFocus;
259  }
260 
266  public List<BlackboardArtifact> getListOfArtifacts() {
267  return Collections.unmodifiableList(listOfArtifacts);
268  }
269 
275  public BlackboardArtifact.ARTIFACT_TYPE getArtifactType() {
276  return artifactType;
277  }
278 
285  public boolean shouldGrabFocus() {
286  return grabFocus;
287  }
288 
289  }
290 
295  public static final class MiniTimelineResultEvent {
296 
297  private final List<MiniTimelineResult> results = new ArrayList<>();
298  private final String domain;
299  private final boolean grabFocus;
300 
310  public MiniTimelineResultEvent(List<MiniTimelineResult> results, String domain, boolean shouldGrabFocus) {
311  if (results != null) {
312  this.results.addAll(results);
313  }
314  this.grabFocus = shouldGrabFocus;
315  this.domain = domain;
316  }
317 
323  public List<MiniTimelineResult> getResultList() {
324  return Collections.unmodifiableList(results);
325  }
326 
332  public String getDomain() {
333  return domain;
334  }
335 
341  public boolean shouldGrabFocus() {
342  return grabFocus;
343  }
344  }
345 
350  public static final class PageRetrievedEvent {
351 
352  private final List<Result> results;
353  private final int page;
354  private final Type resultType;
355 
363  public PageRetrievedEvent(Type resultType, int page, List<Result> results) {
364  this.results = results;
365  this.page = page;
366  this.resultType = resultType;
367  }
368 
374  public List<Result> getSearchResults() {
375  return Collections.unmodifiableList(results);
376  }
377 
383  public int getPageNumber() {
384  return page;
385  }
386 
392  public Type getType() {
393  return resultType;
394  }
395  }
396 
400  public static final class NoResultsEvent {
401 
405  public NoResultsEvent() {
406  //no arg constructor
407  }
408  }
409 
413  public static final class SearchCancelledEvent {
414 
419  //no arg constructor
420  }
421 
422  }
423 
427  public static final class GroupSelectedEvent {
428 
429  private final Type resultType;
430  private final GroupKey groupKey;
431  private final int groupSize;
432  private final List<AbstractFilter> searchfilters;
436 
452  public GroupSelectedEvent(List<AbstractFilter> searchfilters,
454  ResultsSorter.SortingMethod sortMethod, GroupKey groupKey, int groupSize, Type resultType) {
455  this.searchfilters = searchfilters;
457  this.groupSort = groupSort;
458  this.sortMethod = sortMethod;
459  this.groupKey = groupKey;
460  this.groupSize = groupSize;
461  this.resultType = resultType;
462  }
463 
469  public Type getResultType() {
470  return resultType;
471  }
472 
481  return groupKey;
482  }
483 
489  public int getGroupSize() {
490  return groupSize;
491  }
492 
499  return groupSort;
500  }
501 
508  return sortMethod;
509  }
510 
516  public List<AbstractFilter> getFilters() {
517  return Collections.unmodifiableList(searchfilters);
518  }
519 
526  return groupingAttribute;
527  }
528 
529  }
530 
534  public static class DetailsVisibleEvent {
535 
536  private final boolean showDetailsArea;
537 
544  public DetailsVisibleEvent(boolean isVisible) {
545  showDetailsArea = isVisible;
546  }
547 
553  public boolean isShowDetailsArea() {
554  return showDetailsArea;
555  }
556  }
557 
558 }
MiniTimelineResultEvent(List< MiniTimelineResult > results, String domain, boolean shouldGrabFocus)
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, boolean shouldGrabFocus)
SearchCompleteEvent(Map< GroupKey, Integer > groupMap, List< AbstractFilter > searchfilters, DiscoveryAttributes.AttributeType groupingAttribute, Group.GroupSortingAlgorithm groupSort, ResultsSorter.SortingMethod sortMethod)

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