Only show full path for certain artifact nodes.

This commit is contained in:
Jeff Wallace 2013-11-11 13:44:56 -05:00
parent 4e9e354a45
commit eb82122a09

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.datamodel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -45,6 +46,15 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
private Content associated;
private List<NodeProperty> customProperties;
static final Logger logger = Logger.getLogger(BlackboardArtifactNode.class.getName());
/**
* Artifact types which should have the associated content's full unique path
* as a property.
*/
private static final Integer[] SHOW_UNIQUE_PATH = new Integer[] {
BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID(),
BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID(),
BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE.getTypeID(),
};
/**
* Construct blackboard artifact node from an artifact and using provided
@ -99,18 +109,6 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
"Source File",
NO_DESCR,
associated.getName()));
String sourcePath = "";
try {
sourcePath = associated.getUniquePath();
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get unique path from: " + associated.getName());
}
if (sourcePath.isEmpty() == false) {
ss.put(new NodeProperty("File Path", "File Path",
NO_DESCR, sourcePath));
}
for (Map.Entry<String, Object> entry : map.entrySet()) {
ss.put(new NodeProperty(entry.getKey(),
@ -125,6 +123,33 @@ public class BlackboardArtifactNode extends DisplayableItemNode {
ss.put(np);
}
}
final int artifactTypeId = artifact.getArtifactTypeID();
if (Arrays.asList(SHOW_UNIQUE_PATH).contains(artifactTypeId)) {
String sourcePath = "";
try {
sourcePath = associated.getUniquePath();
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get unique path from: " + associated.getName());
}
if (sourcePath.isEmpty() == false) {
ss.put(new NodeProperty("File Path", "File Path",
NO_DESCR, sourcePath));
}
} else {
String dataSource = "";
try {
dataSource = associated.getImage().getName();
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Failed to get image name from " + associated.getName());
}
if (dataSource.isEmpty() == false) {
ss.put(new NodeProperty("Data Source", "Data Source",
NO_DESCR, dataSource));
}
}
return s;
}