aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/DataManager.java
diff options
context:
space:
mode:
authorChristoph Krey <c@ckrey.de>2018-04-16 10:45:11 +0200
committerGitHub <noreply@github.com>2018-04-16 10:45:11 +0200
commit3a602dd133b533cc69d5986d64a00fb3ed670f75 (patch)
tree97ff753db310a49ae7e53240b1db07fb8475679e /src/org/traccar/database/DataManager.java
parent232de5f0daef98f31b28d177d991fdbfa191f195 (diff)
parent6d4b8df25c7e942b9ad594db9444fe15bcb16be9 (diff)
downloadtrackermap-server-3a602dd133b533cc69d5986d64a00fb3ed670f75.tar.gz
trackermap-server-3a602dd133b533cc69d5986d64a00fb3ed670f75.tar.bz2
trackermap-server-3a602dd133b533cc69d5986d64a00fb3ed670f75.zip
Merge pull request #4 from traccar/master
upgrade to current master
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r--src/org/traccar/database/DataManager.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index f813426d3..84f8f0394 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -48,6 +48,7 @@ import org.traccar.model.Driver;
import org.traccar.model.Event;
import org.traccar.model.Geofence;
import org.traccar.model.Group;
+import org.traccar.model.Maintenance;
import org.traccar.model.ManagedUser;
import org.traccar.model.Notification;
import org.traccar.model.Permission;
@@ -242,12 +243,16 @@ public class DataManager {
public String getQuery(String action, Class<?> owner, Class<?> property) {
String queryName;
- if (action.equals(ACTION_SELECT_ALL)) {
- queryName = "database.select" + owner.getSimpleName() + property.getSimpleName() + "s";
- } else if (action.equals(ACTION_INSERT)) {
- queryName = "database.link" + owner.getSimpleName() + property.getSimpleName();
- } else {
- queryName = "database.unlink" + owner.getSimpleName() + property.getSimpleName();
+ switch (action) {
+ case ACTION_SELECT_ALL:
+ queryName = "database.select" + owner.getSimpleName() + property.getSimpleName() + "s";
+ break;
+ case ACTION_INSERT:
+ queryName = "database.link" + owner.getSimpleName() + property.getSimpleName();
+ break;
+ default:
+ queryName = "database.unlink" + owner.getSimpleName() + property.getSimpleName();
+ break;
}
String query = config.getString(queryName);
if (query == null) {
@@ -335,13 +340,6 @@ public class DataManager {
.executeQuery(Position.class);
}
- public void addPosition(Position position) throws SQLException {
- position.setId(QueryBuilder.create(dataSource, getQuery(ACTION_INSERT, Position.class), true)
- .setObject(position)
- .setDate("serverTime", new Date())
- .executeUpdate());
- }
-
public void updateLatestPosition(Position position) throws SQLException {
QueryBuilder.create(dataSource, getQuery("database.updateLatestPosition"))
.setDate("now", new Date())
@@ -408,6 +406,8 @@ public class DataManager {
return Calendar.class;
case "command":
return Command.class;
+ case "maintenance":
+ return Maintenance.class;
case "notification":
return Notification.class;
default: