aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/model/Position.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-05-03 12:09:00 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-05-03 12:09:00 +1200
commit18127a2dfc362ffd7de4110e013a10a9f894469b (patch)
tree24ced00567acbc751985b71ffd99ce067213a34d /src/org/traccar/model/Position.java
parent427113e0aabf1b8ab54288263c3e809f292a5a05 (diff)
downloadtrackermap-server-18127a2dfc362ffd7de4110e013a10a9f894469b.tar.gz
trackermap-server-18127a2dfc362ffd7de4110e013a10a9f894469b.tar.bz2
trackermap-server-18127a2dfc362ffd7de4110e013a10a9f894469b.zip
Implmenet reflection json conversion
Diffstat (limited to 'src/org/traccar/model/Position.java')
-rw-r--r--src/org/traccar/model/Position.java46
1 files changed, 1 insertions, 45 deletions
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index c3fe60fc0..21951d115 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -15,17 +15,11 @@
*/
package org.traccar.model;
-import java.text.ParseException;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
-import javax.json.Json;
-import javax.json.JsonObject;
-import javax.json.JsonObjectBuilder;
-import org.traccar.database.Convertable;
-import org.traccar.database.ObjectConverter;
-public class Position implements Convertable {
+public class Position {
private long id;
public long getId() { return id; }
@@ -94,42 +88,4 @@ public class Position implements Convertable {
return MiscFormatter.toXmlString(other);
}
- @Override
- public JsonObject toJson() {
- JsonObjectBuilder json = Json.createObjectBuilder();
- json.add("id", id);
- json.add("protocol", protocol);
- json.add("deviceId", deviceId);
- 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);
- json.add("altitude", altitude);
- json.add("speed", speed);
- json.add("course", course);
- json.add("address", address);
- //json.add("extendedInfo", extendedInfo);
- return json.build();
- }
-
- @Override
- public void fromJson(JsonObject json) throws ParseException {
- id = json.getJsonNumber("id").longValue();
- protocol = json.getString("protocol");
- deviceId = json.getJsonNumber("deviceId").longValue();
- 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();
- altitude = json.getJsonNumber("altitude").doubleValue();
- speed = json.getJsonNumber("speed").doubleValue();
- course = json.getJsonNumber("course").doubleValue();
- address = json.getString("address");
- //extendedInfo = json.getString("extendedInfo");
- }
-
}