19 package org.sleuthkit.autopsy.filequery;
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 EamDb centralRepoDb;
43 private final Map<GroupKey, Integer> results =
new LinkedHashMap<>();
54 SearchWorker(EamDb centralRepo, List<FileSearchFiltering.FileFilter> searchfilters, FileSearch.AttributeType groupingAttribute, FileGroup.GroupSortingAlgorithm groupSort, FileSorter.SortingMethod fileSortMethod) {
55 centralRepoDb = centralRepo;
56 filters = searchfilters;
57 groupingAttr = groupingAttribute;
58 groupSortAlgorithm = groupSort;
59 fileSort = fileSortMethod;
63 protected Void doInBackground() throws Exception {
66 results.putAll(FileSearch.getGroupSizes(System.getProperty(USER_NAME_PROPERTY), filters,
70 Case.getCurrentCase().getSleuthkitCase(), centralRepoDb));
71 }
catch (FileSearchException ex) {
72 logger.log(Level.SEVERE,
"Error running file search test", ex);
79 protected void done() {
81 DiscoveryEventUtils.getDiscoveryEventBus().post(
new DiscoveryEventUtils.SearchCancelledEvent());
83 DiscoveryEventUtils.getDiscoveryEventBus().post(
new DiscoveryEventUtils.SearchCompleteEvent(results, filters, groupingAttr, groupSortAlgorithm, fileSort));