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;
46 private final SelectionInfo selectionInfo;
49 SummaryPanelWorker(SelectionInfo selectionInfo, Account account) {
50 this.account = account;
51 this.selectionInfo = selectionInfo;
59 Account getAccount() {
64 protected SummaryWorkerResults doInBackground() throws Exception {
65 CentralRepoAccount crAccount = null;
66 List<String> stringList =
new ArrayList<>();
67 List<AccountFileInstance> accountFileInstanceList = Case.getCurrentCase().getSleuthkitCase().getCommunicationsManager().getAccountFileInstances(account);
68 if (accountFileInstanceList != null) {
69 for (AccountFileInstance instance : accountFileInstanceList) {
70 stringList.add(instance.getFile().getUniquePath());
74 List<Persona> personaList =
new ArrayList<>();
75 if (CentralRepository.isEnabled()) {
76 Collection<PersonaAccount> personaAccountList = PersonaAccount.getPersonaAccountsForAccount(account);
77 PersonaAccount.getPersonaAccountsForAccount(account);
79 for (PersonaAccount pAccount : personaAccountList) {
80 personaList.add(pAccount.getPersona());
83 Optional<CentralRepoAccount.CentralRepoAccountType> optCrAccountType = CentralRepository.getInstance().getAccountTypeByName(account.getAccountType().getTypeName());
84 if (optCrAccountType.isPresent()) {
86 crAccount = CentralRepository.getInstance().getAccount(optCrAccountType.get(), account.getTypeSpecificID());
87 }
catch (InvalidAccountIDException unused) {
90 logger.log(Level.WARNING, String.format(
"Exception thrown from CR getAccount for account %s (%d)", account.getTypeSpecificID(), account.getAccountID()));
95 return new SummaryWorkerResults(stringList, personaList, crAccount,
new AccountSummary(account, selectionInfo.getArtifacts()));
102 final static class SummaryWorkerResults {
104 private final List<String> accountFileInstancePaths;
105 private final List<Persona> personaList;
106 private final CentralRepoAccount centralRepoAccount;
107 private final AccountSummary accountSummary;
118 SummaryWorkerResults(List<String> accountFileInstancePaths, List<Persona> personaList, CentralRepoAccount centralRepoAccount, AccountSummary accountSummary) {
119 this.accountFileInstancePaths = accountFileInstancePaths;
120 this.personaList = personaList;
121 this.centralRepoAccount = centralRepoAccount;
122 this.accountSummary = accountSummary;
131 List<String> getPaths() {
132 return accountFileInstancePaths;
142 List<Persona> getPersonaList() {
152 CentralRepoAccount getCRAccount() {
153 return centralRepoAccount;
156 AccountSummary getAccountSummary() {
157 return accountSummary;