19 package org.sleuthkit.autopsy.communications.relationships;
21 import java.util.logging.Level;
22 import org.openide.nodes.Sheet;
30 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG;
32 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START;
33 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END;
34 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM;
35 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO;
36 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION;
37 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER;
43 final class CallLogNode
extends BlackboardArtifactNode {
45 private static final Logger logger = Logger.getLogger(CallLogNode.class.getName());
47 final static String DURATION_PROP =
"duration";
49 CallLogNode(BlackboardArtifact artifact, String deviceID) {
50 super(artifact, Utils.getIconFilePath(Account.Type.PHONE));
51 setDisplayName(deviceID);
55 protected Sheet createSheet() {
56 Sheet sheet = super.createSheet();
57 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
58 if (sheetSet == null) {
59 sheetSet = Sheet.createPropertiesSet();
65 BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID());
66 if (null != fromID && fromID != TSK_CALLLOG) {
70 String phoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM);
71 if(phoneNumber == null || phoneNumber.isEmpty()) {
72 phoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO);
77 duration = getCallDuration(artifact);
78 }
catch(TskCoreException ex) {
79 logger.log(Level.WARNING, String.format(
"Unable to get calllog duration for artifact: %d", artifact.getArtifactID()), ex);
82 sheetSet.put(createNode(TSK_DATETIME_START, artifact));
83 sheetSet.put(createNode(TSK_DIRECTION, artifact));
84 sheetSet.put(
new NodeProperty<>(TSK_PHONE_NUMBER.getLabel(), TSK_PHONE_NUMBER.getDisplayName(),
"", phoneNumber));
86 sheetSet.put(
new NodeProperty<>(
"duration",
"Duration",
"", Long.toString(duration)));
92 NodeProperty<?> createNode(BlackboardAttribute.ATTRIBUTE_TYPE type, BlackboardArtifact artifact) {
93 return new NodeProperty<>(type.getLabel(), type.getDisplayName(), type.getDisplayName(), getAttributeDisplayString(artifact, type));
96 long getCallDuration(BlackboardArtifact artifact)
throws TskCoreException {
97 BlackboardAttribute startAttribute = artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.fromID(TSK_DATETIME_START.getTypeID())));
98 BlackboardAttribute endAttribute = artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.fromID(TSK_DATETIME_END.getTypeID())));
100 if(startAttribute == null || endAttribute == null) {
104 return endAttribute.getValueLong() - startAttribute.getValueLong();
114 public String getSourceName() {
115 return getDisplayName();
BlackboardArtifact getArtifact()