Autopsy  4.16.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
RelationshipsNodeUtilities.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  */
19 
20 package org.sleuthkit.autopsy.communications.relationships;
21 
22 import java.util.TimeZone;
23 import java.util.logging.Level;
26 import org.sleuthkit.datamodel.BlackboardArtifact;
27 import org.sleuthkit.datamodel.BlackboardAttribute;
28 import static org.sleuthkit.datamodel.BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME;
29 import org.sleuthkit.datamodel.TimeUtilities;
30 import org.sleuthkit.datamodel.TskCoreException;
31 
36 final class RelationshipsNodeUtilities {
37 
38  private static final Logger logger = Logger.getLogger(RelationshipsNodeUtilities.class.getName());
39 
40  // Here to make codacy happy
41  private RelationshipsNodeUtilities(){
42  }
43 
55  static String getAttributeDisplayString(final BlackboardArtifact artifact, final BlackboardAttribute.ATTRIBUTE_TYPE attributeType) {
56  try {
57  BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.fromID(attributeType.getTypeID())));
58  if (attribute == null) {
59  return "";
60  } else if (attributeType.getValueType() == DATETIME) {
61  return TimeUtilities.epochToTime(attribute.getValueLong(),
62  TimeZone.getTimeZone(Utils.getUserPreferredZoneId()));
63  } else {
64  return attribute.getDisplayString();
65  }
66  } catch (TskCoreException tskCoreException) {
67  logger.log(Level.WARNING, "Error getting attribute value.", tskCoreException); //NON-NLS
68  return "";
69  }
70  }
71 
72 }

Copyright © 2012-2020 Basis Technology. Generated on: Tue Sep 22 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.