mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-06 02:24:30 +00:00
3153 change priority column to prioritized flag column, fix priority saving bug
This commit is contained in:
@@ -141,7 +141,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
|
||||
private static final int GENERIC_COL_MAX_WIDTH = 2000;
|
||||
private static final int PENDING_TABLE_COL_PREFERRED_WIDTH = 280;
|
||||
private static final int RUNNING_TABLE_COL_PREFERRED_WIDTH = 175;
|
||||
private static final int PRIORITY_COLUMN_PREFERRED_WIDTH = 50;
|
||||
private static final int PRIORITY_COLUMN_PREFERRED_WIDTH = 60;
|
||||
private static final int PRIORITY_COLUMN_MAX_WIDTH = 150;
|
||||
private static final int ACTIVITY_TIME_COL_MIN_WIDTH = 250;
|
||||
private static final int ACTIVITY_TIME_COL_MAX_WIDTH = 450;
|
||||
@@ -182,7 +182,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
|
||||
* ordinal or a column header string.
|
||||
*/
|
||||
@Messages({
|
||||
"AutoIngestControlPanel.JobsTableModel.ColumnHeader.Priority=Priority",
|
||||
"AutoIngestControlPanel.JobsTableModel.ColumnHeader.Priority=Prioritized",
|
||||
"AutoIngestControlPanel.JobsTableModel.ColumnHeader.Case=Case",
|
||||
"AutoIngestControlPanel.JobsTableModel.ColumnHeader.ImageFolder=Data Source",
|
||||
"AutoIngestControlPanel.JobsTableModel.ColumnHeader.HostName=Host Name",
|
||||
@@ -266,32 +266,12 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
|
||||
|
||||
manager = AutoIngestManager.getInstance();
|
||||
|
||||
pendingTableModel = new DefaultTableModel(JobsTableModelColumns.headers, 0) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
pendingTableModel = new AutoIngestTableModel(JobsTableModelColumns.headers, 0);
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
runningTableModel = new AutoIngestTableModel(JobsTableModelColumns.headers, 0);
|
||||
|
||||
runningTableModel = new DefaultTableModel(JobsTableModelColumns.headers, 0) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
completedTableModel = new AutoIngestTableModel(JobsTableModelColumns.headers, 0);
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
completedTableModel = new DefaultTableModel(JobsTableModelColumns.headers, 0) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
initComponents(); // Generated code.
|
||||
setServicesStatusMessage();
|
||||
initPendingJobsTable();
|
||||
@@ -426,12 +406,13 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
|
||||
column.setWidth(TIME_COL_PREFERRED_WIDTH);
|
||||
|
||||
column = pendingTable.getColumn(JobsTableModelColumns.PRIORITY.getColumnHeader());
|
||||
column.setCellRenderer(new PrioritizedIconCellRenderer());
|
||||
column.setMaxWidth(PRIORITY_COLUMN_MAX_WIDTH);
|
||||
column.setPreferredWidth(PRIORITY_COLUMN_PREFERRED_WIDTH);
|
||||
column.setWidth(PRIORITY_COLUMN_PREFERRED_WIDTH);
|
||||
|
||||
/**
|
||||
* Prevent sorting when a column header is clicked.
|
||||
* Allow sorting when a column header is clicked.
|
||||
*/
|
||||
pendingTable.setAutoCreateRowSorter(true);
|
||||
|
||||
@@ -621,7 +602,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
|
||||
column.setWidth(STATUS_COL_PREFERRED_WIDTH);
|
||||
|
||||
/*
|
||||
* Prevent sorting when a column header is clicked.
|
||||
* Allow sorting when a column header is clicked.
|
||||
*/
|
||||
completedTable.setAutoCreateRowSorter(true);
|
||||
|
||||
@@ -1846,4 +1827,33 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
|
||||
private javax.swing.JTextField tbStatusMessage;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private class AutoIngestTableModel extends DefaultTableModel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private AutoIngestTableModel(String[] headers, int i) {
|
||||
super(headers, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int columnIndex) {
|
||||
if (columnIndex == JobsTableModelColumns.PRIORITY.ordinal()) {
|
||||
return Integer.class;
|
||||
} else if (columnIndex == JobsTableModelColumns.CREATED_TIME.ordinal()
|
||||
|| columnIndex == JobsTableModelColumns.COMPLETED_TIME.ordinal()
|
||||
|| columnIndex == JobsTableModelColumns.STARTED_TIME.ordinal()
|
||||
|| columnIndex == JobsTableModelColumns.STAGE_TIME.ordinal()) {
|
||||
return Date.class;
|
||||
} else if (columnIndex == JobsTableModelColumns.STATUS.ordinal()) {
|
||||
return Boolean.class;
|
||||
} else {
|
||||
return super.getColumnClass(columnIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,6 +503,7 @@ public final class AutoIngestManager extends Observable implements PropertyChang
|
||||
}
|
||||
SYS_LOGGER.log(Level.INFO, "Starting input scan of {0}", rootInputDirectory);
|
||||
InputDirScanner scanner = new InputDirScanner();
|
||||
|
||||
scanner.scan();
|
||||
SYS_LOGGER.log(Level.INFO, "Completed input scan of {0}", rootInputDirectory);
|
||||
}
|
||||
@@ -558,10 +559,12 @@ public final class AutoIngestManager extends Observable implements PropertyChang
|
||||
if (!prioritizedJobs.isEmpty()) {
|
||||
++maxPriority;
|
||||
for (AutoIngestJob job : prioritizedJobs) {
|
||||
int oldPriority = job.getPriority();
|
||||
job.setPriority(maxPriority);
|
||||
try {
|
||||
this.updateCoordinationServiceNode(job);
|
||||
job.setPriority(maxPriority);
|
||||
} catch (CoordinationServiceException | InterruptedException ex) {
|
||||
job.setPriority(oldPriority);
|
||||
throw new AutoIngestManagerException("Error updating case priority", ex);
|
||||
}
|
||||
}
|
||||
@@ -612,12 +615,14 @@ public final class AutoIngestManager extends Observable implements PropertyChang
|
||||
*/
|
||||
if (null != prioritizedJob) {
|
||||
++maxPriority;
|
||||
int oldPriority = prioritizedJob.getPriority();
|
||||
prioritizedJob.setPriority(maxPriority);
|
||||
try {
|
||||
this.updateCoordinationServiceNode(prioritizedJob);
|
||||
} catch (CoordinationServiceException | InterruptedException ex) {
|
||||
prioritizedJob.setPriority(oldPriority);
|
||||
throw new AutoIngestManagerException("Error updating job priority", ex);
|
||||
}
|
||||
prioritizedJob.setPriority(maxPriority);
|
||||
}
|
||||
|
||||
Collections.sort(pendingJobs, new AutoIngestJob.PriorityComparator());
|
||||
@@ -1046,8 +1051,8 @@ public final class AutoIngestManager extends Observable implements PropertyChang
|
||||
|
||||
if (null != manifest) {
|
||||
/*
|
||||
* Update the mapping of case names to manifest paths that is
|
||||
* used for case deletion.
|
||||
* Update the mapping of case names to manifest paths that
|
||||
* is used for case deletion.
|
||||
*/
|
||||
String caseName = manifest.getCaseName();
|
||||
Path manifestPath = manifest.getFilePath();
|
||||
@@ -1061,8 +1066,8 @@ public final class AutoIngestManager extends Observable implements PropertyChang
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a job to the pending jobs queue, the completed jobs list,
|
||||
* or do crashed job recovery, as required.
|
||||
* Add a job to the pending jobs queue, the completed jobs
|
||||
* list, or do crashed job recovery, as required.
|
||||
*/
|
||||
try {
|
||||
byte[] rawData = coordinationService.getNodeData(CoordinationService.CategoryNode.MANIFESTS, manifestPath.toString());
|
||||
@@ -1082,7 +1087,7 @@ public final class AutoIngestManager extends Observable implements PropertyChang
|
||||
break;
|
||||
case DELETED:
|
||||
/*
|
||||
* Ignore jobs marked as "deleted."
|
||||
* Ignore jobs marked as "deleted."
|
||||
*/
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2017 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.experimental.autoingest;
|
||||
|
||||
import java.awt.Component;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JTable;
|
||||
import static javax.swing.SwingConstants.CENTER;
|
||||
import org.openide.util.ImageUtilities;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
|
||||
/**
|
||||
* A JTable cell renderer that represents whether the priority value of a job
|
||||
* has ever been increased, tick if prioritized nothing if not.
|
||||
*/
|
||||
class PrioritizedIconCellRenderer extends GrayableCellRenderer {
|
||||
|
||||
|
||||
@Messages({
|
||||
"PrioritizedIconCellRenderer.prioritized.tooltiptext=This job has been prioritised. The most recently prioritised job should be processed next.",
|
||||
"PrioritizedIconCellRenderer.notPrioritized.tooltiptext=This job has not been prioritized."
|
||||
})
|
||||
private static final long serialVersionUID = 1L;
|
||||
static final ImageIcon checkedIcon = new ImageIcon(ImageUtilities.loadImage("org/sleuthkit/autopsy/experimental/images/tick.png", false));
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
setHorizontalAlignment(CENTER);
|
||||
if ((value instanceof Integer)) {
|
||||
if ((int) value == 0) {
|
||||
setIcon(null);
|
||||
setToolTipText(org.openide.util.NbBundle.getMessage(CaseStatusIconCellRenderer.class, "PrioritizedIconCellRenderer.notPrioritized.tooltiptext"));
|
||||
} else {
|
||||
setIcon(checkedIcon);
|
||||
setToolTipText(org.openide.util.NbBundle.getMessage(CaseStatusIconCellRenderer.class, "PrioritizedIconCellRenderer.prioritized.tooltiptext"));
|
||||
}
|
||||
}
|
||||
grayCellIfTableNotEnabled(table, isSelected);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user