19 package org.sleuthkit.autopsy.communications;
21 import java.util.ArrayList;
22 import java.util.List;
23 import java.util.logging.Level;
24 import org.openide.nodes.ChildFactory;
25 import org.openide.nodes.Node;
38 final class AccountDeviceInstanceNodeFactory
extends ChildFactory<AccountDeviceInstanceKey> {
40 private static final Logger logger = Logger.getLogger(AccountDeviceInstanceNodeFactory.class.getName());
42 private final CommunicationsManager commsManager;
43 private final CommunicationsFilter commsFilter;
45 AccountDeviceInstanceNodeFactory(CommunicationsManager commsManager, CommunicationsFilter commsFilter) {
46 this.commsManager = commsManager;
47 this.commsFilter = commsFilter;
51 protected boolean createKeys(List<AccountDeviceInstanceKey> list) {
52 List<AccountDeviceInstanceKey> accountDeviceInstanceKeys =
new ArrayList<>();
54 final List<AccountDeviceInstance> accountDeviceInstancesWithRelationships =
55 commsManager.getAccountDeviceInstancesWithRelationships(commsFilter);
56 for (AccountDeviceInstance accountDeviceInstance : accountDeviceInstancesWithRelationships) {
57 long communicationsCount = commsManager.getRelationshipSourcesCount(accountDeviceInstance, commsFilter);
58 accountDeviceInstanceKeys.add(
new AccountDeviceInstanceKey(accountDeviceInstance, commsFilter, communicationsCount));
61 }
catch (TskCoreException tskCoreException) {
62 logger.log(Level.SEVERE,
"Error getting filtered account device instances", tskCoreException);
64 list.addAll(accountDeviceInstanceKeys);
70 protected Node createNodeForKey(AccountDeviceInstanceKey key) {
71 return new AccountDeviceInstanceNode(key, commsManager);