Autopsy  4.18.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.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 
47  // Construct a instance
48  SummaryPanelWorker(Account account) {
49  this.account = account;
50  }
51 
57  Account getAccount() {
58  return account;
59  }
60 
61  @Override
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());
69  }
70  }
71 
72  List<Persona> personaList = new ArrayList<>();
73  if (CentralRepository.isEnabled()) {
74  Collection<PersonaAccount> personaAccountList = PersonaAccount.getPersonaAccountsForAccount(account);
75  PersonaAccount.getPersonaAccountsForAccount(account);
76 
77  for (PersonaAccount pAccount : personaAccountList) {
78  personaList.add(pAccount.getPersona());
79  }
80 
81  Optional<CentralRepoAccount.CentralRepoAccountType> optCrAccountType = CentralRepository.getInstance().getAccountTypeByName(account.getAccountType().getTypeName());
82  if (optCrAccountType.isPresent()) {
83  try {
84  crAccount = CentralRepository.getInstance().getAccount(optCrAccountType.get(), account.getTypeSpecificID());
85  } catch (InvalidAccountIDException unused) {
86  // This was probably caused to a phone number not making
87  // threw the normalization.
88  logger.log(Level.WARNING, String.format("Exception thrown from CR getAccount for account %s (%d)", account.getTypeSpecificID(), account.getAccountID()));
89  }
90  }
91  }
92 
93  return new SummaryWorkerResults(stringList, personaList, crAccount);
94  }
95 
100  final static class SummaryWorkerResults {
101 
102  private final List<String> accountFileInstancePaths;
103  private final List<Persona> personaList;
104  private final CentralRepoAccount centralRepoAccount;
105 
115  SummaryWorkerResults(List<String> accountFileInstancePaths, List<Persona> personaList, CentralRepoAccount centralRepoAccount) {
116  this.accountFileInstancePaths = accountFileInstancePaths;
117  this.personaList = personaList;
118  this.centralRepoAccount = centralRepoAccount;
119  }
120 
127  List<String> getPaths() {
128  return accountFileInstancePaths;
129  }
130 
138  List<Persona> getPersonaList() {
139  return personaList;
140  }
141 
148  CentralRepoAccount getCRAccount() {
149  return centralRepoAccount;
150  }
151  }
152 
153 }

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