aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/DataManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-09-25 14:51:16 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-09-25 14:51:16 +1300
commit53bcb5c788e6b24bf8f6f631445b61a87c5f715f (patch)
treebffd421a1e538090ba868ff981635b1b5a01da65 /src/org/traccar/database/DataManager.java
parentd8dd2091c36099e5f2e5eeb00734cad54f342cbb (diff)
downloadtrackermap-server-53bcb5c788e6b24bf8f6f631445b61a87c5f715f.tar.gz
trackermap-server-53bcb5c788e6b24bf8f6f631445b61a87c5f715f.tar.bz2
trackermap-server-53bcb5c788e6b24bf8f6f631445b61a87c5f715f.zip
Implement server statistics collection
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r--src/org/traccar/database/DataManager.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 02adb0455..c58fe40a5 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -48,6 +48,7 @@ import org.traccar.model.GroupPermission;
import org.traccar.model.Notification;
import org.traccar.model.Position;
import org.traccar.model.Server;
+import org.traccar.model.Statistics;
import org.traccar.model.User;
import org.traccar.model.DeviceGeofence;
import org.traccar.model.GeofencePermission;
@@ -484,4 +485,16 @@ public class DataManager {
.setLong("id", attributeAliasId)
.executeUpdate();
}
+
+ public Collection<Statistics> getStatistics() throws SQLException {
+ return QueryBuilder.create(dataSource, getQuery("database.selectStatistics"))
+ .executeQuery(Statistics.class);
+ }
+
+ public void addStatistics(Statistics statistics) throws SQLException {
+ statistics.setId(QueryBuilder.create(dataSource, getQuery("database.insertStatistics"), true)
+ .setObject(statistics)
+ .executeUpdate());
+ }
+
}