Autopsy  4.7.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
AccountDetailsNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2017 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 obtain 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;
20 
21 import java.util.List;
22 import java.util.Set;
23 import java.util.logging.Level;
24 import org.openide.nodes.AbstractNode;
25 import org.openide.nodes.ChildFactory;
26 import org.openide.nodes.Children;
27 import org.openide.nodes.Node;
28 import org.python.google.common.collect.Iterables;
30 import org.sleuthkit.datamodel.AccountDeviceInstance;
31 import org.sleuthkit.datamodel.BlackboardArtifact;
32 import org.sleuthkit.datamodel.CommunicationsFilter;
33 import org.sleuthkit.datamodel.CommunicationsManager;
34 import org.sleuthkit.datamodel.Content;
35 import org.sleuthkit.datamodel.TskCoreException;
36 
42 final class AccountDetailsNode extends AbstractNode {
43 
44  private final static Logger logger = Logger.getLogger(AccountDetailsNode.class.getName());
45 
46  AccountDetailsNode(Set<AccountDeviceInstance> accountDeviceInstances, CommunicationsFilter filter, CommunicationsManager commsManager) {
47  super(Children.create(new AccountRelationshipChildren(accountDeviceInstances, commsManager, filter), true));
48  String displayName = (accountDeviceInstances.size() == 1)
49  ? Iterables.getOnlyElement(accountDeviceInstances).getAccount().getTypeSpecificID()
50  : accountDeviceInstances.size() + " accounts";
51  setDisplayName(displayName);
52  }
53 
57  private static class AccountRelationshipChildren extends ChildFactory<Content> {
58 
59  private final Set<AccountDeviceInstance> accountDeviceInstances;
60  private final CommunicationsManager commsManager;
61  private final CommunicationsFilter filter;
62 
63  private AccountRelationshipChildren(Set<AccountDeviceInstance> accountDeviceInstances, CommunicationsManager commsManager, CommunicationsFilter filter) {
64  this.accountDeviceInstances = accountDeviceInstances;
65  this.commsManager = commsManager;
66  this.filter = filter;
67  }
68 
69  @Override
70  protected boolean createKeys(List<Content> list) {
71  try {
72  list.addAll(commsManager.getRelationshipSources(accountDeviceInstances, filter));
73  } catch (TskCoreException ex) {
74  logger.log(Level.SEVERE, "Error getting communications", ex);
75  }
76  return true;
77  }
78 
79  @Override
80  protected Node createNodeForKey(Content t) {
81  if (t instanceof BlackboardArtifact) {
82  return new RelationshipNode((BlackboardArtifact) t);
83  } else {
84  throw new UnsupportedOperationException("Cannot create a RelationshipNode for non BlackboardArtifact content.");
85  }
86  }
87  }
88 }
AccountRelationshipChildren(Set< AccountDeviceInstance > accountDeviceInstances, CommunicationsManager commsManager, CommunicationsFilter filter)

Copyright © 2012-2016 Basis Technology. Generated on: Mon Jun 18 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.