19 package org.sleuthkit.autopsy.communications.relationships;
21 import java.util.List;
23 import java.util.logging.Level;
24 import org.openide.nodes.AbstractNode;
25 import org.openide.nodes.ChildFactory;
26 import org.openide.nodes.Children;
27 import org.openide.nodes.Node;
41 final class AccountSourceContentChildNodeFactory
extends ChildFactory<Content> {
43 private static final Logger logger = Logger.getLogger(AccountSourceContentChildNodeFactory.class.getName());
45 private final Set<Account> accounts;
47 AccountSourceContentChildNodeFactory(Set<Account> accounts) {
48 this.accounts = accounts;
52 protected boolean createKeys(List<Content> list) {
53 if (accounts == null || accounts.isEmpty()) {
57 CommunicationsManager communicationManager;
59 communicationManager = Case.getCurrentCaseThrows().getSleuthkitCase().getCommunicationsManager();
60 }
catch (NoCurrentCaseException | TskCoreException ex) {
61 logger.log(Level.WARNING,
"Failed to get communications manager from case.", ex);
65 accounts.forEach((account) -> {
67 List<AccountFileInstance> accountFileInstanceList = communicationManager.getAccountFileInstances(account);
69 for (AccountFileInstance fileInstance : accountFileInstanceList) {
70 list.add(fileInstance.getFile());
73 }
catch (TskCoreException ex) {
74 logger.log(Level.WARNING, String.format(
"Failed to getAccountFileInstances for account: %d", account.getAccountID()), ex);
82 protected Node createNodeForKey(Content content) {
83 return new ContentNode(content);
89 final class ContentNode
extends AbstractNode {
91 private final Content content;
93 ContentNode(Content content) {
95 this.content = content;
98 setDisplayName(content.getUniquePath());
99 }
catch (TskCoreException ex) {
100 logger.log(Level.WARNING, String.format(
"Unable to getUniquePath for Content: %d", content.getId()), ex);
101 setDisplayName(content.getName());
104 setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/file-icon.png");