diff options
author | Evgeny S Maksimov <me@vragam.net> | 2018-12-16 23:13:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-16 23:13:19 +0300 |
commit | 4e9ab9892ac2712914a7d6ab865f6255bfcd2218 (patch) | |
tree | 5192ee6eb4174b4a962ef9ac9efc4fb3e21a42d3 | |
parent | 56d33dbe0e79789fc1ee78e3358c3531c2f16381 (diff) | |
download | traccar-server-4e9ab9892ac2712914a7d6ab865f6255bfcd2218.tar.gz traccar-server-4e9ab9892ac2712914a7d6ab865f6255bfcd2218.tar.bz2 traccar-server-4e9ab9892ac2712914a7d6ab865f6255bfcd2218.zip |
Added group arg
-rw-r--r-- | src/org/traccar/WebDataHandler.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java index 3e47ada70..49033fc3a 100644 --- a/src/org/traccar/WebDataHandler.java +++ b/src/org/traccar/WebDataHandler.java @@ -24,6 +24,7 @@ import org.traccar.database.IdentityManager; import org.traccar.helper.Checksum; import org.traccar.model.Device; import org.traccar.model.Position; +import org.traccar.model.Group; import javax.inject.Inject; import javax.ws.rs.client.Client; @@ -139,7 +140,16 @@ public class WebDataHandler extends BaseDataHandler { request = request.replace("{gprmc}", formatSentence(position)); } - return request; + String deviceGroupName = ""; + + if (device.getGroupId() != 0) { + Group group = Context.getGroupsManager().getById(device.getGroupId()); + if (group != null) { + deviceGroupName = group.getName(); + } + } + + return request.replace("{group}", URLEncoder.encode(deviceGroupName, StandardCharsets.UTF_8.name())); } @Override |