Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
ExportPastCases.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2021 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 */
19package org.sleuthkit.autopsy.report.modules.datasourcesummaryexport;
20
21import java.util.Arrays;
22import java.util.Collections;
23import java.util.List;
24import org.apache.commons.lang3.tuple.Pair;
25import org.openide.util.NbBundle.Messages;
26import org.sleuthkit.autopsy.datasourcesummary.datamodel.DataFetcher;
27import org.sleuthkit.autopsy.datasourcesummary.datamodel.PastCasesSummary;
28import org.sleuthkit.autopsy.datasourcesummary.datamodel.PastCasesSummary.PastCasesResult;
29import static org.sleuthkit.autopsy.report.modules.datasourcesummaryexport.ExcelExportAction.getFetchResult;
30import static org.sleuthkit.autopsy.report.modules.datasourcesummaryexport.ExcelExportAction.getTableExport;
31import org.sleuthkit.datamodel.DataSource;
32
37@Messages({
38 "ExportPastCases_caseColumn_title=Case",
39 "ExportPastCases_countColumn_title=Count",
40 "ExportPastCases_notableFileTable_tabName=Cases with common notable items",
41 "ExportPastCases_seenResultsTable_tabName=Cases with the same addresses",
42 "ExportPastCases_seenDevicesTable_tabName=Cases with the same device IDs",})
43class ExportPastCases {
44
45 private final PastCasesSummary pastSummary;
46
47 // model for column indicating the case
48 private static final ColumnModel<Pair<String, Long>, DefaultCellModel<?>> CASE_COL = new ColumnModel<>(
49 Bundle.ExportPastCases_caseColumn_title(),
50 (pair) -> new DefaultCellModel<>(pair.getKey()),
51 300
52 );
53
54 // model for column indicating the count
55 private static final ColumnModel<Pair<String, Long>, DefaultCellModel<?>> COUNT_COL = new ColumnModel<>(
56 Bundle.ExportPastCases_countColumn_title(),
57 (pair) -> new DefaultCellModel<>(pair.getValue()),
58 100
59 );
60
61 // the template for columns in both tables in this tab
62 private static List<ColumnModel<Pair<String, Long>, DefaultCellModel<?>>> DEFAULT_TEMPLATE
63 = Arrays.asList(CASE_COL, COUNT_COL);
64
65 ExportPastCases() {
66 pastSummary = new PastCasesSummary();
67 }
68
69 List<ExcelExport.ExcelSheetExport> getExports(DataSource dataSource) {
70 DataFetcher<DataSource, PastCasesResult> pastCasesFetcher = (ds) -> pastSummary.getPastCasesData(ds);
71 PastCasesResult result = getFetchResult(pastCasesFetcher, "Past cases sheets", dataSource);
72 if (result == null) {
73 return Collections.emptyList();
74 }
75
76 return Arrays.asList(
77 getTableExport(DEFAULT_TEMPLATE, Bundle.ExportPastCases_notableFileTable_tabName(), result.getPreviouslyNotable()),
78 getTableExport(DEFAULT_TEMPLATE, Bundle.ExportPastCases_seenResultsTable_tabName(), result.getPreviouslySeenResults()),
79 getTableExport(DEFAULT_TEMPLATE, Bundle.ExportPastCases_seenDevicesTable_tabName(), result.getPreviouslySeenDevices())
80 );
81 }
82}

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.