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.Optional;
25 import java.util.logging.Level;
26 import javax.swing.SwingWorker;
36 import org.
sleuthkit.datamodel.InvalidAccountIDException;
41 class SummaryPanelWorker
extends SwingWorker<SummaryPanelWorker.SummaryWorkerResults, Void> {
43 private final static Logger logger = Logger.getLogger(SummaryPanelWorker.class.getName());
45 private final Account account;
48 SummaryPanelWorker(Account account) {
49 this.account = account;
57 Account getAccount() {
62 protected SummaryWorkerResults doInBackground() throws Exception {
63 CentralRepoAccount crAccount = null;
64 List<String> stringList =
new ArrayList<>();
65 List<AccountFileInstance> accountFileInstanceList = Case.getCurrentCase().getSleuthkitCase().getCommunicationsManager().getAccountFileInstances(account);
66 if (accountFileInstanceList != null) {
67 for (AccountFileInstance instance : accountFileInstanceList) {
68 stringList.add(instance.getFile().getUniquePath());
72 List<Persona> personaList =
new ArrayList<>();
73 if (CentralRepository.isEnabled()) {
74 Collection<PersonaAccount> personaAccountList = PersonaAccount.getPersonaAccountsForAccount(account);
75 PersonaAccount.getPersonaAccountsForAccount(account);
77 for (PersonaAccount pAccount : personaAccountList) {
78 personaList.add(pAccount.getPersona());
81 Optional<CentralRepoAccount.CentralRepoAccountType> optCrAccountType = CentralRepository.getInstance().getAccountTypeByName(account.getAccountType().getTypeName());
82 if (optCrAccountType.isPresent()) {
84 crAccount = CentralRepository.getInstance().getAccount(optCrAccountType.get(), account.getTypeSpecificID());
85 }
catch (InvalidAccountIDException unused) {
88 logger.log(Level.WARNING, String.format(
"Exception thrown from CR getAccount for account %s (%d)", account.getTypeSpecificID(), account.getAccountID()));
93 return new SummaryWorkerResults(stringList, personaList, crAccount);
100 final static class SummaryWorkerResults {
102 private final List<String> accountFileInstancePaths;
103 private final List<Persona> personaList;
104 private final CentralRepoAccount centralRepoAccount;
115 SummaryWorkerResults(List<String> accountFileInstancePaths, List<Persona> personaList, CentralRepoAccount centralRepoAccount) {
116 this.accountFileInstancePaths = accountFileInstancePaths;
117 this.personaList = personaList;
118 this.centralRepoAccount = centralRepoAccount;
127 List<String> getPaths() {
128 return accountFileInstancePaths;
138 List<Persona> getPersonaList() {
148 CentralRepoAccount getCRAccount() {
149 return centralRepoAccount;