diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceKey.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceKey.java index 5b3ab52fd4..0e89e3a1b6 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceKey.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceKey.java @@ -105,10 +105,7 @@ final class AccountDeviceInstanceKey { if (!Objects.equals(this.dataSourceName, other.dataSourceName)) { return false; } - if (!Objects.equals(this.accountDeviceInstance, other.accountDeviceInstance)) { - return false; - } - return true; + return Objects.equals(this.accountDeviceInstance, other.accountDeviceInstance); } private static String getDataSourceName(AccountDeviceInstance accountDeviceInstance, SleuthkitCase db) { diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNodeFactory.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNodeFactory.java index bb63d65270..5fe069b523 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNodeFactory.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNodeFactory.java @@ -55,7 +55,7 @@ final class AccountDeviceInstanceNodeFactory extends ChildFactory { if (ExplorerManager.PROP_ROOT_CONTEXT.equals(evt.getPropertyName())) { diff --git a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java index 55d1ccb0fd..d19ad25496 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java @@ -160,13 +160,13 @@ public final class CVTTopComponent extends TopComponent { .collect(Collectors.toList()); } - private static class ProxyLookupImpl extends ProxyLookup { + final private static class ProxyLookupImpl extends ProxyLookup { ProxyLookupImpl(Lookup... l) { super(l); } - void changeLookups(Lookup... l) { + protected void changeLookups(Lookup... l) { setLookups(l); } } diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java index eb81c23ce5..8fe4873f54 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java @@ -25,6 +25,7 @@ import java.util.stream.Stream; import javax.swing.JPanel; import org.openide.explorer.ExplorerManager; import org.openide.nodes.Node; +import org.openide.util.NbBundle; import org.sleuthkit.autopsy.corecomponents.DataResultPanel; import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable; import org.sleuthkit.autopsy.corecomponents.TableFilterNode; @@ -43,7 +44,6 @@ public final class MessageBrowser extends JPanel implements ExplorerManager.Prov private final ExplorerManager tableEM; private final ExplorerManager gacExplorerManager; private final DataResultPanel messagesResultPanel; - private DataResultViewerTable dataResultViewerTable; /** * Constructs the right hand side of the Communications Visualization Tool @@ -56,6 +56,7 @@ public final class MessageBrowser extends JPanel implements ExplorerManager.Prov * in the messages browser can be exposed to * context-sensitive actions. */ + @NbBundle.Messages({"MessageBrowser.DataResultViewerTable.title=Messages"}) public MessageBrowser(ExplorerManager tableEM, ExplorerManager gacExplorerManager) { this.tableEM = tableEM; this.gacExplorerManager = gacExplorerManager; @@ -64,13 +65,13 @@ public final class MessageBrowser extends JPanel implements ExplorerManager.Prov messagesResultPanel = DataResultPanel.createInstanceUninitialized("Account", "", Node.EMPTY, 0, messageDataContent); splitPane.setTopComponent(messagesResultPanel); splitPane.setBottomComponent(messageDataContent); - dataResultViewerTable = new DataResultViewerTable(gacExplorerManager, "Messages"); - messagesResultPanel.addResultViewer(dataResultViewerTable); + messagesResultPanel.addResultViewer(new DataResultViewerTable(gacExplorerManager, + Bundle.MessageBrowser_DataResultViewerTable_title())); messagesResultPanel.open(); - tableEM.addPropertyChangeListener(pce -> { + this.tableEM.addPropertyChangeListener(pce -> { if (pce.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) { - final Node[] selectedNodes = tableEM.getSelectedNodes(); + final Node[] selectedNodes = this.tableEM.getSelectedNodes(); messagesResultPanel.setNumMatches(0); messagesResultPanel.setNode(null); diff --git a/Core/src/org/sleuthkit/autopsy/communications/OpenCommVisualizationToolAction.java b/Core/src/org/sleuthkit/autopsy/communications/OpenCommVisualizationToolAction.java index a977ff2c09..e3dc552bab 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/OpenCommVisualizationToolAction.java +++ b/Core/src/org/sleuthkit/autopsy/communications/OpenCommVisualizationToolAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2017 Basis Technology Corp. + * Copyright 2017-18 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -48,10 +48,10 @@ import org.sleuthkit.autopsy.core.RuntimeProperties; , @ActionReference(path = "Toolbars/Case", position = 102)}) @Messages("CTL_OpenCVTAction=Communications") -public final class OpenCommVisualizationToolAction extends CallableSystemAction { +public final class OpenCommVisualizationToolAction extends CallableSystemAction { private static final long serialVersionUID = 1L; - PropertyChangeListener pcl; + private final PropertyChangeListener pcl; private final JButton toolbarButton = new JButton(getName(), new ImageIcon(getClass().getResource("images/emblem-web24.png"))); //NON-NLS diff --git a/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java b/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java index 70d70b5325..31f5871b81 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/RelationshipNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2017 Basis Technology Corp. + * Copyright 2017-18 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -127,7 +127,7 @@ public class RelationshipNode extends BlackboardArtifactNode { * @return The display string, or an empty string if there is no such * attribute or an an error. */ - static String getAttributeDisplayString(final BlackboardArtifact artifact, final ATTRIBUTE_TYPE attributeType) { + private static String getAttributeDisplayString(final BlackboardArtifact artifact, final ATTRIBUTE_TYPE attributeType) { try { BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.fromID(attributeType.getTypeID()))); if (attribute == null) { diff --git a/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java b/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java index f75eb5a7ec..320e7d493b 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java +++ b/Core/src/org/sleuthkit/autopsy/communications/VisualizationPanel.java @@ -36,7 +36,6 @@ import java.util.Random; import java.util.Set; import java.util.logging.Level; import javax.swing.JPanel; -import org.apache.commons.lang3.StringUtils; import org.openide.explorer.ExplorerManager; import org.openide.explorer.ExplorerUtils; import org.openide.nodes.AbstractNode; @@ -47,14 +46,8 @@ import org.openide.util.Lookup; import org.openide.util.lookup.ProxyLookup; import org.sleuthkit.autopsy.casemodule.Case; import static org.sleuthkit.autopsy.casemodule.Case.Events.CURRENT_CASE; -import static org.sleuthkit.autopsy.communications.RelationshipNode.getAttributeDisplayString; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.AccountDeviceInstance; -import org.sleuthkit.datamodel.BlackboardArtifact; -import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_FROM; -import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_TO; -import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM; -import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO; import org.sleuthkit.datamodel.CommunicationsFilter; import org.sleuthkit.datamodel.CommunicationsManager; import org.sleuthkit.datamodel.TskCoreException; @@ -93,7 +86,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider private CommunicationsManager commsManager; - void setFilterProvider(FilterProvider filterProvider) { + protected void setFilterProvider(FilterProvider filterProvider) { this.filterProvider = filterProvider; } private FilterProvider filterProvider; @@ -148,66 +141,6 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider return proxyLookup; } - private void addEdge(mxCell pinnedAccountVertex, mxCell relatedAccountVertex) { - - Object[] edgesBetween = graph.getEdgesBetween(pinnedAccountVertex, relatedAccountVertex); - - if (edgesBetween.length == 0) { - final String edgeName = pinnedAccountVertex.getId() + " <-> " + relatedAccountVertex.getId(); - mxCell edge = (mxCell) graph.insertEdge(graph.getDefaultParent(), edgeName, 1d, pinnedAccountVertex, relatedAccountVertex); - } else if (edgesBetween.length == 1) { - final mxCell edge = (mxCell) edgesBetween[0]; - edge.setValue(1d + (double) edge.getValue()); - edge.setStyle("strokeWidth=" + Math.log((double) edge.getValue())); - } - } - - @Deprecated - private void addEdge(BlackboardArtifact artifact) throws TskCoreException { - BlackboardArtifact.ARTIFACT_TYPE artfType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); - if (null != artfType) { - - String from = null; - String[] tos = new String[0]; - - //Consider refactoring this to reduce boilerplate - switch (artfType) { - case TSK_EMAIL_MSG: - from = StringUtils.strip(getAttributeDisplayString(artifact, TSK_EMAIL_FROM), " \t\n;"); - tos = StringUtils.strip(getAttributeDisplayString(artifact, TSK_EMAIL_TO), " \t\n;").split(";"); - break; - case TSK_MESSAGE: - from = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM); - tos = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO).split(";"); - break; - case TSK_CALLLOG: - from = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM); - tos = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO).split(";"); - break; - default: - break; - } - for (String to : tos) { - if (StringUtils.isNotBlank(from) && StringUtils.isNotBlank(to)) { - - mxCell fromV = getOrCreateVertex(from, 10); - mxCell toV = getOrCreateVertex(to, 10); - - Object[] edgesBetween = graph.getEdgesBetween(fromV, toV); - - if (edgesBetween.length == 0) { - final String edgeName = from + "->" + to; - mxCell edge = (mxCell) graph.insertEdge(graph.getDefaultParent(), edgeName, 1d, fromV, toV); - } else if (edgesBetween.length == 1) { - final mxCell edge = (mxCell) edgesBetween[0]; - edge.setValue(1d + (double) edge.getValue()); - edge.setStyle("strokeWidth=" + Math.log((double) edge.getValue())); - } - } - } - } - } - @Subscribe public void pinAccounts(PinAccountEvent pinEvent) { @@ -265,22 +198,18 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider return vertex; } - @Deprecated - private mxCell getOrCreateVertex(String name, long size) { - mxCell vertex = nodeMap.get(name); - if (vertex == null) { - vertex = (mxCell) graph.insertVertex( - graph.getDefaultParent(), - name, - name, - new Random().nextInt(200), - new Random().nextInt(200), - size, - size); - graph.getView().getState(vertex, true).setLabel(name); - nodeMap.put(name, vertex); + private void addEdge(mxCell pinnedAccountVertex, mxCell relatedAccountVertex) { + + Object[] edgesBetween = graph.getEdgesBetween(pinnedAccountVertex, relatedAccountVertex); + + if (edgesBetween.length == 0) { + final String edgeName = pinnedAccountVertex.getId() + " <-> " + relatedAccountVertex.getId(); + graph.insertEdge(graph.getDefaultParent(), edgeName, 1d, pinnedAccountVertex, relatedAccountVertex); + } else if (edgesBetween.length == 1) { + final mxCell edge = (mxCell) edgesBetween[0]; + edge.setValue(1d + (double) edge.getValue()); + edge.setStyle("strokeWidth=" + Math.log((double) edge.getValue())); } - return vertex; } @Override @@ -399,15 +328,15 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider private javax.swing.JSplitPane splitPane; // End of variables declaration//GEN-END:variables - static class SimpleParentNode extends AbstractNode { + private static class SimpleParentNode extends AbstractNode { - static SimpleParentNode createFromChildNodes(Node... nodes) { + private static SimpleParentNode createFromChildNodes(Node... nodes) { Children.Array array = new Children.Array(); array.add(nodes); return new SimpleParentNode(array); } - public SimpleParentNode(Children children) { + private SimpleParentNode(Children children) { super(children); } }