diff options
Diffstat (limited to 'src/main/java/org/traccar/helper')
-rw-r--r-- | src/main/java/org/traccar/helper/model/UserUtil.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/helper/model/UserUtil.java b/src/main/java/org/traccar/helper/model/UserUtil.java index 9919e1d95..9f93afeae 100644 --- a/src/main/java/org/traccar/helper/model/UserUtil.java +++ b/src/main/java/org/traccar/helper/model/UserUtil.java @@ -17,6 +17,11 @@ package org.traccar.helper.model; import org.traccar.model.Server; import org.traccar.model.User; +import org.traccar.storage.Storage; +import org.traccar.storage.StorageException; +import org.traccar.storage.query.Columns; +import org.traccar.storage.query.Order; +import org.traccar.storage.query.Request; import java.util.TimeZone; @@ -25,6 +30,12 @@ public final class UserUtil { private UserUtil() { } + public static boolean isEmpty(Storage storage) throws StorageException { + return storage.getObjects(User.class, new Request( + new Columns.Include("id"), + new Order("id", false, 1))).isEmpty(); + } + public static String getDistanceUnit(Server server, User user) { return lookupStringAttribute(server, user, "distanceUnit", "km"); } |