aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/MainEventHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-18 11:44:40 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-18 11:44:40 -0700
commit03b50c61afd7c9d7e19a76feb261147dd0f69588 (patch)
tree575f1737e3006c66844c1fa9e06a3323bac7746c /src/main/java/org/traccar/MainEventHandler.java
parentddbe4d7de6ae7590e2b927066312597efa129393 (diff)
downloadtrackermap-server-03b50c61afd7c9d7e19a76feb261147dd0f69588.tar.gz
trackermap-server-03b50c61afd7c9d7e19a76feb261147dd0f69588.tar.bz2
trackermap-server-03b50c61afd7c9d7e19a76feb261147dd0f69588.zip
Remove identity manager
Diffstat (limited to 'src/main/java/org/traccar/MainEventHandler.java')
-rw-r--r--src/main/java/org/traccar/MainEventHandler.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/MainEventHandler.java b/src/main/java/org/traccar/MainEventHandler.java
index e1aee3cc8..d2665cbcc 100644
--- a/src/main/java/org/traccar/MainEventHandler.java
+++ b/src/main/java/org/traccar/MainEventHandler.java
@@ -74,12 +74,14 @@ public class MainEventHandler extends ChannelInboundHandlerAdapter {
if (msg instanceof Position) {
Position position = (Position) msg;
+ Device device = cacheManager.getObject(Device.class, position.getDeviceId());
+
try {
if (PositionUtil.isLatest(cacheManager, position)) {
- Device device = new Device();
- device.setId(position.getDeviceId());
- device.setPositionId(position.getId());
- storage.updateObject(device, new Request(
+ Device updatedDevice = new Device();
+ updatedDevice.setId(position.getDeviceId());
+ updatedDevice.setPositionId(position.getId());
+ storage.updateObject(updatedDevice, new Request(
new Columns.Include("positionId"),
new Condition.Equals("id", "id")));
@@ -92,11 +94,9 @@ public class MainEventHandler extends ChannelInboundHandlerAdapter {
LOGGER.warn("Failed to update device", error);
}
- String uniqueId = Context.getIdentityManager().getById(position.getDeviceId()).getUniqueId();
-
StringBuilder builder = new StringBuilder();
builder.append("[").append(NetworkUtil.session(ctx.channel())).append("] ");
- builder.append("id: ").append(uniqueId);
+ builder.append("id: ").append(device.getUniqueId());
for (String attribute : logAttributes) {
switch (attribute) {
case "time":