19 package org.sleuthkit.autopsy.discovery.ui;
 
   22 import java.util.List;
 
   23 import java.util.ArrayList;
 
   24 import java.util.logging.Level;
 
   25 import javax.swing.SwingWorker;
 
   43 final class PageWorker 
extends SwingWorker<Void, Void> {
 
   45     private final static Logger logger = Logger.getLogger(PageWorker.class.getName());
 
   46     private static final String USER_NAME_PROPERTY = 
"user.name"; 
 
   47     private final List<AbstractFilter> searchfilters;
 
   48     private final DiscoveryAttributes.AttributeType groupingAttribute;
 
   49     private final Group.GroupSortingAlgorithm groupSort;
 
   50     private final ResultsSorter.SortingMethod fileSortMethod;
 
   51     private final GroupKey groupKey;
 
   52     private final int startingEntry;
 
   53     private final int pageSize;
 
   54     private final SearchData.Type resultType;
 
   55     private final CentralRepository centralRepo;
 
   56     private final List<Result> results = 
new ArrayList<>();
 
   74     PageWorker(List<AbstractFilter> searchfilters, DiscoveryAttributes.AttributeType groupingAttribute,
 
   75             Group.GroupSortingAlgorithm groupSort, ResultsSorter.SortingMethod fileSortMethod, GroupKey groupKey,
 
   76             int startingEntry, 
int pageSize, SearchData.Type resultType, CentralRepository centralRepo) {
 
   77         this.searchfilters = searchfilters;
 
   78         this.groupingAttribute = groupingAttribute;
 
   79         this.groupSort = groupSort;
 
   80         this.fileSortMethod = fileSortMethod;
 
   81         this.groupKey = groupKey;
 
   82         this.startingEntry = startingEntry;
 
   83         this.pageSize = pageSize;
 
   84         this.resultType = resultType;
 
   85         this.centralRepo = centralRepo;
 
   89     protected Void doInBackground() throws Exception {
 
   93             if (resultType == SearchData.Type.DOMAIN) {
 
   94                 DomainSearch domainSearch = 
new DomainSearch();
 
   95                 results.addAll(domainSearch.getDomainsInGroup(System.getProperty(USER_NAME_PROPERTY), searchfilters,
 
   98                         fileSortMethod, groupKey, startingEntry, pageSize,
 
   99                         Case.getCurrentCase().getSleuthkitCase(), centralRepo));
 
  101                 results.addAll(FileSearch.getFilesInGroup(System.getProperty(USER_NAME_PROPERTY), searchfilters,
 
  104                         fileSortMethod, groupKey, startingEntry, pageSize,
 
  105                         Case.getCurrentCase().getSleuthkitCase(), centralRepo));
 
  107         } 
catch (DiscoveryException ex) {
 
  108             logger.log(Level.SEVERE, 
"Error running file search test", ex);
 
  115     protected void done() {
 
  116         if (!isCancelled()) {
 
  117             int currentPage = startingEntry / pageSize; 
 
  118             DiscoveryEventUtils.getDiscoveryEventBus().post(
new DiscoveryEventUtils.PageRetrievedEvent(resultType, currentPage, results));