mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge pull request #3184 from raman-bt/accounts_relationships
Updated the CommunicationsManager API usage for getCommunicationsCoun…
This commit is contained in:
commit
a0b27ae39d
@ -28,6 +28,7 @@ import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.datamodel.Account;
|
||||
import org.sleuthkit.datamodel.AccountDeviceInstance;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.CommunicationsFilter;
|
||||
import org.sleuthkit.datamodel.CommunicationsManager;
|
||||
@ -38,8 +39,8 @@ class AccountDetailsNode extends AbstractNode {
|
||||
private final static Logger logger = Logger.getLogger(AccountDetailsNode.class.getName());
|
||||
private final CommunicationsFilter filter; //TODO: Use this
|
||||
|
||||
AccountDetailsNode(Set<Account> accounts,CommunicationsFilter filter, CommunicationsManager commsManager) {
|
||||
super(new AccountRelationshipChildren(accounts, commsManager, filter));
|
||||
AccountDetailsNode(Set<AccountDeviceInstance> accountDeviceInstances, CommunicationsFilter filter, CommunicationsManager commsManager) {
|
||||
super(new AccountRelationshipChildren(accountDeviceInstances, commsManager, filter));
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
@ -48,12 +49,12 @@ class AccountDetailsNode extends AbstractNode {
|
||||
*/
|
||||
private static class AccountRelationshipChildren extends Children.Keys<BlackboardArtifact> {
|
||||
|
||||
private final Set<Account> accounts;
|
||||
private final Set<AccountDeviceInstance> accountDeviceInstances;
|
||||
private final CommunicationsManager commsManager;
|
||||
private final CommunicationsFilter filter;//TODO: Use this
|
||||
private final CommunicationsFilter filter;
|
||||
|
||||
private AccountRelationshipChildren(Set<Account> accounts, CommunicationsManager commsManager, CommunicationsFilter filter) {
|
||||
this.accounts = accounts;
|
||||
private AccountRelationshipChildren(Set<AccountDeviceInstance> accountDeviceInstances, CommunicationsManager commsManager, CommunicationsFilter filter) {
|
||||
this.accountDeviceInstances = accountDeviceInstances;
|
||||
this.commsManager = commsManager;
|
||||
this.filter = filter;
|
||||
}
|
||||
@ -66,22 +67,15 @@ class AccountDetailsNode extends AbstractNode {
|
||||
@Override
|
||||
protected void addNotify() {
|
||||
Set<BlackboardArtifact> keys = new HashSet<>();
|
||||
for (Account account : accounts) {
|
||||
List<Account> accountsWithRelationship = new ArrayList<>();
|
||||
try {
|
||||
accountsWithRelationship.addAll(commsManager.getAccountsWithRelationship(account)); //TODO: Use filter here
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.WARNING, "Error loading with relationships to " + account, ex);
|
||||
}
|
||||
|
||||
accountsWithRelationship.forEach(otherAcount -> {
|
||||
try {
|
||||
keys.addAll(commsManager.getRelationships(account, otherAcount)); //TODO:Use filter here
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.WARNING, "Error loading relationships between " + account + " and " + otherAcount, ex);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
Set<BlackboardArtifact> communications = commsManager.getCommunications(accountDeviceInstances, filter);
|
||||
keys = new HashSet<>(communications);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
logger.log(Level.WARNING, "Error loading communications for accounts. ", ex);
|
||||
}
|
||||
|
||||
setKeys(keys);
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class AccountsRootChildren extends Children.Keys<AccountDeviceInstanceKey> {
|
||||
}
|
||||
long msgCount = 0;
|
||||
try {
|
||||
msgCount = commsManager.getRelationshipsCount(accountDeviceInstance.getAccount(), filter );
|
||||
msgCount = commsManager.getCommunicationsCount(accountDeviceInstance, filter );
|
||||
} catch (TskCoreException ex) {
|
||||
LOGGER.log(Level.WARNING, "Failed to get message count for account", ex); //NON-NLS
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ final public class FiltersPanel extends javax.swing.JPanel {
|
||||
final CommunicationsManager commsManager = Case.getCurrentCase().getSleuthkitCase().getCommunicationsManager();
|
||||
|
||||
List<AccountDeviceInstanceKey> accountDeviceInstanceKeys =
|
||||
commsManager.getAccountDeviceInstancesWithRelationships(commsFilter)
|
||||
commsManager.getAccountDeviceInstancesWithCommunications(commsFilter)
|
||||
.stream()
|
||||
.map(adi -> new AccountDeviceInstanceKey(adi, commsFilter))
|
||||
.collect(Collectors.toList());
|
||||
|
@ -31,6 +31,7 @@ import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.directorytree.DataResultFilterNode;
|
||||
import org.sleuthkit.datamodel.Account;
|
||||
import org.sleuthkit.datamodel.AccountDeviceInstance;
|
||||
import org.sleuthkit.datamodel.CommunicationsFilter;
|
||||
import org.sleuthkit.datamodel.CommunicationsManager;
|
||||
|
||||
@ -71,13 +72,13 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager
|
||||
messagesResultPanel.setNode(null);
|
||||
messagesResultPanel.setPath("");
|
||||
} else {
|
||||
Set<Account> accounts = new HashSet<>();
|
||||
Set<AccountDeviceInstance> accountDeviceInstances = new HashSet<>();
|
||||
CommunicationsFilter filter = null;
|
||||
CommunicationsManager commsManager = null;
|
||||
for (Node n : selectedNodes) {
|
||||
if (n instanceof AccountDeviceInstanceNode) {
|
||||
final AccountDeviceInstanceNode adiNode = (AccountDeviceInstanceNode) n;
|
||||
accounts.add(adiNode.getAccountDeviceInstance().getAccount());
|
||||
accountDeviceInstances.add(adiNode.getAccountDeviceInstance());
|
||||
if (commsManager == null) {
|
||||
commsManager = adiNode.getCommsManager();
|
||||
}
|
||||
@ -92,11 +93,11 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager
|
||||
logger.log(Level.WARNING, "Unexpected Node encountered: " + n.toString());
|
||||
}
|
||||
}
|
||||
messagesResultPanel.setNode(new TableFilterNode(new DataResultFilterNode(new AccountDetailsNode(accounts, filter, commsManager),internalExplorerManager), true));
|
||||
if (accounts.size() == 1) {
|
||||
messagesResultPanel.setPath(Iterables.getOnlyElement(accounts).getAccountUniqueID());
|
||||
messagesResultPanel.setNode(new TableFilterNode(new AccountDetailsNode(accountDeviceInstances, filter, commsManager), true));
|
||||
if (accountDeviceInstances.size() == 1) {
|
||||
messagesResultPanel.setPath(Iterables.getOnlyElement(accountDeviceInstances).getAccount().getAccountUniqueID());
|
||||
} else {
|
||||
messagesResultPanel.setPath(accounts.size() + " accounts");
|
||||
messagesResultPanel.setPath(accountDeviceInstances.size() + " accounts");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user