Autopsy  4.17.0
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.logging.Level;
25 import javax.swing.SwingWorker;
32 import org.sleuthkit.datamodel.Account;
33 import org.sleuthkit.datamodel.AccountFileInstance;
34 import org.sleuthkit.datamodel.InvalidAccountIDException;
35 
39 class SummaryPanelWorker extends SwingWorker<SummaryPanelWorker.SummaryWorkerResults, Void> {
40 
41  private final static Logger logger = Logger.getLogger(SummaryPanelWorker.class.getName());
42 
43  private final Account account;
44 
45  // Construct a instance
46  SummaryPanelWorker(Account account) {
47  this.account = account;
48  }
49 
55  Account getAccount() {
56  return account;
57  }
58 
59  @Override
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());
66  }
67 
68  List<Persona> personaList = new ArrayList<>();
69  if (CentralRepository.isEnabled()) {
70  Collection<PersonaAccount> personaAccountList = PersonaAccount.getPersonaAccountsForAccount(account);
71  PersonaAccount.getPersonaAccountsForAccount(account);
72 
73  for (PersonaAccount pAccount : personaAccountList) {
74  personaList.add(pAccount.getPersona());
75  }
76 
77  try {
78  crAccount = CentralRepository.getInstance().getAccount(CentralRepository.getInstance().getAccountTypeByName(account.getAccountType().getTypeName()), account.getTypeSpecificID());
79  } catch (InvalidAccountIDException unused) {
80  // This was probably caused to a phone number not making
81  // threw the normalization.
82  logger.log(Level.WARNING, String.format("Exception thrown from CR getAccount for account %s (%d)", account.getTypeSpecificID(), account.getAccountID()));
83  }
84  }
85 
86  return new SummaryWorkerResults(stringList, personaList, crAccount);
87  }
88 
93  final static class SummaryWorkerResults {
94 
95  private final List<String> accountFileInstancePaths;
96  private final List<Persona> personaList;
97  private final CentralRepoAccount centralRepoAccount;
98 
108  SummaryWorkerResults(List<String> accountFileInstancePaths, List<Persona> personaList, CentralRepoAccount centralRepoAccount) {
109  this.accountFileInstancePaths = accountFileInstancePaths;
110  this.personaList = personaList;
111  this.centralRepoAccount = centralRepoAccount;
112  }
113 
120  List<String> getPaths() {
121  return accountFileInstancePaths;
122  }
123 
131  List<Persona> getPersonaList() {
132  return personaList;
133  }
134 
141  CentralRepoAccount getCRAccount() {
142  return centralRepoAccount;
143  }
144  }
145 
146 }

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