Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
SummaryPanelWorker.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2020 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obt ain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.communications.relationships;
20 
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;
34 import org.sleuthkit.datamodel.Account;
35 import org.sleuthkit.datamodel.AccountFileInstance;
36 import org.sleuthkit.datamodel.InvalidAccountIDException;
37 
41 class SummaryPanelWorker extends SwingWorker<SummaryPanelWorker.SummaryWorkerResults, Void> {
42 
43  private final static Logger logger = Logger.getLogger(SummaryPanelWorker.class.getName());
44 
45  private final Account account;
46  private final SelectionInfo selectionInfo;
47 
48  // Construct a instance
49  SummaryPanelWorker(SelectionInfo selectionInfo, Account account) {
50  this.account = account;
51  this.selectionInfo = selectionInfo;
52  }
53 
59  Account getAccount() {
60  return account;
61  }
62 
63  @Override
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());
71  }
72  }
73 
74  List<Persona> personaList = new ArrayList<>();
75  if (CentralRepository.isEnabled()) {
76  Collection<PersonaAccount> personaAccountList = PersonaAccount.getPersonaAccountsForAccount(account);
77  PersonaAccount.getPersonaAccountsForAccount(account);
78 
79  for (PersonaAccount pAccount : personaAccountList) {
80  personaList.add(pAccount.getPersona());
81  }
82 
83  Optional<CentralRepoAccount.CentralRepoAccountType> optCrAccountType = CentralRepository.getInstance().getAccountTypeByName(account.getAccountType().getTypeName());
84  if (optCrAccountType.isPresent()) {
85  try {
86  crAccount = CentralRepository.getInstance().getAccount(optCrAccountType.get(), account.getTypeSpecificID());
87  } catch (InvalidAccountIDException unused) {
88  // This was probably caused to a phone number not making
89  // threw the normalization.
90  logger.log(Level.WARNING, String.format("Exception thrown from CR getAccount for account %s (%d)", account.getTypeSpecificID(), account.getAccountID()));
91  }
92  }
93  }
94 
95  return new SummaryWorkerResults(stringList, personaList, crAccount, new AccountSummary(account, selectionInfo.getArtifacts()));
96  }
97 
102  final static class SummaryWorkerResults {
103 
104  private final List<String> accountFileInstancePaths;
105  private final List<Persona> personaList;
106  private final CentralRepoAccount centralRepoAccount;
107  private final AccountSummary accountSummary;
108 
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;
123  }
124 
131  List<String> getPaths() {
132  return accountFileInstancePaths;
133  }
134 
142  List<Persona> getPersonaList() {
143  return personaList;
144  }
145 
152  CentralRepoAccount getCRAccount() {
153  return centralRepoAccount;
154  }
155 
156  AccountSummary getAccountSummary() {
157  return accountSummary;
158  }
159  }
160 
161 }

Copyright © 2012-2022 Basis Technology. Generated on: Tue Oct 4 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.