mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Fixed a bug in portable case UI panels
This commit is contained in:
parent
24fe6e35bb
commit
0c68f4aa3d
@ -60,12 +60,14 @@ class PortableCaseInterestingItemsListPanel extends javax.swing.JPanel {
|
||||
|
||||
private final ReportWizardPortableCaseOptionsPanel wizPanel;
|
||||
private final PortableCaseReportModuleSettings settings;
|
||||
private final boolean useCaseSpecificData;
|
||||
|
||||
/**
|
||||
* Creates new form PortableCaseListPanel
|
||||
*/
|
||||
PortableCaseInterestingItemsListPanel(ReportWizardPortableCaseOptionsPanel wizPanel, PortableCaseReportModuleSettings options) {
|
||||
PortableCaseInterestingItemsListPanel(ReportWizardPortableCaseOptionsPanel wizPanel, PortableCaseReportModuleSettings options, boolean useCaseSpecificData) {
|
||||
this.wizPanel = wizPanel;
|
||||
this.useCaseSpecificData = useCaseSpecificData;
|
||||
this.settings = options;
|
||||
initComponents();
|
||||
customizeComponents();
|
||||
@ -98,26 +100,31 @@ class PortableCaseInterestingItemsListPanel extends javax.swing.JPanel {
|
||||
// Get the set names in use for the current case.
|
||||
setNames = new ArrayList<>();
|
||||
setCounts = new HashMap<>();
|
||||
try {
|
||||
// There may not be a case open when configuring report modules for Command Line execution
|
||||
// Get all SET_NAMEs from interesting item artifacts
|
||||
String innerSelect = "SELECT (value_text) AS set_name FROM blackboard_attributes WHERE (artifact_type_id = '" +
|
||||
BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID() + "' OR artifact_type_id = '" +
|
||||
BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID() + "') AND attribute_type_id = '" +
|
||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() + "'"; // NON-NLS
|
||||
|
||||
// Get the count of each SET_NAME
|
||||
String query = "set_name, count(1) AS set_count FROM (" + innerSelect + ") set_names GROUP BY set_name"; // NON-NLS
|
||||
// only try to load tag names if we are displaying case specific data, otherwise
|
||||
// we will be displaying case specific data in command line wizard if there is
|
||||
// a case open in the background
|
||||
if (useCaseSpecificData) {
|
||||
try {
|
||||
// Get all SET_NAMEs from interesting item artifacts
|
||||
String innerSelect = "SELECT (value_text) AS set_name FROM blackboard_attributes WHERE (artifact_type_id = '"
|
||||
+ BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID() + "' OR artifact_type_id = '"
|
||||
+ BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT.getTypeID() + "') AND attribute_type_id = '"
|
||||
+ BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() + "'"; // NON-NLS
|
||||
|
||||
GetInterestingItemSetNamesCallback callback = new GetInterestingItemSetNamesCallback();
|
||||
Case.getCurrentCaseThrows().getSleuthkitCase().getCaseDbAccessManager().select(query, callback);
|
||||
setCounts = callback.getSetCountMap();
|
||||
setNames.addAll(setCounts.keySet());
|
||||
} catch (TskCoreException ex) {
|
||||
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.SEVERE, "Failed to get interesting item set names", ex); // NON-NLS
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
// There may not be a case open when configuring report modules for Command Line execution
|
||||
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.WARNING, "Exception while getting open case.", ex); // NON-NLS
|
||||
// Get the count of each SET_NAME
|
||||
String query = "set_name, count(1) AS set_count FROM (" + innerSelect + ") set_names GROUP BY set_name"; // NON-NLS
|
||||
|
||||
GetInterestingItemSetNamesCallback callback = new GetInterestingItemSetNamesCallback();
|
||||
Case.getCurrentCaseThrows().getSleuthkitCase().getCaseDbAccessManager().select(query, callback);
|
||||
setCounts = callback.getSetCountMap();
|
||||
setNames.addAll(setCounts.keySet());
|
||||
} catch (TskCoreException ex) {
|
||||
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.SEVERE, "Failed to get interesting item set names", ex); // NON-NLS
|
||||
} catch (NoCurrentCaseException ex) {
|
||||
// There may not be a case open when configuring report modules for Command Line execution
|
||||
Logger.getLogger(ReportWizardPortableCaseOptionsVisualPanel.class.getName()).log(Level.WARNING, "Exception while getting open case.", ex); // NON-NLS
|
||||
}
|
||||
}
|
||||
Collections.sort(setNames);
|
||||
|
||||
|
@ -60,12 +60,14 @@ class PortableCaseTagsListPanel extends javax.swing.JPanel {
|
||||
|
||||
private final ReportWizardPortableCaseOptionsPanel wizPanel;
|
||||
private final PortableCaseReportModuleSettings settings;
|
||||
private final boolean useCaseSpecificData;
|
||||
|
||||
/**
|
||||
* Creates new form PortableCaseListPanel
|
||||
*/
|
||||
PortableCaseTagsListPanel(ReportWizardPortableCaseOptionsPanel wizPanel, PortableCaseReportModuleSettings options) {
|
||||
PortableCaseTagsListPanel(ReportWizardPortableCaseOptionsPanel wizPanel, PortableCaseReportModuleSettings options, boolean useCaseSpecificData) {
|
||||
this.wizPanel = wizPanel;
|
||||
this.useCaseSpecificData = useCaseSpecificData;
|
||||
this.settings = options;
|
||||
initComponents();
|
||||
customizeComponents();
|
||||
@ -95,18 +97,23 @@ class PortableCaseTagsListPanel extends javax.swing.JPanel {
|
||||
private void customizeComponents() {
|
||||
// Get the tag names in use for the current case.
|
||||
tagNames = new ArrayList<>();
|
||||
Map<Long, Long> tagCountsByID = new HashMap<>();
|
||||
try {
|
||||
// There may not be a case open when configuring report modules for Command Line execution
|
||||
tagNames = Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse();
|
||||
// only try to load tag names if we are displaying case specific data, otherwise
|
||||
// we will be displaying case specific data in command line wizard if there is
|
||||
// a case open in the background
|
||||
if (useCaseSpecificData) {
|
||||
tagNames = Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse();
|
||||
|
||||
// Get the counts for each tag ID
|
||||
String query = "tag_name_id, count(1) AS tag_count " +
|
||||
"FROM (" +
|
||||
"SELECT tag_name_id FROM content_tags UNION ALL SELECT tag_name_id FROM blackboard_artifact_tags" +
|
||||
") tag_ids GROUP BY tag_name_id"; // NON-NLS
|
||||
GetTagCountsCallback callback = new GetTagCountsCallback();
|
||||
Case.getCurrentCaseThrows().getSleuthkitCase().getCaseDbAccessManager().select(query, callback);
|
||||
Map<Long, Long> tagCountsByID = callback.getTagCountMap();
|
||||
// Get the counts for each tag ID
|
||||
String query = "tag_name_id, count(1) AS tag_count "
|
||||
+ "FROM ("
|
||||
+ "SELECT tag_name_id FROM content_tags UNION ALL SELECT tag_name_id FROM blackboard_artifact_tags"
|
||||
+ ") tag_ids GROUP BY tag_name_id"; // NON-NLS
|
||||
GetTagCountsCallback callback = new GetTagCountsCallback();
|
||||
Case.getCurrentCaseThrows().getSleuthkitCase().getCaseDbAccessManager().select(query, callback);
|
||||
tagCountsByID = callback.getTagCountMap();
|
||||
}
|
||||
|
||||
// Mark the tag names as unselected. Note that tagNameSelections is a
|
||||
// LinkedHashMap so that order is preserved and the tagNames and tagNameSelections
|
||||
|
@ -146,7 +146,8 @@ final class ReportVisualPanel2 extends JPanel {
|
||||
// by user. We should read tag names from the database each time.
|
||||
try {
|
||||
// only try to load tag names if we are displaying case specific data, otherwise
|
||||
// there may not be a case open.
|
||||
// we will be displaying case specific data in command line wizard if there is
|
||||
// a case open in the background
|
||||
if (useCaseSpecificData) {
|
||||
// get tags and artifact types from current case
|
||||
tagNamesInUse = Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse();
|
||||
|
@ -18,9 +18,6 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.report.infrastructure;
|
||||
|
||||
import org.sleuthkit.autopsy.report.infrastructure.ReportingConfigLoader;
|
||||
import org.sleuthkit.autopsy.report.infrastructure.ReportConfigException;
|
||||
import org.sleuthkit.autopsy.report.infrastructure.ReportingConfig;
|
||||
import java.awt.Component;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -74,12 +71,12 @@ final class ReportWizardIterator implements WizardDescriptor.Iterator<WizardDesc
|
||||
firstPanel = new ReportWizardPanel1(config.getModuleConfigs());
|
||||
tableConfigPanel = new ReportWizardPanel2(useCaseSpecificData, config.getTableReportSettings());
|
||||
fileConfigPanel = new ReportWizardFileOptionsPanel(config.getFileReportSettings());
|
||||
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(config.getModuleConfigs());
|
||||
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(config.getModuleConfigs(), useCaseSpecificData);
|
||||
} else {
|
||||
firstPanel = new ReportWizardPanel1(null);
|
||||
tableConfigPanel = new ReportWizardPanel2(useCaseSpecificData, null);
|
||||
fileConfigPanel = new ReportWizardFileOptionsPanel(null);
|
||||
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(null);
|
||||
portableCaseConfigPanel = new ReportWizardPortableCaseOptionsPanel(null, useCaseSpecificData);
|
||||
}
|
||||
|
||||
allConfigPanels = new WizardDescriptor.Panel[]{firstPanel, tableConfigPanel, fileConfigPanel, portableCaseConfigPanel};
|
||||
|
@ -37,9 +37,11 @@ class ReportWizardPortableCaseOptionsPanel implements WizardDescriptor.Finishabl
|
||||
private ReportWizardPortableCaseOptionsVisualPanel component;
|
||||
private final JButton finishButton;
|
||||
private Map<String, ReportModuleConfig> moduleConfigs;
|
||||
private final boolean useCaseSpecificData;
|
||||
|
||||
ReportWizardPortableCaseOptionsPanel(Map<String, ReportModuleConfig> moduleConfigs) {
|
||||
ReportWizardPortableCaseOptionsPanel(Map<String, ReportModuleConfig> moduleConfigs, boolean useCaseSpecificData) {
|
||||
this.moduleConfigs = moduleConfigs;
|
||||
this.useCaseSpecificData = useCaseSpecificData;
|
||||
finishButton = new JButton(
|
||||
NbBundle.getMessage(this.getClass(), "ReportWizardFileOptionsPanel.finishButton.text"));
|
||||
finishButton.setEnabled(false);
|
||||
@ -69,7 +71,7 @@ class ReportWizardPortableCaseOptionsPanel implements WizardDescriptor.Finishabl
|
||||
@Override
|
||||
public ReportWizardPortableCaseOptionsVisualPanel getComponent() {
|
||||
if (component == null) {
|
||||
component = new ReportWizardPortableCaseOptionsVisualPanel(this, moduleConfigs);
|
||||
component = new ReportWizardPortableCaseOptionsVisualPanel(this, moduleConfigs, useCaseSpecificData);
|
||||
}
|
||||
return component;
|
||||
}
|
||||
|
@ -36,12 +36,14 @@ class ReportWizardPortableCaseOptionsVisualPanel extends javax.swing.JPanel {
|
||||
private final ReportWizardPortableCaseOptionsPanel wizPanel;
|
||||
private PortableCaseReportModuleSettings settings = null;
|
||||
private Map<String, ReportModuleConfig> moduleConfigs;
|
||||
private final boolean useCaseSpecificData;
|
||||
|
||||
/**
|
||||
* Creates new form ReportWizardPortableCaseOptionsVisualPanel
|
||||
*/
|
||||
ReportWizardPortableCaseOptionsVisualPanel(ReportWizardPortableCaseOptionsPanel wizPanel, Map<String, ReportModuleConfig> moduleConfigs) {
|
||||
ReportWizardPortableCaseOptionsVisualPanel(ReportWizardPortableCaseOptionsPanel wizPanel, Map<String, ReportModuleConfig> moduleConfigs, boolean useCaseSpecificData) {
|
||||
this.wizPanel = wizPanel;
|
||||
this.useCaseSpecificData = useCaseSpecificData;
|
||||
this.moduleConfigs = moduleConfigs;
|
||||
initComponents();
|
||||
customizeComponents();
|
||||
@ -86,8 +88,8 @@ class ReportWizardPortableCaseOptionsVisualPanel extends javax.swing.JPanel {
|
||||
|
||||
// initialize other panels and pass them the settings
|
||||
listPanel.setLayout(new GridLayout(1,2));
|
||||
listPanel.add(new PortableCaseTagsListPanel(wizPanel, settings));
|
||||
listPanel.add(new PortableCaseInterestingItemsListPanel(wizPanel, settings));
|
||||
listPanel.add(new PortableCaseTagsListPanel(wizPanel, settings, useCaseSpecificData));
|
||||
listPanel.add(new PortableCaseInterestingItemsListPanel(wizPanel, settings, useCaseSpecificData));
|
||||
}
|
||||
|
||||
@NbBundle.Messages({
|
||||
|
Loading…
x
Reference in New Issue
Block a user