Autopsy  4.19.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  */
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 at Time Of Ingest",
41  "ExportPastCases_sameIdsTable_tabName=Past Cases with the Same Devices",})
42 class ExportPastCases {
43 
44  private final PastCasesSummary pastSummary;
45 
46  // model for column indicating the case
47  private static final ColumnModel<Pair<String, Long>, DefaultCellModel<?>> CASE_COL = new ColumnModel<>(
48  Bundle.ExportPastCases_caseColumn_title(),
49  (pair) -> new DefaultCellModel<>(pair.getKey()),
50  300
51  );
52 
53  // model for column indicating the count
54  private static final ColumnModel<Pair<String, Long>, DefaultCellModel<?>> COUNT_COL = new ColumnModel<>(
55  Bundle.ExportPastCases_countColumn_title(),
56  (pair) -> new DefaultCellModel<>(pair.getValue()),
57  100
58  );
59 
60  // the template for columns in both tables in this tab
61  private static List<ColumnModel<Pair<String, Long>, DefaultCellModel<?>>> DEFAULT_TEMPLATE
62  = Arrays.asList(CASE_COL, COUNT_COL);
63 
64  ExportPastCases() {
65  pastSummary = new PastCasesSummary();
66  }
67 
68  List<ExcelExport.ExcelSheetExport> getExports(DataSource dataSource) {
69  DataFetcher<DataSource, PastCasesResult> pastCasesFetcher = (ds) -> pastSummary.getPastCasesData(ds);
70  PastCasesResult result = getFetchResult(pastCasesFetcher, "Past cases sheets", dataSource);
71  if (result == null) {
72  return Collections.emptyList();
73  }
74 
75  return Arrays.asList(
76  getTableExport(DEFAULT_TEMPLATE, Bundle.ExportPastCases_notableFileTable_tabName(), result.getTaggedNotable()),
77  getTableExport(DEFAULT_TEMPLATE, Bundle.ExportPastCases_sameIdsTable_tabName(), result.getSameIdsResults())
78  );
79  }
80 }

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