19package org.sleuthkit.autopsy.report.modules.datasourcesummaryexport;
21import java.io.IOException;
22import java.util.ArrayList;
24import java.util.logging.Level;
25import java.util.stream.Collectors;
26import javax.swing.JPanel;
27import org.openide.util.NbBundle;
28import org.openide.util.lookup.ServiceProvider;
29import org.sleuthkit.autopsy.casemodule.Case;
30import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
31import org.sleuthkit.autopsy.coreutils.Logger;
32import org.sleuthkit.autopsy.report.GeneralReportModule;
33import org.sleuthkit.autopsy.report.GeneralReportSettings;
34import org.sleuthkit.autopsy.report.ReportProgressPanel;
35import org.sleuthkit.datamodel.Content;
36import org.sleuthkit.datamodel.DataSource;
37import org.sleuthkit.datamodel.TskCoreException;
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()
SleuthkitCase getSleuthkitCase()
static Case getCurrentCaseThrows()
synchronized static Logger getLogger(String name)
String getReportDirectoryPath()
List< Long > getSelectedDataSources()
void setSelectedDataSources(List< Long > selectedDataSources)
void complete(ReportStatus reportStatus)
static DataSourceSummaryReport instance
static synchronized DataSourceSummaryReport getDefault()
JPanel getConfigurationPanel()
String getRelativeFilePath()
DataSourceSummaryReport()
boolean supportsDataSourceSelection()
static final Logger logger
void generateReport(GeneralReportSettings settings, ReportProgressPanel progressPanel)