Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
ContactsChildNodeFactory.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2019 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 */
19package org.sleuthkit.autopsy.communications.relationships;
20
21import java.util.List;
22import java.util.Set;
23import java.util.logging.Level;
24import org.openide.nodes.ChildFactory;
25import org.openide.nodes.Node;
26import org.sleuthkit.autopsy.casemodule.Case;
27import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
28import org.sleuthkit.autopsy.coreutils.Logger;
29import org.sleuthkit.datamodel.BlackboardArtifact;
30import static org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT;
31import org.sleuthkit.datamodel.CommunicationsManager;
32import org.sleuthkit.datamodel.Content;
33import org.sleuthkit.datamodel.TskCoreException;
34
38final class ContactsChildNodeFactory extends ChildFactory<BlackboardArtifact> {
39
40 private static final Logger logger = Logger.getLogger(ContactsChildNodeFactory.class.getName());
41
42 private SelectionInfo selectionInfo;
43
50 ContactsChildNodeFactory(SelectionInfo selectionInfo) {
51 this.selectionInfo = selectionInfo;
52 }
53
60 public void refresh(SelectionInfo selectionInfo) {
61 this.selectionInfo = selectionInfo;
62 refresh(true);
63 }
64
73 @Override
74 protected boolean createKeys(List<BlackboardArtifact> list) {
75
76 if (selectionInfo == null) {
77 return true;
78 }
79
80 final Set<Content> relationshipSources;
81 try {
82 relationshipSources = selectionInfo.getRelationshipSources();
83 } catch (TskCoreException ex) {
84 logger.log(Level.SEVERE, "Failed to load relationship sources.", ex); //NON-NLS
85 return false;
86 }
87
88 relationshipSources.stream().filter((content) -> (content instanceof BlackboardArtifact)).forEachOrdered((content) -> {
89
90 BlackboardArtifact bba = (BlackboardArtifact) content;
91 BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(bba.getArtifactTypeID());
92
93 if (fromID == TSK_CONTACT) {
94 list.add(bba);
95 }
96 });
97
98 return true;
99 }
100
101 @Override
102 protected Node createNodeForKey(BlackboardArtifact key) {
103 return new ContactNode(key);
104 }
105}

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.