aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/session
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-10-13 10:31:54 -0700
committerAnton Tananaev <anton@traccar.org>2022-10-13 10:31:54 -0700
commit4c8e98ed409df6e12128591eb1d8d0cf0856deb7 (patch)
tree83da3517bb14977ab4809aecf3681b777785e83d /src/main/java/org/traccar/session
parentacedd28b8584a18022d9e2343558f9acbad1666f (diff)
downloadtrackermap-server-4c8e98ed409df6e12128591eb1d8d0cf0856deb7.tar.gz
trackermap-server-4c8e98ed409df6e12128591eb1d8d0cf0856deb7.tar.bz2
trackermap-server-4c8e98ed409df6e12128591eb1d8d0cf0856deb7.zip
Refactor database code (fix #4961)
Diffstat (limited to 'src/main/java/org/traccar/session')
-rw-r--r--src/main/java/org/traccar/session/ConnectionManager.java4
-rw-r--r--src/main/java/org/traccar/session/cache/CacheManager.java12
2 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/session/ConnectionManager.java b/src/main/java/org/traccar/session/ConnectionManager.java
index 9e50c9ead..37a42d827 100644
--- a/src/main/java/org/traccar/session/ConnectionManager.java
+++ b/src/main/java/org/traccar/session/ConnectionManager.java
@@ -215,7 +215,7 @@ public class ConnectionManager implements BroadcastInterface {
if (device == null) {
try {
device = storage.getObject(Device.class, new Request(
- new Columns.All(), new Condition.Equals("id", "id", deviceId)));
+ new Columns.All(), new Condition.Equals("id", deviceId)));
} catch (StorageException e) {
LOGGER.warn("Failed to get device", e);
}
@@ -265,7 +265,7 @@ public class ConnectionManager implements BroadcastInterface {
try {
storage.updateObject(device, new Request(
new Columns.Include("status", "lastUpdate"),
- new Condition.Equals("id", "id")));
+ new Condition.Equals("id", deviceId)));
} catch (StorageException e) {
LOGGER.warn("Update device status error", e);
}
diff --git a/src/main/java/org/traccar/session/cache/CacheManager.java b/src/main/java/org/traccar/session/cache/CacheManager.java
index ed67ed70e..8f2e7ba93 100644
--- a/src/main/java/org/traccar/session/cache/CacheManager.java
+++ b/src/main/java/org/traccar/session/cache/CacheManager.java
@@ -201,7 +201,7 @@ public class CacheManager implements BroadcastInterface {
public void invalidateObject(boolean local, Class<? extends BaseModel> clazz, long id) {
try {
var object = storage.getObject(clazz, new Request(
- new Columns.All(), new Condition.Equals("id", "id", id)));
+ new Columns.All(), new Condition.Equals("id", id)));
if (object != null) {
updateOrInvalidate(local, object);
} else {
@@ -286,7 +286,7 @@ public class CacheManager implements BroadcastInterface {
Map<Class<? extends BaseModel>, Set<Long>> links = new HashMap<>();
Device device = storage.getObject(Device.class, new Request(
- new Columns.All(), new Condition.Equals("id", "id", deviceId)));
+ new Columns.All(), new Condition.Equals("id", deviceId)));
if (device != null) {
addObject(deviceId, device);
@@ -294,7 +294,7 @@ public class CacheManager implements BroadcastInterface {
long groupId = device.getGroupId();
while (groupDepth < GROUP_DEPTH_LIMIT && groupId > 0) {
Group group = storage.getObject(Group.class, new Request(
- new Columns.All(), new Condition.Equals("id", "id", groupId)));
+ new Columns.All(), new Condition.Equals("id", groupId)));
links.computeIfAbsent(Group.class, k -> new LinkedHashSet<>()).add(group.getId());
addObject(deviceId, group);
groupId = group.getGroupId();
@@ -311,7 +311,7 @@ public class CacheManager implements BroadcastInterface {
var scheduled = (ScheduledModel) object;
if (scheduled.getCalendarId() > 0) {
var calendar = storage.getObject(Calendar.class, new Request(
- new Columns.All(), new Condition.Equals("id", "id", scheduled.getCalendarId())));
+ new Columns.All(), new Condition.Equals("id", scheduled.getCalendarId())));
links.computeIfAbsent(Notification.class, k -> new LinkedHashSet<>())
.add(calendar.getId());
addObject(deviceId, calendar);
@@ -336,7 +336,7 @@ public class CacheManager implements BroadcastInterface {
addObject(deviceId, notification);
if (notification.getCalendarId() > 0) {
var calendar = storage.getObject(Calendar.class, new Request(
- new Columns.All(), new Condition.Equals("id", "id", notification.getCalendarId())));
+ new Columns.All(), new Condition.Equals("id", notification.getCalendarId())));
links.computeIfAbsent(Notification.class, k -> new LinkedHashSet<>())
.add(calendar.getId());
addObject(deviceId, calendar);
@@ -348,7 +348,7 @@ public class CacheManager implements BroadcastInterface {
if (device.getPositionId() > 0) {
devicePositions.put(deviceId, storage.getObject(Position.class, new Request(
- new Columns.All(), new Condition.Equals("id", "id", device.getPositionId()))));
+ new Columns.All(), new Condition.Equals("id", device.getPositionId()))));
}
}
}