19 package org.sleuthkit.autopsy.communications.relationships;
21 import java.beans.PropertyChangeEvent;
22 import java.util.List;
23 import java.util.concurrent.ExecutionException;
24 import java.util.logging.Level;
25 import javax.swing.SwingWorker;
26 import org.openide.explorer.ExplorerManager;
27 import org.openide.nodes.Node;
28 import org.openide.util.Exceptions;
36 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT;
50 final class MessageDataContent
extends MessageArtifactViewer implements DataContent, ExplorerManager.Provider {
52 private static final Logger LOGGER = Logger.getLogger(MessageDataContent.class.getName());
54 private static final long serialVersionUID = 1L;
55 final private ExplorerManager explorerManager =
new ExplorerManager();
57 private ArtifactFetcher worker;
60 public void propertyChange(
final PropertyChangeEvent evt) {
61 throw new UnsupportedOperationException(
"Not supported yet.");
65 public ExplorerManager getExplorerManager() {
66 return explorerManager;
70 public void setNode(Node node) {
81 worker =
new ArtifactFetcher(node);
97 private BlackboardArtifact getNodeArtifact(Node node) {
98 BlackboardArtifact nodeArtifact = node.getLookup().lookup(BlackboardArtifact.class);
100 if (nodeArtifact == null) {
102 SleuthkitCase tskCase = Case.getCurrentCaseThrows().getSleuthkitCase();
103 AbstractFile file = node.getLookup().lookup(AbstractFile.class);
105 List<BlackboardArtifact> artifactsList = tskCase.getBlackboardArtifacts(TSK_ASSOCIATED_OBJECT, file.getId());
107 for (BlackboardArtifact fileArtifact : artifactsList) {
108 BlackboardAttribute associatedArtifactAttribute = fileArtifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
109 if (associatedArtifactAttribute != null) {
110 BlackboardArtifact associatedArtifact = fileArtifact.getSleuthkitCase().getBlackboardArtifact(associatedArtifactAttribute.getValueLong());
112 nodeArtifact = associatedArtifact;
117 }
catch (NoCurrentCaseException | TskCoreException ex) {
118 LOGGER.log(Level.SEVERE,
"Failed to get file for selected node.", ex);
134 return getNodeArtifact(node);
145 }
catch (InterruptedException | ExecutionException ex) {
146 LOGGER.log(Level.SEVERE,
"Failed to get node for artifact.", ex);
BlackboardArtifact doInBackground()
static boolean isMessageArtifact(BlackboardArtifact nodeArtifact)