19 package org.sleuthkit.autopsy.geolocation.datamodel;
21 import java.util.ArrayList;
22 import java.util.Collections;
23 import java.util.HashMap;
24 import java.util.HashSet;
25 import java.util.List;
45 final private AbstractFile
image;
56 static final BlackboardAttribute.ATTRIBUTE_TYPE[] ALREADY_HANDLED_ATTRIBUTES = {
57 BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME,
58 BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE,
59 BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE,
60 BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE,
61 BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME,
62 BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED,
63 BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START,
64 BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START,
65 BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END,
66 BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END,};
83 Waypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap,
GeoPath parentGeoPath)
throws GeoLocationDataException {
84 if (longitude == null || latitude == null) {
99 content = artifact.getSleuthkitCase().getContentById(artifact.getObjectID());
100 }
catch (TskCoreException ex) {
101 throw new GeoLocationDataException(String.format(
"Failed to get contend for artifact id (%d)", artifact.getId()), ex);
203 static Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> getAttributesFromArtifactAsMap(BlackboardArtifact artifact)
throws GeoLocationDataException {
204 Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap =
new HashMap<>();
206 List<BlackboardAttribute> attributeList = artifact.getAttributes();
207 for (BlackboardAttribute attribute : attributeList) {
209 BlackboardAttribute.ATTRIBUTE_TYPE type = BlackboardAttribute.ATTRIBUTE_TYPE.fromID(attribute.getAttributeType().getTypeID());
210 attributeMap.put(type, attribute);
211 }
catch(IllegalArgumentException ex) {
216 }
catch (TskCoreException ex) {
217 throw new GeoLocationDataException(
"Unable to get attributes from artifact", ex);
234 static List<Waypoint.Property> createGeolocationProperties(Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap)
throws GeoLocationDataException {
235 List<Waypoint.Property> list =
new ArrayList<>();
237 if(attributeMap != null) {
239 Set<BlackboardAttribute.ATTRIBUTE_TYPE> keys =
new HashSet<>(attributeMap.keySet());
241 for (BlackboardAttribute.ATTRIBUTE_TYPE type : ALREADY_HANDLED_ATTRIBUTES) {
245 for (BlackboardAttribute.ATTRIBUTE_TYPE type : keys) {
247 if (type.getValueType() == BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.JSON) {
250 String key = type.getDisplayName();
251 String value = attributeMap.get(type).getDisplayString();
253 list.add(
new Waypoint.Property(key, value));
279 Property(String displayName, String value) {
GeoPath getParentGeoPath()
List< Waypoint.Property > getOtherProperties()
final List< Waypoint.Property > propertiesList
final BlackboardArtifact artifact
BlackboardArtifact getArtifact()
final GeoPath parentGeoPath