diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-28 22:41:07 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-28 22:41:07 +1200 |
commit | a5f47492857a175548beff07cfb565129f687ae2 (patch) | |
tree | d5650b6f5db7de9296d8d00cab505b9f594112f6 /src/org/traccar/model/Data.java | |
parent | c14f99819add0971a82ced01bf6d54ed77aedb74 (diff) | |
download | trackermap-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/Data.java')
-rw-r--r-- | src/org/traccar/model/Data.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/org/traccar/model/Data.java b/src/org/traccar/model/Data.java index 1cef813a3..e329e6c1e 100644 --- a/src/org/traccar/model/Data.java +++ b/src/org/traccar/model/Data.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 Data implements JsonConvertable { +public class Data implements Convertable { private long id; public long getId() { return id; } @@ -50,8 +51,8 @@ public class Data 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("serverTime", ObjectConverter.dateFormat.format(serverTime)); + json.add("deviceTime", ObjectConverter.dateFormat.format(deviceTime)); //json.add("extendedInfo", extendedInfo); return json.build(); } @@ -60,9 +61,13 @@ public class Data 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")); + serverTime = ObjectConverter.dateFormat.parse(json.getString("serverTime")); + deviceTime = ObjectConverter.dateFormat.parse(json.getString("deviceTime")); //extendedInfo = json.getString("extendedInfo"); } + @Override + public void fromRecord(ResultSet record) { + } + } |