Autopsy  4.10.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ReportCaseUco.java
Go to the documentation of this file.
1 /*
2  *
3  * Autopsy Forensic Browser
4  *
5  * Copyright 2018-2019 Basis Technology Corp.
6  * Project Contact/Architect: carrier <at> sleuthkit <dot> org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 package org.sleuthkit.autopsy.report.caseuco;
21 
22 import java.util.logging.Level;
23 import javax.swing.JPanel;
24 import java.sql.SQLException;
25 import org.openide.util.NbBundle;
32 import org.sleuthkit.datamodel.*;
33 
38 public final class ReportCaseUco implements GeneralReportModule {
39 
40  private static final Logger logger = Logger.getLogger(ReportCaseUco.class.getName());
41  private static ReportCaseUco instance = null;
42  private ReportCaseUcoConfigPanel configPanel;
43 
44  private static final String REPORT_FILE_NAME = "CASE_UCO_output.json-ld";
45 
46  // Hidden constructor for the report
47  private ReportCaseUco() {
48  }
49 
50  // Get the default implementation of this report
51  public static synchronized ReportCaseUco getDefault() {
52  if (instance == null) {
53  instance = new ReportCaseUco();
54  }
55  return instance;
56  }
57 
58  @Override
59  public String getName() {
60  String name = NbBundle.getMessage(this.getClass(), "ReportCaseUco.getName.text");
61  return name;
62  }
63 
64  @Override
65  public String getRelativeFilePath() {
66  return REPORT_FILE_NAME;
67  }
68 
69  @Override
70  public String getDescription() {
71  String desc = NbBundle.getMessage(this.getClass(), "ReportCaseUco.getDesc.text");
72  return desc;
73  }
74 
75  @Override
76  public JPanel getConfigurationPanel() {
77  try {
78  configPanel = new ReportCaseUcoConfigPanel();
79  } catch (NoCurrentCaseException | TskCoreException | SQLException ex) {
80  logger.log(Level.SEVERE, "Failed to initialize CASE-UCO settings panel", ex); //NON-NLS
81  MessageNotifyUtil.Message.error(Bundle.ReportCaseUco_notInitialized());
82  configPanel = null;
83  }
84  return configPanel;
85  }
86 
92  public static String getReportFileName() {
93  return REPORT_FILE_NAME;
94  }
95 
102  @NbBundle.Messages({
103  "ReportCaseUco.notInitialized=CASE-UCO settings panel has not been initialized",
104  "ReportCaseUco.noDataSourceSelected=No data source selected for CASE-UCO report"
105  })
106  @Override
107  @SuppressWarnings("deprecation")
108  public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) {
109 
110  if (configPanel == null) {
111  logger.log(Level.SEVERE, "CASE-UCO settings panel has not been initialized"); //NON-NLS
112  MessageNotifyUtil.Message.error(Bundle.ReportCaseUco_notInitialized());
113  progressPanel.complete(ReportStatus.ERROR);
114  return;
115  }
116 
117  Long selectedDataSourceId = configPanel.getSelectedDataSourceId();
118  if (selectedDataSourceId == ReportCaseUcoConfigPanel.NO_DATA_SOURCE_SELECTED) {
119  logger.log(Level.SEVERE, "No data source selected for CASE-UCO report"); //NON-NLS
120  MessageNotifyUtil.Message.error(Bundle.ReportCaseUco_noDataSourceSelected());
121  progressPanel.complete(ReportStatus.ERROR);
122  return;
123  }
124 
125  String reportPath = baseReportDir + getRelativeFilePath();
126  CaseUcoFormatExporter.generateReport(selectedDataSourceId, reportPath, progressPanel);
127  }
128 }
static void generateReport(Long selectedDataSourceId, String reportOutputPath, ReportProgressPanel progressPanel)
static synchronized ReportCaseUco getDefault()
synchronized static Logger getLogger(String name)
Definition: Logger.java:124
void generateReport(String baseReportDir, ReportProgressPanel progressPanel)

Copyright © 2012-2018 Basis Technology. Generated on: Fri Mar 22 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.