19 package org.sleuthkit.autopsy.filequery;
21 import java.util.List;
22 import java.util.ArrayList;
23 import java.util.logging.Level;
24 import javax.swing.SwingWorker;
33 final class PageWorker
extends SwingWorker<Void, Void> {
35 private final static Logger logger = Logger.getLogger(PageWorker.class.getName());
36 private static final String USER_NAME_PROPERTY =
"user.name";
37 private final List<FileSearchFiltering.FileFilter> searchfilters;
38 private final FileSearch.AttributeType groupingAttribute;
39 private final FileGroup.GroupSortingAlgorithm groupSort;
40 private final FileSorter.SortingMethod fileSortMethod;
41 private final GroupKey groupKey;
42 private final int startingEntry;
43 private final int pageSize;
44 private final FileSearchData.FileType resultType;
45 private final CentralRepository centralRepo;
46 private final List<ResultFile> results =
new ArrayList<>();
64 PageWorker(List<FileSearchFiltering.FileFilter> searchfilters, FileSearch.AttributeType groupingAttribute,
65 FileGroup.GroupSortingAlgorithm groupSort, FileSorter.SortingMethod fileSortMethod, GroupKey groupKey,
66 int startingEntry,
int pageSize, FileSearchData.FileType resultType, CentralRepository centralRepo) {
67 this.searchfilters = searchfilters;
68 this.groupingAttribute = groupingAttribute;
69 this.groupSort = groupSort;
70 this.fileSortMethod = fileSortMethod;
71 this.groupKey = groupKey;
72 this.startingEntry = startingEntry;
73 this.pageSize = pageSize;
74 this.resultType = resultType;
75 this.centralRepo = centralRepo;
79 protected Void doInBackground() throws Exception {
83 results.addAll(FileSearch.getFilesInGroup(System.getProperty(USER_NAME_PROPERTY), searchfilters,
86 fileSortMethod, groupKey, startingEntry, pageSize,
87 Case.getCurrentCase().getSleuthkitCase(), centralRepo));
88 }
catch (FileSearchException ex) {
89 logger.log(Level.SEVERE,
"Error running file search test", ex);
96 protected void done() {
98 int currentPage = startingEntry / pageSize;
99 DiscoveryEventUtils.getDiscoveryEventBus().post(
new DiscoveryEventUtils.PageRetrievedEvent(resultType, currentPage, results));