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;
48 private final DateFormat
datetimeFormat =
new SimpleDateFormat(
"yyyy/MM/dd HH:mm:ss");
58 @Messages({
"IngestJobInfoPanel.loadIngestJob.error.text=Failed to load ingest jobs.",
59 "IngestJobInfoPanel.loadIngestJob.error.title=Load Failure"})
62 this.
ingestJobTable.getSelectionModel().addListSelectionListener((ListSelectionEvent e) -> {
79 List<IngestJobInfo> ingestJobs = skCase.getIngestJobs();
83 logger.log(Level.SEVERE,
"Failed to load ingest jobs.", ex);
84 JOptionPane.showMessageDialog(
this, Bundle.IngestJobInfoPanel_loadIngestJob_error_text(), Bundle.IngestJobInfoPanel_loadIngestJob_error_title(), JOptionPane.ERROR_MESSAGE);
88 @Messages({
"IngestJobInfoPanel.IngestJobTableModel.DataSource.header=Data Source",
89 "IngestJobInfoPanel.IngestJobTableModel.StartTime.header=Start Time",
90 "IngestJobInfoPanel.IngestJobTableModel.EndTime.header=End Time",
91 "IngestJobInfoPanel.IngestJobTableModel.IngestStatus.header=Ingest Status"})
94 private List<String> columnHeaders =
new ArrayList<>();
97 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestJobTableModel_DataSource_header());
98 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestJobTableModel_StartTime_header());
99 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestJobTableModel_EndTime_header());
100 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestJobTableModel_IngestStatus_header());
105 return ingestJobs.size();
110 return columnHeaders.size();
115 IngestJobInfo currIngestJob = ingestJobs.get(rowIndex);
116 if (columnIndex == 0) {
119 return skCase.getContentById(currIngestJob.getObjectId()).getName();
121 logger.log(Level.SEVERE,
"Failed to get content from db", ex);
124 }
else if (columnIndex == 1) {
125 return datetimeFormat.format(currIngestJob.getStartDateTime());
126 }
else if (columnIndex == 2) {
127 Date endDate = currIngestJob.getEndDateTime();
128 if (endDate.getTime() == 0) {
131 return datetimeFormat.format(currIngestJob.getEndDateTime());
132 }
else if (columnIndex == 3) {
133 return currIngestJob.getStatus().getDisplayName();
140 return columnHeaders.get(column);
145 @Messages({
"IngestJobInfoPanel.IngestModuleTableModel.ModuleName.header=Module Name",
146 "IngestJobInfoPanel.IngestModuleTableModel.ModuleVersion.header=Module Version"})
149 private List<String> columnHeaders =
new ArrayList<>();
153 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestModuleTableModel_ModuleName_header());
154 columnHeaders.add(Bundle.IngestJobInfoPanel_IngestModuleTableModel_ModuleVersion_header());
155 this.currJob = currJob;
160 if (currJob == null) {
163 return currJob.getIngestModuleInfo().size();
168 return columnHeaders.size();
173 if (currJob != null) {
174 IngestModuleInfo currIngestModule = currJob.getIngestModuleInfo().get(rowIndex);
175 if (columnIndex == 0) {
176 return currIngestModule.getDisplayName();
177 }
else if (columnIndex == 1) {
178 return currIngestModule.getVersion();
187 return columnHeaders.get(column);
197 @SuppressWarnings(
"unchecked")
203 jLabel1 =
new javax.swing.JLabel();
204 jLabel2 =
new javax.swing.JLabel();
213 ingestJobTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
215 org.openide.awt.Mnemonics.setLocalizedText(
jLabel1,
org.openide.util.NbBundle.getMessage(
IngestJobInfoPanel.class,
"IngestJobInfoPanel.jLabel1.text"));
217 org.openide.awt.Mnemonics.setLocalizedText(
jLabel2,
org.openide.util.NbBundle.getMessage(
IngestJobInfoPanel.class,
"IngestJobInfoPanel.jLabel2.text"));
222 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
223 this.setLayout(layout);
224 layout.setHorizontalGroup(
225 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
226 .addGroup(layout.createSequentialGroup()
228 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
230 .addComponent(
jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE))
232 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
233 .addComponent(
jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE)
237 layout.setVerticalGroup(
238 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
239 .addGroup(layout.createSequentialGroup()
241 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
244 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
245 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
246 .addComponent(
jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
247 .addComponent(
jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
Object getValueAt(int rowIndex, int columnIndex)
IngestJobTableModel ingestJobTableModel
static synchronized IngestManager getInstance()
javax.swing.JScrollPane jScrollPane1
javax.swing.JScrollPane jScrollPane2
static Case getOpenCase()
final DateFormat datetimeFormat
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
IngestModuleTableModel ingestModuleTableModel
String getColumnName(int column)
synchronized static Logger getLogger(String name)
void customizeComponents()
javax.swing.JTable ingestJobTable
static final Logger logger