19 package org.sleuthkit.autopsy.casemodule;
21 import java.beans.PropertyChangeEvent;
22 import java.text.DateFormat;
23 import java.text.SimpleDateFormat;
24 import java.util.ArrayList;
25 import java.util.Date;
26 import java.util.EnumSet;
27 import java.util.List;
29 import java.util.logging.Level;
30 import javax.swing.JOptionPane;
31 import javax.swing.event.ListSelectionEvent;
32 import javax.swing.table.AbstractTableModel;
33 import org.openide.util.NbBundle.Messages;
47 @SuppressWarnings(
"PMD.SingularField")
55 private final List<IngestJobInfo> ingestJobsForSelectedDataSource =
new ArrayList<>();
58 private final DateFormat datetimeFormat =
new SimpleDateFormat(
"yyyy/MM/dd HH:mm:ss");
66 customizeComponents();
69 @Messages({
"IngestJobInfoPanel.loadIngestJob.error.text=Failed to load ingest jobs.",
70 "IngestJobInfoPanel.loadIngestJob.error.title=Load Failure"})
73 this.ingestJobTable.getSelectionModel().addListSelectionListener((ListSelectionEvent e) -> {
74 IngestJobInfo currJob = (ingestJobTable.getSelectedRow() < 0 ? null : this.ingestJobsForSelectedDataSource.get(ingestJobTable.getSelectedRow()));
76 this.ingestModuleTable.setModel(this.ingestModuleTableModel);
88 if (!(evt instanceof
AutopsyEvent) || (((AutopsyEvent) evt).getSourceType() != AutopsyEvent.SourceType.LOCAL)) {
93 if ((CURRENT_CASE ==
Case.
Events.valueOf(evt.getPropertyName()))) {
94 if (evt.getNewValue() != null) {
111 this.selectedDataSource = selectedDataSource;
112 ingestJobsForSelectedDataSource.clear();
113 if (selectedDataSource != null) {
114 for (IngestJobInfo jobInfo : ingestJobs) {
115 if (selectedDataSource.getId() == jobInfo.getObjectId()) {
116 ingestJobsForSelectedDataSource.add(jobInfo);
121 this.ingestJobTable.setModel(ingestJobTableModel);
123 if (!ingestJobsForSelectedDataSource.isEmpty()) {
124 ingestJobTable.setRowSelectionInterval(0, 0);
136 this.ingestJobs = skCase.getIngestJobs();
137 setDataSource(selectedDataSource);
139 this.ingestJobs =
new ArrayList<>();
144 logger.log(Level.SEVERE,
"Failed to load ingest jobs.", ex);
145 JOptionPane.showMessageDialog(
this, Bundle.IngestJobInfoPanel_loadIngestJob_error_text(), Bundle.IngestJobInfoPanel_loadIngestJob_error_title(), JOptionPane.ERROR_MESSAGE);
153 this.ingestJobs =
new ArrayList<>();
157 @Messages({
"IngestJobInfoPanel.IngestJobTableModel.StartTime.header=Start Time",
158 "IngestJobInfoPanel.IngestJobTableModel.EndTime.header=End Time",
159 "IngestJobInfoPanel.IngestJobTableModel.IngestStatus.header=Ingest Status"})
162 private final List<String> columnHeaders =
new ArrayList<>();
165 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestJobTableModel_StartTime_header());
166 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestJobTableModel_EndTime_header());
167 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestJobTableModel_IngestStatus_header());
172 return ingestJobsForSelectedDataSource.size();
177 return columnHeaders.size();
182 IngestJobInfo currIngestJob = ingestJobsForSelectedDataSource.get(rowIndex);
183 if (columnIndex == 0) {
184 return datetimeFormat.format(currIngestJob.getStartDateTime());
185 }
else if (columnIndex == 1) {
186 Date endDate = currIngestJob.getEndDateTime();
187 if (endDate.getTime() == 0) {
190 return datetimeFormat.format(currIngestJob.getEndDateTime());
191 }
else if (columnIndex == 2) {
192 return currIngestJob.getStatus().getDisplayName();
199 return columnHeaders.get(column);
204 @Messages({
"IngestJobInfoPanel.IngestModuleTableModel.ModuleName.header=Module Name",
205 "IngestJobInfoPanel.IngestModuleTableModel.ModuleVersion.header=Module Version"})
208 private final List<String> columnHeaders =
new ArrayList<>();
212 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestModuleTableModel_ModuleName_header());
213 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestModuleTableModel_ModuleVersion_header());
214 this.currJob = currJob;
219 if (currJob == null) {
222 return currJob.getIngestModuleInfo().size();
227 return columnHeaders.size();
232 if (currJob != null) {
233 IngestModuleInfo currIngestModule = currJob.getIngestModuleInfo().get(rowIndex);
234 if (columnIndex == 0) {
235 return currIngestModule.getDisplayName();
236 }
else if (columnIndex == 1) {
237 return currIngestModule.getVersion();
246 return columnHeaders.get(column);
256 @SuppressWarnings(
"unchecked")
258 private
void initComponents() {
259 java.awt.GridBagConstraints gridBagConstraints;
261 javax.swing.JScrollPane mainScrollPane =
new javax.swing.JScrollPane();
262 javax.swing.JPanel contentPanel =
new javax.swing.JPanel();
263 javax.swing.JScrollPane ingestJobsScrollPane =
new javax.swing.JScrollPane();
264 ingestJobTable =
new javax.swing.JTable();
265 javax.swing.JLabel jLabel1 =
new javax.swing.JLabel();
266 javax.swing.JLabel jLabel2 =
new javax.swing.JLabel();
267 javax.swing.JScrollPane ingestModulesScrollPane =
new javax.swing.JScrollPane();
268 ingestModuleTable =
new javax.swing.JTable();
270 setMaximumSize(
new java.awt.Dimension(32767, 32767));
271 setLayout(
new java.awt.BorderLayout());
273 contentPanel.setMaximumSize(
new java.awt.Dimension(32767, 32767));
274 contentPanel.setMinimumSize(
new java.awt.Dimension(625, 150));
275 contentPanel.setPreferredSize(
new java.awt.Dimension(625, 150));
276 contentPanel.setLayout(
new java.awt.GridBagLayout());
278 ingestJobsScrollPane.setBorder(null);
279 ingestJobsScrollPane.setMinimumSize(
new java.awt.Dimension(16, 16));
280 ingestJobsScrollPane.setPreferredSize(null);
282 ingestJobTable.setModel(ingestJobTableModel);
283 ingestJobTable.getTableHeader().setReorderingAllowed(
false);
284 ingestJobsScrollPane.setViewportView(ingestJobTable);
285 ingestJobTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
287 gridBagConstraints =
new java.awt.GridBagConstraints();
288 gridBagConstraints.gridx = 0;
289 gridBagConstraints.gridy = 1;
290 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
291 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
292 gridBagConstraints.weightx = 1.0;
293 gridBagConstraints.weighty = 1.0;
294 gridBagConstraints.insets =
new java.awt.Insets(2, 10, 10, 0);
295 contentPanel.add(ingestJobsScrollPane, gridBagConstraints);
297 org.openide.awt.Mnemonics.setLocalizedText(jLabel1,
org.openide.util.NbBundle.getMessage(
IngestJobInfoPanel.class,
"IngestJobInfoPanel.jLabel1.text"));
298 gridBagConstraints =
new java.awt.GridBagConstraints();
299 gridBagConstraints.gridx = 1;
300 gridBagConstraints.gridy = 0;
301 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
302 gridBagConstraints.insets =
new java.awt.Insets(10, 10, 0, 0);
303 contentPanel.add(jLabel1, gridBagConstraints);
305 org.openide.awt.Mnemonics.setLocalizedText(jLabel2,
org.openide.util.NbBundle.getMessage(
IngestJobInfoPanel.class,
"IngestJobInfoPanel.jLabel2.text"));
306 gridBagConstraints =
new java.awt.GridBagConstraints();
307 gridBagConstraints.gridx = 0;
308 gridBagConstraints.gridy = 0;
309 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
310 gridBagConstraints.insets =
new java.awt.Insets(10, 10, 0, 0);
311 contentPanel.add(jLabel2, gridBagConstraints);
313 ingestModulesScrollPane.setMaximumSize(
new java.awt.Dimension(254, 32767));
314 ingestModulesScrollPane.setMinimumSize(
new java.awt.Dimension(254, 16));
315 ingestModulesScrollPane.setPreferredSize(
new java.awt.Dimension(254, 16));
317 ingestModuleTable.setModel(ingestModuleTableModel);
318 ingestModulesScrollPane.setViewportView(ingestModuleTable);
320 gridBagConstraints =
new java.awt.GridBagConstraints();
321 gridBagConstraints.gridx = 1;
322 gridBagConstraints.gridy = 1;
323 gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
324 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
325 gridBagConstraints.weighty = 1.0;
326 gridBagConstraints.insets =
new java.awt.Insets(2, 8, 10, 10);
327 contentPanel.add(ingestModulesScrollPane, gridBagConstraints);
329 mainScrollPane.setViewportView(contentPanel);
331 add(mainScrollPane, java.awt.BorderLayout.CENTER);
Object getValueAt(int rowIndex, int columnIndex)
final IngestJobInfo currJob
static synchronized IngestManager getInstance()
void setDataSource(DataSource selectedDataSource)
Object getValueAt(int rowIndex, int columnIndex)
DataSource selectedDataSource
javax.swing.JTable ingestModuleTable
List< IngestJobInfo > ingestJobs
void addIngestJobEventListener(final PropertyChangeListener listener)
SleuthkitCase getSleuthkitCase()
String getColumnName(int column)
String getColumnName(int column)
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
void customizeComponents()
javax.swing.JTable ingestJobTable
static boolean isCaseOpen()