19 package org.sleuthkit.autopsy.report.modules.datasourcesummaryexport;
21 import java.io.IOException;
22 import java.util.ArrayList;
23 import java.util.List;
24 import java.util.logging.Level;
25 import java.util.stream.Collectors;
26 import javax.swing.JPanel;
27 import org.openide.util.NbBundle;
28 import org.openide.util.lookup.ServiceProvider;
43 @ServiceProvider(service = GeneralReportModule.class)
51 if (instance == null) {
63 String name = NbBundle.getMessage(this.getClass(),
"DataSourceSummaryReport.getName.text");
74 String desc = NbBundle.getMessage(this.getClass(),
"DataSourceSummaryReport.getDesc.text");
89 "DataSourceSummaryReport.error.noOpenCase=No currently open case.",
90 "DataSourceSummaryReport.error.noDataSources=No data sources selected for report.",
91 "DataSourceSummaryReport.failedToCompleteReport=Failed to complete report.",
92 "DataSourceSummaryReport.excelFileWriteError=Could not write the xlsx file.",})
95 progressPanel.
start();
101 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
105 String errorMessage =
"";
107 List<Content> selectedDataSources =
new ArrayList<>();
112 List<Long> dsIDs = selectedDataSources
115 .collect(Collectors.toList());
117 }
catch (TskCoreException ex) {
119 errorMessage = Bundle.DataSourceSummaryReport_failedToCompleteReport();
120 logger.log(Level.SEVERE,
"Could not get the datasources from the case", ex);
121 progressPanel.
complete(result, errorMessage);
127 selectedDataSources.add(currentCase.
getSleuthkitCase().getContentById(dsID));
128 }
catch (TskCoreException ex) {
130 errorMessage = Bundle.DataSourceSummaryReport_failedToCompleteReport();
131 logger.log(Level.SEVERE,
"Could not get the datasources from the case", ex);
132 progressPanel.
complete(result, errorMessage);
138 if (selectedDataSources.isEmpty()) {
140 progressPanel.
complete(result, Bundle.DataSourceSummaryReport_error_noDataSources());
141 logger.log(Level.SEVERE,
"No data sources selected for report.");
146 for (Content dataSource : selectedDataSources){
147 if (dataSource instanceof DataSource) {
149 new ExcelExportAction().exportToXLSX(progressPanel, (DataSource) dataSource, settings.
getReportDirectoryPath());
150 }
catch (IOException | ExcelExport.ExcelExportException ex) {
151 errorMessage = Bundle.DataSourceSummaryReport_excelFileWriteError();
152 logger.log(Level.SEVERE, errorMessage, ex);
159 progressPanel.
complete(result, errorMessage);
List< Content > getDataSources()
void complete(ReportStatus reportStatus)
boolean supportsDataSourceSelection()
static DataSourceSummaryReport instance
void generateReport(GeneralReportSettings settings, ReportProgressPanel progressPanel)
JPanel getConfigurationPanel()
SleuthkitCase getSleuthkitCase()
DataSourceSummaryReport()
List< Long > getSelectedDataSources()
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
void setSelectedDataSources(List< Long > selectedDataSources)
String getRelativeFilePath()
String getReportDirectoryPath()
static synchronized DataSourceSummaryReport getDefault()