diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/PortableCaseInterestingItemsListPanel.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/PortableCaseInterestingItemsListPanel.java index e4d9f319b9..a85a576523 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/PortableCaseInterestingItemsListPanel.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/PortableCaseInterestingItemsListPanel.java @@ -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 - - 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 + + // 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 + + // 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); diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/PortableCaseTagsListPanel.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/PortableCaseTagsListPanel.java index cb6f37c7a2..97fa45f13f 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/PortableCaseTagsListPanel.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/PortableCaseTagsListPanel.java @@ -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 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(); - - // 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 tagCountsByID = callback.getTagCountMap(); + // 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); + 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 diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel2.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel2.java index aa5c2ed59f..e34098bf10 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportVisualPanel2.java @@ -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(); diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java index d5b86e69ca..d39db13392 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardIterator.java @@ -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 moduleConfigs; + private final boolean useCaseSpecificData; - ReportWizardPortableCaseOptionsPanel(Map moduleConfigs) { + ReportWizardPortableCaseOptionsPanel(Map 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; } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPortableCaseOptionsVisualPanel.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPortableCaseOptionsVisualPanel.java index 7e1bc02332..72ffd4b8de 100644 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPortableCaseOptionsVisualPanel.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportWizardPortableCaseOptionsVisualPanel.java @@ -36,12 +36,14 @@ class ReportWizardPortableCaseOptionsVisualPanel extends javax.swing.JPanel { private final ReportWizardPortableCaseOptionsPanel wizPanel; private PortableCaseReportModuleSettings settings = null; private Map moduleConfigs; + private final boolean useCaseSpecificData; /** * Creates new form ReportWizardPortableCaseOptionsVisualPanel */ - ReportWizardPortableCaseOptionsVisualPanel(ReportWizardPortableCaseOptionsPanel wizPanel, Map moduleConfigs) { + ReportWizardPortableCaseOptionsVisualPanel(ReportWizardPortableCaseOptionsPanel wizPanel, Map 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({