aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/helper
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/helper')
-rw-r--r--src/main/java/org/traccar/helper/model/PositionUtil.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/helper/model/PositionUtil.java b/src/main/java/org/traccar/helper/model/PositionUtil.java
index 644517dac..566e31bc5 100644
--- a/src/main/java/org/traccar/helper/model/PositionUtil.java
+++ b/src/main/java/org/traccar/helper/model/PositionUtil.java
@@ -17,6 +17,15 @@ package org.traccar.helper.model;
import org.traccar.model.Position;
import org.traccar.session.cache.CacheManager;
+import org.traccar.storage.Storage;
+import org.traccar.storage.StorageException;
+import org.traccar.storage.query.Columns;
+import org.traccar.storage.query.Condition;
+import org.traccar.storage.query.Order;
+import org.traccar.storage.query.Request;
+
+import java.util.Date;
+import java.util.List;
public final class PositionUtil {
@@ -41,4 +50,14 @@ public final class PositionUtil {
return distance;
}
+ public static List<Position> getPositions(
+ Storage storage, long deviceId, Date from, Date to) throws StorageException {
+ return storage.getObjects(Position.class, new Request(
+ new Columns.All(),
+ new Condition.And(
+ new Condition.Equals("deviceId", "deviceId", deviceId),
+ new Condition.Between("fixTime", "from", from, "to", to)),
+ new Order("fixTime")));
+ }
+
}