Autopsy  4.19.3
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  */
19 package org.sleuthkit.autopsy.report.modules.datasourcesummaryexport;
20 
21 import java.util.Arrays;
22 import java.util.Collections;
23 import java.util.List;
24 import org.apache.commons.lang3.tuple.Pair;
25 import org.openide.util.NbBundle.Messages;
31 import 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",})
43 class 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-2022 Basis Technology. Generated on: Tue Jun 27 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.