aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/model/Position.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-28 22:41:07 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-28 22:41:07 +1200
commita5f47492857a175548beff07cfb565129f687ae2 (patch)
treed5650b6f5db7de9296d8d00cab505b9f594112f6 /src/org/traccar/model/Position.java
parentc14f99819add0971a82ced01bf6d54ed77aedb74 (diff)
downloadtrackermap-server-a5f47492857a175548beff07cfb565129f687ae2.tar.gz
trackermap-server-a5f47492857a175548beff07cfb565129f687ae2.tar.bz2
trackermap-server-a5f47492857a175548beff07cfb565129f687ae2.zip
Implement API to create devices
Diffstat (limited to 'src/org/traccar/model/Position.java')
-rw-r--r--src/org/traccar/model/Position.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index 7f042c409..92d5bbe5e 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -15,15 +15,16 @@
*/
package org.traccar.model;
+import java.sql.ResultSet;
import java.text.ParseException;
import java.util.Date;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
-import org.traccar.database.JsonConvertable;
-import static org.traccar.database.JsonConvertable.dateFormat;
+import org.traccar.database.Convertable;
+import org.traccar.database.ObjectConverter;
-public class Position implements JsonConvertable {
+public class Position implements Convertable {
private long id;
public long getId() { return id; }
@@ -87,9 +88,9 @@ public class Position implements JsonConvertable {
JsonObjectBuilder json = Json.createObjectBuilder();
json.add("id", id);
json.add("deviceId", deviceId);
- json.add("serverTime", dateFormat.format(serverTime));
- json.add("deviceTime", dateFormat.format(deviceTime));
- json.add("fixTime", dateFormat.format(fixTime));
+ json.add("serverTime", ObjectConverter.dateFormat.format(serverTime));
+ json.add("deviceTime", ObjectConverter.dateFormat.format(deviceTime));
+ json.add("fixTime", ObjectConverter.dateFormat.format(fixTime));
json.add("valid", valid);
json.add("latitude", latitude);
json.add("longitude", longitude);
@@ -105,9 +106,9 @@ public class Position implements JsonConvertable {
public void fromJson(JsonObject json) throws ParseException {
id = json.getJsonNumber("id").longValue();
deviceId = json.getJsonNumber("deviceId").longValue();
- serverTime = dateFormat.parse(json.getString("serverTime"));
- deviceTime = dateFormat.parse(json.getString("deviceTime"));
- fixTime = dateFormat.parse(json.getString("fixTime"));
+ serverTime = ObjectConverter.dateFormat.parse(json.getString("serverTime"));
+ deviceTime = ObjectConverter.dateFormat.parse(json.getString("deviceTime"));
+ fixTime = ObjectConverter.dateFormat.parse(json.getString("fixTime"));
valid = json.getBoolean("valid");
latitude = json.getJsonNumber("latitude").doubleValue();
longitude = json.getJsonNumber("longitude").doubleValue();
@@ -118,4 +119,8 @@ public class Position implements JsonConvertable {
//extendedInfo = json.getString("extendedInfo");
}
+ @Override
+ public void fromRecord(ResultSet record) {
+ }
+
}