19 package org.sleuthkit.autopsy.communications.relationships;
21 import java.util.Comparator;
22 import java.util.List;
24 import java.util.logging.Level;
25 import org.openide.nodes.ChildFactory;
26 import org.openide.nodes.Node;
70 protected boolean createKeys(List<BlackboardArtifact> list) {
72 if(selectionInfo == null) {
76 final Set<Content> relationshipSources;
78 relationshipSources = selectionInfo.getRelationshipSources();
79 }
catch (TskCoreException ex) {
80 logger.log(Level.SEVERE,
"Failed to load relationship sources.", ex);
85 for(Content content: relationshipSources) {
86 if( !(content instanceof BlackboardArtifact)){
90 BlackboardArtifact bba = (BlackboardArtifact) content;
91 BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(bba.getArtifactTypeID());
93 if (fromID != BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG
94 && fromID != BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE) {
102 String artifactThreadID = MessageNode.UNTHREADED_ID;
104 BlackboardAttribute attribute = bba.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_THREAD_ID));
106 if(attribute != null) {
107 artifactThreadID = attribute.getValueString();
110 if(threadIDs == null || threadIDs.contains(artifactThreadID)) {
115 }
catch (TskCoreException ex) {
116 logger.log(Level.SEVERE,
"Failed to load artifacts for relationship sources.", ex);
119 list.sort(
new DateComparator());
126 return new MessageNode(key, null, null);
134 class DateComparator
implements Comparator<BlackboardArtifact> {
136 public int compare(BlackboardArtifact bba1, BlackboardArtifact bba2) {
138 BlackboardAttribute attribute1 = null;
139 BlackboardAttribute attribute2 = null;
143 long dateTime1 = Long.MAX_VALUE;
144 long dateTime2 = Long.MAX_VALUE;
147 BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(bba1.getArtifactTypeID());
148 if (fromID != null) {
152 attribute1 = bba1.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_SENT));
155 attribute1 = bba1.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME));
158 attribute1 = bba1.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START));
164 }
catch (TskCoreException ex) {
165 logger.log(Level.WARNING, String.format(
"Unable to compare attributes for artifact %d", bba1.getArtifactID()), ex);
171 BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(bba2.getArtifactTypeID());
172 if (fromID != null) {
176 attribute2 = bba2.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_SENT));
179 attribute2 = bba2.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME));
182 attribute2 = bba2.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START));
188 }
catch (TskCoreException ex) {
189 logger.log(Level.WARNING, String.format(
"Unable to compare attributes for artifact %d", bba2.getArtifactID()), ex);
194 if (attribute1 != null) {
195 dateTime1 = attribute1.getValueLong();
198 if (attribute2 != null) {
199 dateTime2 = attribute2.getValueLong();
202 return Long.compare(dateTime1, dateTime2);
boolean createKeys(List< BlackboardArtifact > list)
Node createNodeForKey(BlackboardArtifact key)
SelectionInfo selectionInfo
static final Logger logger
void refresh(SelectionInfo selectionInfo, List< String > threadIDs)
synchronized static Logger getLogger(String name)