mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
fix Codacy issues
This commit is contained in:
parent
ac9f7c5b11
commit
15d031d669
@ -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) {
|
||||
|
@ -55,7 +55,7 @@ final class AccountDeviceInstanceNodeFactory extends ChildFactory<AccountDeviceI
|
||||
for (AccountDeviceInstance accountDeviceInstance : accountDeviceInstancesWithRelationships) {
|
||||
long communicationsCount = commsManager.getRelationshipSourcesCount(accountDeviceInstance, commsFilter);
|
||||
accountDeviceInstanceKeys.add(new AccountDeviceInstanceKey(accountDeviceInstance, commsFilter, communicationsCount));
|
||||
};
|
||||
}
|
||||
} catch (TskCoreException tskCoreException) {
|
||||
logger.log(Level.SEVERE, "Error getting filtered account device instances", tskCoreException);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ import org.openide.util.lookup.ProxyLookup;
|
||||
* CVTTopComponent when this tab is active allowing for context sensitive
|
||||
* actions to work correctly.
|
||||
*/
|
||||
public class AccountsBrowser extends JPanel implements ExplorerManager.Provider, Lookup.Provider {
|
||||
public final class AccountsBrowser extends JPanel implements ExplorerManager.Provider, Lookup.Provider {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -70,7 +70,7 @@ public class AccountsBrowser extends JPanel implements ExplorerManager.Provider,
|
||||
|
||||
}
|
||||
|
||||
void init(ExplorerManager tableExplorerManager) {
|
||||
protected void init(ExplorerManager tableExplorerManager) {
|
||||
this.accountsTableEM = tableExplorerManager;
|
||||
tableExplorerManager.addPropertyChangeListener(evt -> {
|
||||
if (ExplorerManager.PROP_ROOT_CONTEXT.equals(evt.getPropertyName())) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2017 Basis Technology Corp.
|
||||
* Copyright 2017-18 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2017 Basis Technology Corp.
|
||||
* Copyright 2017-18 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user