19 package org.sleuthkit.autopsy.report.modules.datasourcesummaryexport;
21 import java.util.Arrays;
22 import java.util.List;
23 import java.util.stream.Collectors;
24 import java.util.stream.Stream;
25 import org.apache.commons.lang3.tuple.Pair;
26 import org.openide.util.NbBundle.Messages;
38 "ExportAnalysisResults_keyColumn_title=Name",
39 "ExportAnalysisResults_countColumn_title=Count",
40 "ExportAnalysisResults_keywordSearchModuleName=Keyword Search",
41 "ExportAnalysisResults_hashsetHits_tabName=Hashset Hits",
42 "ExportAnalysisResults_keywordHits_tabName=Keyword Hits",
43 "ExportAnalysisResults_interestingItemHits_tabName=Interesting Item Hits",})
44 class ExportAnalysisResults {
47 private static final List<ColumnModel<Pair<String, Long>, DefaultCellModel<?>>> DEFAULT_COLUMNS = Arrays.asList(
49 Bundle.ExportAnalysisResults_keyColumn_title(),
50 (pair) ->
new DefaultCellModel<>(pair.getKey()),
54 Bundle.ExportAnalysisResults_countColumn_title(),
55 (pair) ->
new DefaultCellModel<>(pair.getValue()),
60 private final AnalysisSummary analysisSummary;
62 ExportAnalysisResults() {
63 analysisSummary =
new AnalysisSummary();
66 List<ExcelSheetExport> getExports(DataSource dataSource) {
68 DataFetcher<DataSource, List<Pair<String, Long>>> hashsetsFetcher = (ds) -> analysisSummary.getHashsetCounts(ds);
69 DataFetcher<DataSource, List<Pair<String, Long>>> keywordsFetcher = (ds) -> analysisSummary.getKeywordCounts(ds);
70 DataFetcher<DataSource, List<Pair<String, Long>>> interestingItemsFetcher = (ds) -> analysisSummary.getInterestingItemCounts(ds);
73 getTableExport(hashsetsFetcher, DEFAULT_COLUMNS, Bundle.ExportAnalysisResults_hashsetHits_tabName(), dataSource),
74 getTableExport(keywordsFetcher, DEFAULT_COLUMNS, Bundle.ExportAnalysisResults_keywordHits_tabName(), dataSource),
75 getTableExport(interestingItemsFetcher, DEFAULT_COLUMNS, Bundle.ExportAnalysisResults_interestingItemHits_tabName(), dataSource))
76 .filter(sheet -> sheet != null)
77 .collect(Collectors.toList());