From 9e39dcff3ec0200ab0d08a8d10e5e7c866ef80ed Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 10 Sep 2021 18:44:28 -0400 Subject: [PATCH] 7918 delete OO viewer code to use caseDB --- .../application/NodeData.java | 12 +-------- .../application/OtherOccurrences.java | 13 +-------- .../application/UniquePathKey.java | 1 - .../contentviewer/OtherOccurrencesPanel.java | 27 ++++++------------- 4 files changed, 10 insertions(+), 43 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/application/NodeData.java b/Core/src/org/sleuthkit/autopsy/centralrepository/application/NodeData.java index bae27ab680..0f2ada5220 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/application/NodeData.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/application/NodeData.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2018-2019 Basis Technology Corp. + * Copyright 2018-2021 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -123,16 +123,6 @@ public class NodeData { comment = newComment; } - /** - * Check if this is a central repo node. - * - * @return true if this node was created from a central repo instance, false - * otherwise - */ - public boolean isCentralRepoNode() { - return (originalCorrelationInstance != null); - } - /** * Get the case name * diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java b/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java index 643f5d5de7..817d7068a7 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/application/OtherOccurrences.java @@ -263,13 +263,6 @@ public final class OtherOccurrences { nodeDataMap.put(uniquePathKey, newNode); } } - if (file != null && corAttr.getCorrelationType().getDisplayName().equals("Files")) { - List caseDbFiles = getCaseDbMatches(corAttr, openCase, file); - - for (AbstractFile caseDbFile : caseDbFiles) { - addOrUpdateNodeData(openCase, nodeDataMap, caseDbFile); - } - } return nodeDataMap; } catch (CentralRepoException ex) { logger.log(Level.SEVERE, "Error getting artifact instances from database.", ex); // NON-NLS @@ -277,11 +270,7 @@ public final class OtherOccurrences { logger.log(Level.INFO, "Error getting artifact instances from database.", ex); // NON-NLS } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); // NON-NLS - } catch (TskCoreException ex) { - // do nothing. - // @@@ Review this behavior - logger.log(Level.SEVERE, "Exception while querying open case.", ex); // NON-NLS - } + } return new HashMap<>( 0); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/application/UniquePathKey.java b/Core/src/org/sleuthkit/autopsy/centralrepository/application/UniquePathKey.java index 6de3ff2799..0ba064c58e 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/application/UniquePathKey.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/application/UniquePathKey.java @@ -22,7 +22,6 @@ import java.util.Objects; import java.util.logging.Level; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.centralrepository.contentviewer.OtherOccurrencesPanel; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.coreutils.Logger; diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesPanel.java index 9e962b1a1b..2bf709cfb8 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesPanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesPanel.java @@ -329,8 +329,8 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel { } casesTableModel.clearTable(); - - OtherOccurrenceOneTypeWorker.OneTypeData data = get(); + + OtherOccurrenceOneTypeWorker.OneTypeData data = get(); correlationAttributes.addAll(data.getCorrelationAttributesToAdd()); for (CorrelationCase corCase : data.getCaseNames().values()) { casesTableModel.addCorrelationCase(new CorrelationCaseWrapper(corCase)); @@ -447,12 +447,8 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel { for (NodeData nodeData : correlatedNodeDataMap.values()) { for (int selectedRow : selectedCaseIndexes) { try { - if (nodeData.isCentralRepoNode()) { - if (casesTableModel.getCorrelationCase(casesTable.convertRowIndexToModel(selectedRow)) != null - && casesTableModel.getCorrelationCase(casesTable.convertRowIndexToModel(selectedRow)).getCaseUUID().equals(nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID())) { - dataSourcesTableModel.addNodeData(nodeData); - } - } else if (currentCaseName != null && (casesTableModel.getCorrelationCase(casesTable.convertRowIndexToModel(selectedRow)).getCaseUUID().equals(currentCaseName))) { + if (casesTableModel.getCorrelationCase(casesTable.convertRowIndexToModel(selectedRow)) != null + && casesTableModel.getCorrelationCase(casesTable.convertRowIndexToModel(selectedRow)).getCaseUUID().equals(nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID())) { dataSourcesTableModel.addNodeData(nodeData); } } catch (CentralRepoException ex) { @@ -505,15 +501,9 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel { for (int selectedDataSourceRow : selectedDataSources) { int rowModelIndex = dataSourcesTable.convertRowIndexToModel(selectedDataSourceRow); try { - if (nodeData.isCentralRepoNode()) { - if (dataSourcesTableModel.getCaseUUIDForRow(rowModelIndex).equals(nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID()) - && dataSourcesTableModel.getDeviceIdForRow(rowModelIndex).equals(nodeData.getDeviceID())) { - filesTableModel.addNodeData(nodeData); - } - } else { - if (dataSourcesTableModel.getDeviceIdForRow(dataSourcesTable.convertRowIndexToModel(selectedDataSourceRow)).equals(nodeData.getDeviceID())) { - filesTableModel.addNodeData(nodeData); - } + if (dataSourcesTableModel.getCaseUUIDForRow(rowModelIndex).equals(nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID()) + && dataSourcesTableModel.getDeviceIdForRow(rowModelIndex).equals(nodeData.getDeviceID())) { + filesTableModel.addNodeData(nodeData); } } catch (CentralRepoException ex) { logger.log(Level.WARNING, "Unable to get correlation attribute instance from OtherOccurrenceNodeInstanceData for case " + nodeData.getCaseName(), ex); @@ -876,8 +866,7 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel { int rowIndex = filesTable.getSelectedRow(); List selectedFile = filesTableModel.getListOfNodesForFile(rowIndex); if (!selectedFile.isEmpty() && selectedFile.get(0) instanceof NodeData) { - NodeData instanceData = selectedFile.get(0); - enableCentralRepoActions = instanceData.isCentralRepoNode(); + enableCentralRepoActions = true; } } showCaseDetailsMenuItem.setVisible(enableCentralRepoActions);