Autopsy  4.16.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
DomainSearch.java
Go to the documentation of this file.
1 /*
2  * Autopsy
3  *
4  * Copyright 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 java.awt.Image;
22 import java.util.ArrayList;
23 import java.util.LinkedHashMap;
24 import java.util.List;
25 import java.util.Map;
26 
29 import org.sleuthkit.datamodel.SleuthkitCase;
30 
34 public class DomainSearch {
35 
36  private final DomainSearchCache searchCache;
38 
42  public DomainSearch() {
43  this(new DomainSearchCache(), new DomainSearchThumbnailCache());
44  }
45 
54  DomainSearch(DomainSearchCache cache, DomainSearchThumbnailCache thumbnailCache) {
55  this.searchCache = cache;
56  this.thumbnailCache = thumbnailCache;
57  }
58 
77  public Map<GroupKey, Integer> getGroupSizes(String userName,
78  List<AbstractFilter> filters,
79  DiscoveryAttributes.AttributeType groupAttributeType,
80  Group.GroupSortingAlgorithm groupSortingType,
81  ResultsSorter.SortingMethod domainSortingMethod,
82  SleuthkitCase caseDb, CentralRepository centralRepoDb) throws DiscoveryException {
83 
84  final Map<GroupKey, List<Result>> searchResults = searchCache.get(
85  userName, filters, groupAttributeType, groupSortingType,
86  domainSortingMethod, caseDb, centralRepoDb);
87 
88  // Transform the cached results into a map of group key to group size.
89  final LinkedHashMap<GroupKey, Integer> groupSizes = new LinkedHashMap<>();
90  for (GroupKey groupKey : searchResults.keySet()) {
91  groupSizes.put(groupKey, searchResults.get(groupKey).size());
92  }
93 
94  return groupSizes;
95  }
96 
119  public List<Result> getDomainsInGroup(String userName,
120  List<AbstractFilter> filters,
121  DiscoveryAttributes.AttributeType groupAttributeType,
122  Group.GroupSortingAlgorithm groupSortingType,
123  ResultsSorter.SortingMethod domainSortingMethod,
124  GroupKey groupKey, int startingEntry, int numberOfEntries,
125  SleuthkitCase caseDb, CentralRepository centralRepoDb) throws DiscoveryException {
126 
127  final Map<GroupKey, List<Result>> searchResults = searchCache.get(
128  userName, filters, groupAttributeType, groupSortingType,
129  domainSortingMethod, caseDb, centralRepoDb);
130  final List<Result> domainsInGroup = searchResults.get(groupKey);
131 
132  final List<Result> page = new ArrayList<>();
133  for (int i = startingEntry; (i < startingEntry + numberOfEntries)
134  && (i < domainsInGroup.size()); i++) {
135  page.add(domainsInGroup.get(i));
136  }
137 
138  return page;
139  }
140 
152  public Image getThumbnail(DomainSearchThumbnailRequest thumbnailRequest) throws DiscoveryException {
153  return thumbnailCache.get(thumbnailRequest);
154  }
155 }
List< Result > getDomainsInGroup(String userName, List< AbstractFilter > filters, DiscoveryAttributes.AttributeType groupAttributeType, Group.GroupSortingAlgorithm groupSortingType, ResultsSorter.SortingMethod domainSortingMethod, GroupKey groupKey, int startingEntry, int numberOfEntries, SleuthkitCase caseDb, CentralRepository centralRepoDb)
final DomainSearchThumbnailCache thumbnailCache
Map< GroupKey, Integer > getGroupSizes(String userName, List< AbstractFilter > filters, DiscoveryAttributes.AttributeType groupAttributeType, Group.GroupSortingAlgorithm groupSortingType, ResultsSorter.SortingMethod domainSortingMethod, SleuthkitCase caseDb, CentralRepository centralRepoDb)
Image getThumbnail(DomainSearchThumbnailRequest thumbnailRequest)

Copyright © 2012-2020 Basis Technology. Generated on: Tue Sep 22 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.