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 package org.sleuthkit.autopsy.geolocation.datamodel;
20
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;
26 import java.util.Map;
27 import java.util.Set;
32
38
44 final private AbstractFile
image;
47
48 // This list is not expected to change after construction. The
49 // constructor will take care of making an unmodifiable List
51
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,};
67
83 Waypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap,
Route route)
throws GeoLocationDataException {
84 if (longitude == null || latitude == null) {
86 }
87
95 this.route = null;
96
98 }
99
107 }
108
119 }
120
128 }
129
137 }
138
146 }
147
155 }
156
164 }
165
175 }
176
185 }
186
195 private static String
getLabelFromArtifact(Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) {
196 BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME);
197 if (attribute != null) {
198 return attribute.getDisplayString();
199 }
200
201 return "";
202 }
203
215 static Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> getAttributesFromArtifactAsMap(BlackboardArtifact artifact)
throws GeoLocationDataException {
216 Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap = new HashMap<>();
217 try {
218 List<BlackboardAttribute> attributeList = artifact.getAttributes();
219 for (BlackboardAttribute attribute : attributeList) {
220 BlackboardAttribute.ATTRIBUTE_TYPE type = BlackboardAttribute.ATTRIBUTE_TYPE.fromID(attribute.getAttributeType().getTypeID());
221 attributeMap.put(type, attribute);
222 }
223 } catch (TskCoreException ex) {
224 throw new GeoLocationDataException("Unable to get attributes from artifact", ex);
225 }
226
227 return attributeMap;
228 }
229
243
244 Set<BlackboardAttribute.ATTRIBUTE_TYPE> keys = new HashSet<>(attributeMap.keySet());
245
247 keys.remove(type);
248 }
249
250 for (BlackboardAttribute.ATTRIBUTE_TYPE type : keys) {
252 String value = attributeMap.get(type).getDisplayString();
253
255 }
256 return list;
257 }
258
264
267
275 private Property(String displayName, String value) {
278 }
279
287 }
288
296 }
297 }
298 }
List< Waypoint.Property > getOtherProperties()
static String getLabelFromArtifact(Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute > attributeMap)
static final BlackboardAttribute.ATTRIBUTE_TYPE[] ALREADY_HANDLED_ATTRIBUTES
final BlackboardArtifact artifact
static List< Waypoint.Property > createGeolocationProperties(Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute > attributeMap)
final List< Waypoint.Property > immutablePropertiesList
BlackboardArtifact getArtifact()
Property(String displayName, String value)