19 package org.sleuthkit.autopsy.communications.relationships;
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.List;
24 import java.util.logging.Level;
25 import javax.swing.SwingWorker;
34 import org.
sleuthkit.datamodel.InvalidAccountIDException;
39 class SummaryPanelWorker
extends SwingWorker<SummaryPanelWorker.SummaryWorkerResults, Void> {
41 private final static Logger logger = Logger.getLogger(SummaryPanelWorker.class.getName());
43 private final Account account;
46 SummaryPanelWorker(Account account) {
47 this.account = account;
55 Account getAccount() {
60 protected SummaryWorkerResults doInBackground() throws Exception {
61 CentralRepoAccount crAccount = null;
62 List<String> stringList =
new ArrayList<>();
63 List<AccountFileInstance> accountFileInstanceList = Case.getCurrentCase().getSleuthkitCase().getCommunicationsManager().getAccountFileInstances(account);
64 for (AccountFileInstance instance : accountFileInstanceList) {
65 stringList.add(instance.getFile().getUniquePath());
68 List<Persona> personaList =
new ArrayList<>();
69 if (CentralRepository.isEnabled()) {
70 Collection<PersonaAccount> personaAccountList = PersonaAccount.getPersonaAccountsForAccount(account);
71 PersonaAccount.getPersonaAccountsForAccount(account);
73 for (PersonaAccount pAccount : personaAccountList) {
74 personaList.add(pAccount.getPersona());
78 crAccount = CentralRepository.getInstance().getAccount(CentralRepository.getInstance().getAccountTypeByName(account.getAccountType().getTypeName()), account.getTypeSpecificID());
79 }
catch (InvalidAccountIDException unused) {
82 logger.log(Level.WARNING, String.format(
"Exception thrown from CR getAccount for account %s (%d)", account.getTypeSpecificID(), account.getAccountID()));
86 return new SummaryWorkerResults(stringList, personaList, crAccount);
93 final static class SummaryWorkerResults {
95 private final List<String> accountFileInstancePaths;
96 private final List<Persona> personaList;
97 private final CentralRepoAccount centralRepoAccount;
108 SummaryWorkerResults(List<String> accountFileInstancePaths, List<Persona> personaList, CentralRepoAccount centralRepoAccount) {
109 this.accountFileInstancePaths = accountFileInstancePaths;
110 this.personaList = personaList;
111 this.centralRepoAccount = centralRepoAccount;
120 List<String> getPaths() {
121 return accountFileInstancePaths;
131 List<Persona> getPersonaList() {
141 CentralRepoAccount getCRAccount() {
142 return centralRepoAccount;