aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/database/Convertable.java7
-rw-r--r--src/org/traccar/database/ObjectConverter.java34
-rw-r--r--src/org/traccar/model/Data.java5
-rw-r--r--src/org/traccar/model/Device.java15
-rw-r--r--src/org/traccar/model/MiscFormatter.java4
-rw-r--r--src/org/traccar/model/Position.java5
-rw-r--r--src/org/traccar/model/User.java5
7 files changed, 2 insertions, 73 deletions
diff --git a/src/org/traccar/database/Convertable.java b/src/org/traccar/database/Convertable.java
index 4653a815a..cc1a88ceb 100644
--- a/src/org/traccar/database/Convertable.java
+++ b/src/org/traccar/database/Convertable.java
@@ -15,7 +15,6 @@
*/
package org.traccar.database;
-import java.sql.ResultSet;
import javax.json.JsonObject;
public interface Convertable {
@@ -23,9 +22,5 @@ public interface Convertable {
public JsonObject toJson();
public void fromJson(JsonObject json) throws Exception;
-
- //public void toRecord();
-
- public void fromRecord(ResultSet record);
-
+
}
diff --git a/src/org/traccar/database/ObjectConverter.java b/src/org/traccar/database/ObjectConverter.java
index 7852c88f4..5a7f7083a 100644
--- a/src/org/traccar/database/ObjectConverter.java
+++ b/src/org/traccar/database/ObjectConverter.java
@@ -15,9 +15,6 @@
*/
package org.traccar.database;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -45,16 +42,6 @@ public class ObjectConverter {
return array.build();
}
- private static boolean hasColumn(ResultSet resultSet, String columnName) throws SQLException {
- ResultSetMetaData metaData = resultSet.getMetaData();
- for (int i = 1; i <= metaData.getColumnCount(); i++) {
- if (columnName.equalsIgnoreCase(metaData.getColumnName(i))) {
- return true;
- }
- }
- return false;
- }
-
public static String getString(JsonObject json, String key) {
if (json.containsKey(key)) {
return json.getString(key);
@@ -62,13 +49,6 @@ public class ObjectConverter {
return null;
}
- public static String getString(ResultSet record, String key) throws SQLException {
- if (hasColumn(record, key)) {
- return record.getString(key);
- }
- return null;
- }
-
public static void putString(JsonObjectBuilder json, String key, String value) {
if (value != null) {
json.add(key, value);
@@ -82,13 +62,6 @@ public class ObjectConverter {
return 0;
}
- public static long getLong(ResultSet record, String key) throws SQLException {
- if (hasColumn(record, key)) {
- return record.getLong(key);
- }
- return 0;
- }
-
public static void putLong(JsonObjectBuilder json, String key, long value) {
json.add(key, value);
}
@@ -104,13 +77,6 @@ public class ObjectConverter {
return null;
}
- public static Date getDate(ResultSet record, String key) throws SQLException {
- if (hasColumn(record, key)) {
- return record.getDate(key);
- }
- return null;
- }
-
public static void putDate(JsonObjectBuilder json, String key, Date value) {
if (value != null) {
json.add(key, dateFormat.format(value));
diff --git a/src/org/traccar/model/Data.java b/src/org/traccar/model/Data.java
index c88c31417..d49bb0da6 100644
--- a/src/org/traccar/model/Data.java
+++ b/src/org/traccar/model/Data.java
@@ -15,7 +15,6 @@
*/
package org.traccar.model;
-import java.sql.ResultSet;
import java.text.ParseException;
import java.util.Date;
import java.util.LinkedHashMap;
@@ -80,8 +79,4 @@ public class Data implements Convertable {
//extendedInfo = json.getString("extendedInfo");
}
- @Override
- public void fromRecord(ResultSet record) {
- }
-
}
diff --git a/src/org/traccar/model/Device.java b/src/org/traccar/model/Device.java
index 7af1e8084..2fb26d282 100644
--- a/src/org/traccar/model/Device.java
+++ b/src/org/traccar/model/Device.java
@@ -77,19 +77,4 @@ public class Device implements Convertable, Factory {
dataId = ObjectConverter.getLong(json, "dataId");
}
- @Override
- public void fromRecord(ResultSet record) {
- try {
- id = ObjectConverter.getLong(record, "id");
- name = ObjectConverter.getString(record, "name");
- uniqueId = ObjectConverter.getString(record, "uniqueId");
- status = ObjectConverter.getString(record, "status");
- lastUpdate = ObjectConverter.getDate(record, "lastUpdate");
- positionId = ObjectConverter.getLong(record, "positionId");
- dataId = ObjectConverter.getLong(record, "dataId");
- } catch (SQLException error) {
- Log.warning(error);
- }
- }
-
}
diff --git a/src/org/traccar/model/MiscFormatter.java b/src/org/traccar/model/MiscFormatter.java
index 4a04e5181..08a6f903a 100644
--- a/src/org/traccar/model/MiscFormatter.java
+++ b/src/org/traccar/model/MiscFormatter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2014 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2013 - 2015 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +20,6 @@ import org.traccar.helper.Log;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
import java.util.Map;
/**
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index bfee94c1b..c3fe60fc0 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -15,7 +15,6 @@
*/
package org.traccar.model;
-import java.sql.ResultSet;
import java.text.ParseException;
import java.util.Date;
import java.util.LinkedHashMap;
@@ -133,8 +132,4 @@ public class Position implements Convertable {
//extendedInfo = json.getString("extendedInfo");
}
- @Override
- public void fromRecord(ResultSet record) {
- }
-
}
diff --git a/src/org/traccar/model/User.java b/src/org/traccar/model/User.java
index 77740e987..02e5c0c4f 100644
--- a/src/org/traccar/model/User.java
+++ b/src/org/traccar/model/User.java
@@ -15,7 +15,6 @@
*/
package org.traccar.model;
-import java.sql.ResultSet;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
@@ -81,8 +80,4 @@ public class User implements Convertable {
zoom = json.getJsonNumber("zoom").intValue();
}
- @Override
- public void fromRecord(ResultSet record) {
- }
-
}