19 package org.sleuthkit.autopsy.discovery;
21 import java.util.LinkedHashMap;
22 import javax.swing.SwingWorker;
23 import java.util.List;
25 import java.util.logging.Level;
34 final class SearchWorker
extends SwingWorker<Void, Void> {
36 private final static Logger logger = Logger.getLogger(SearchWorker.class.getName());
37 private static final String USER_NAME_PROPERTY =
"user.name";
38 private final List<FileSearchFiltering.FileFilter> filters;
39 private final FileSearch.AttributeType groupingAttr;
40 private final FileSorter.SortingMethod fileSort;
41 private final FileGroup.GroupSortingAlgorithm groupSortAlgorithm;
42 private final CentralRepository centralRepoDb;
43 private final Map<GroupKey, Integer> results =
new LinkedHashMap<>();
55 SearchWorker(CentralRepository centralRepo, List<FileSearchFiltering.FileFilter> searchfilters, FileSearch.AttributeType groupingAttribute, FileGroup.GroupSortingAlgorithm groupSort, FileSorter.SortingMethod fileSortMethod) {
56 centralRepoDb = centralRepo;
57 filters = searchfilters;
58 groupingAttr = groupingAttribute;
59 groupSortAlgorithm = groupSort;
60 fileSort = fileSortMethod;
64 protected Void doInBackground() throws Exception {
67 results.putAll(FileSearch.getGroupSizes(System.getProperty(USER_NAME_PROPERTY), filters,
71 Case.getCurrentCase().getSleuthkitCase(), centralRepoDb));
72 }
catch (FileSearchException ex) {
73 logger.log(Level.SEVERE,
"Error running file search test", ex);
80 protected void done() {
82 DiscoveryEventUtils.getDiscoveryEventBus().post(
new DiscoveryEventUtils.SearchCancelledEvent());
84 DiscoveryEventUtils.getDiscoveryEventBus().post(
new DiscoveryEventUtils.SearchCompleteEvent(results, filters, groupingAttr, groupSortAlgorithm, fileSort));