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.List;
27 import java.util.logging.Level;
28 import javax.swing.JOptionPane;
29 import javax.swing.event.ListSelectionEvent;
30 import javax.swing.table.AbstractTableModel;
31 import org.openide.util.NbBundle.Messages;
42 @SuppressWarnings(
"PMD.SingularField")
49 private final DateFormat datetimeFormat =
new SimpleDateFormat(
"yyyy/MM/dd HH:mm:ss");
56 customizeComponents();
59 @Messages({
"IngestJobInfoPanel.loadIngestJob.error.text=Failed to load ingest jobs.",
60 "IngestJobInfoPanel.loadIngestJob.error.title=Load Failure"})
63 this.ingestJobTable.getSelectionModel().addListSelectionListener((ListSelectionEvent e) -> {
64 this.ingestModuleTableModel =
new IngestModuleTableModel(this.ingestJobs.get(ingestJobTable.getSelectedRow()));
65 this.ingestModuleTable.setModel(this.ingestModuleTableModel);
80 List<IngestJobInfo> ingestJobs = skCase.getIngestJobs();
81 this.ingestJobs = ingestJobs;
84 logger.log(Level.SEVERE,
"Failed to load ingest jobs.", ex);
85 JOptionPane.showMessageDialog(
this, Bundle.IngestJobInfoPanel_loadIngestJob_error_text(), Bundle.IngestJobInfoPanel_loadIngestJob_error_title(), JOptionPane.ERROR_MESSAGE);
89 @Messages({
"IngestJobInfoPanel.IngestJobTableModel.DataSource.header=Data Source",
90 "IngestJobInfoPanel.IngestJobTableModel.StartTime.header=Start Time",
91 "IngestJobInfoPanel.IngestJobTableModel.EndTime.header=End Time",
92 "IngestJobInfoPanel.IngestJobTableModel.IngestStatus.header=Ingest Status"})
95 private final List<String> columnHeaders =
new ArrayList<>();
98 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestJobTableModel_DataSource_header());
99 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestJobTableModel_StartTime_header());
100 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestJobTableModel_EndTime_header());
101 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestJobTableModel_IngestStatus_header());
106 return ingestJobs.size();
111 return columnHeaders.size();
116 IngestJobInfo currIngestJob = ingestJobs.get(rowIndex);
117 if (columnIndex == 0) {
120 return skCase.getContentById(currIngestJob.getObjectId()).getName();
122 logger.log(Level.SEVERE,
"Failed to get content from db", ex);
125 }
else if (columnIndex == 1) {
126 return datetimeFormat.format(currIngestJob.getStartDateTime());
127 }
else if (columnIndex == 2) {
128 Date endDate = currIngestJob.getEndDateTime();
129 if (endDate.getTime() == 0) {
132 return datetimeFormat.format(currIngestJob.getEndDateTime());
133 }
else if (columnIndex == 3) {
134 return currIngestJob.getStatus().getDisplayName();
141 return columnHeaders.get(column);
146 @Messages({
"IngestJobInfoPanel.IngestModuleTableModel.ModuleName.header=Module Name",
147 "IngestJobInfoPanel.IngestModuleTableModel.ModuleVersion.header=Module Version"})
150 private final List<String> columnHeaders =
new ArrayList<>();
154 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestModuleTableModel_ModuleName_header());
155 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestModuleTableModel_ModuleVersion_header());
156 this.currJob = currJob;
161 if (currJob == null) {
164 return currJob.getIngestModuleInfo().size();
169 return columnHeaders.size();
174 if (currJob != null) {
175 IngestModuleInfo currIngestModule = currJob.getIngestModuleInfo().get(rowIndex);
176 if (columnIndex == 0) {
177 return currIngestModule.getDisplayName();
178 }
else if (columnIndex == 1) {
179 return currIngestModule.getVersion();
188 return columnHeaders.get(column);
198 @SuppressWarnings(
"unchecked")
200 private
void initComponents() {
202 jScrollPane1 =
new javax.swing.JScrollPane();
203 ingestJobTable =
new javax.swing.JTable();
204 jLabel1 =
new javax.swing.JLabel();
205 jLabel2 =
new javax.swing.JLabel();
206 jScrollPane2 =
new javax.swing.JScrollPane();
207 ingestModuleTable =
new javax.swing.JTable();
209 jScrollPane1.setBorder(null);
211 ingestJobTable.setModel(ingestJobTableModel);
212 ingestJobTable.getTableHeader().setReorderingAllowed(
false);
213 jScrollPane1.setViewportView(ingestJobTable);
214 ingestJobTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
216 org.openide.awt.Mnemonics.setLocalizedText(jLabel1,
org.openide.util.NbBundle.getMessage(
IngestJobInfoPanel.class,
"IngestJobInfoPanel.jLabel1.text"));
218 org.openide.awt.Mnemonics.setLocalizedText(jLabel2,
org.openide.util.NbBundle.getMessage(
IngestJobInfoPanel.class,
"IngestJobInfoPanel.jLabel2.text"));
220 ingestModuleTable.setModel(ingestModuleTableModel);
221 jScrollPane2.setViewportView(ingestModuleTable);
223 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
224 this.setLayout(layout);
225 layout.setHorizontalGroup(
226 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
227 .addGroup(layout.createSequentialGroup()
229 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
230 .addComponent(jLabel2)
231 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE))
233 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
234 .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE)
235 .addComponent(jLabel1))
238 layout.setVerticalGroup(
239 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
240 .addGroup(layout.createSequentialGroup()
242 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
243 .addComponent(jLabel1)
244 .addComponent(jLabel2))
245 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
246 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
247 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
248 .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
Object getValueAt(int rowIndex, int columnIndex)
final IngestJobInfo currJob
static synchronized IngestManager getInstance()
javax.swing.JScrollPane jScrollPane1
javax.swing.JScrollPane jScrollPane2
Object getValueAt(int rowIndex, int columnIndex)
javax.swing.JTable ingestModuleTable
List< IngestJobInfo > ingestJobs
void addIngestJobEventListener(final PropertyChangeListener listener)
SleuthkitCase getSleuthkitCase()
javax.swing.JLabel jLabel2
String getColumnName(int column)
javax.swing.JLabel jLabel1
String getColumnName(int column)
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
void customizeComponents()
javax.swing.JTable ingestJobTable