Sleuth Kit Java Bindings (JNI)  4.8.0
Java bindings for using The Sleuth Kit
GeoArtifactsHelper.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2020 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.datamodel.blackboardutils;
20 
21 import java.util.ArrayList;
23 import java.util.List;
33 
38 public final class GeoArtifactsHelper extends ArtifactHelperBase {
39 
40  private final String programName;
41  private final TskGeoTrackpointsUtil trackPointAttributeUtil;
42  private final TskGeoWaypointsUtil waypointsAttributeUtil;
43 
58  public GeoArtifactsHelper(SleuthkitCase caseDb, String moduleName, String programName, Content srcContent) {
59  super(caseDb, moduleName, srcContent);
60  this.programName = programName;
61  trackPointAttributeUtil = new TskGeoTrackpointsUtil();
62  waypointsAttributeUtil = new TskGeoWaypointsUtil();
63  }
64 
83  public BlackboardArtifact addTrack(String trackName, GeoTrackPointList trackPoints, List<BlackboardAttribute> moreAttributes) throws TskCoreException, BlackboardException {
84  if (trackPoints == null) {
85  throw new IllegalArgumentException(String.format("addTrack was passed a null list of track points"));
86  }
87 
89  List<BlackboardAttribute> attributes = new ArrayList<>();
90 
91  if (trackName != null) {
92  attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, getModuleName(), trackName));
93  }
94 
95  attributes.add(trackPointAttributeUtil.toAttribute(getModuleName(), trackPoints));
96 
97  if (programName != null) {
98  attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, getModuleName(), programName));
99  }
100 
101  if (moreAttributes != null) {
102  attributes.addAll(moreAttributes);
103  }
104 
105  artifact.addAttributes(attributes);
106 
107  getSleuthkitCase().getBlackboard().postArtifact(artifact, getModuleName());
108 
109  return artifact;
110  }
111 
133  public BlackboardArtifact addRoute(String routeName, Long creationTime, GeoWaypointList wayPoints, List<BlackboardAttribute> moreAttributes) throws TskCoreException, BlackboardException {
134  if (wayPoints == null) {
135  throw new IllegalArgumentException(String.format("addRoute was passed a null list of waypoints"));
136  }
137 
139  List<BlackboardAttribute> attributes = new ArrayList<>();
140 
141  attributes.add(waypointsAttributeUtil.toAttribute(getModuleName(), wayPoints));
142 
143  if (routeName != null) {
144  attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, getModuleName(), routeName));
145  }
146 
147  if (creationTime != null) {
148  attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, getModuleName(), creationTime));
149  }
150 
151  if (programName != null) {
152  attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, getModuleName(), programName));
153  }
154 
155  if (moreAttributes != null) {
156  attributes.addAll(moreAttributes);
157  }
158 
159  artifact.addAttributes(attributes);
160 
161  getSleuthkitCase().getBlackboard().postArtifact(artifact, getModuleName());
162 
163  return artifact;
164  }
165 }
void addAttributes(Collection< BlackboardAttribute > attributes)
BlackboardArtifact addRoute(String routeName, Long creationTime, GeoWaypointList wayPoints, List< BlackboardAttribute > moreAttributes)
BlackboardArtifact newArtifact(int artifactTypeID)
GeoArtifactsHelper(SleuthkitCase caseDb, String moduleName, String programName, Content srcContent)
BlackboardArtifact addTrack(String trackName, GeoTrackPointList trackPoints, List< BlackboardAttribute > moreAttributes)
BlackboardAttribute toAttribute(String moduleName, GeoTrackPointList value)
BlackboardAttribute toAttribute(String moduleName, GeoWaypointList value)

Copyright © 2011-2020 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.