aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/handler/CopyAttributesHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-03-30 19:36:35 -0700
committerAnton Tananaev <anton@traccar.org>2024-03-30 19:36:35 -0700
commit0f7ec1247cff1a68ffa57ade3f45b11f6602e262 (patch)
tree8cd0006e2b9d2313ef6ff4291188e30d40456701 /src/main/java/org/traccar/handler/CopyAttributesHandler.java
parentf84e2710e05660822633ec9e61cde44c03a42d7e (diff)
downloadtrackermap-server-0f7ec1247cff1a68ffa57ade3f45b11f6602e262.tar.gz
trackermap-server-0f7ec1247cff1a68ffa57ade3f45b11f6602e262.tar.bz2
trackermap-server-0f7ec1247cff1a68ffa57ade3f45b11f6602e262.zip
Make handlers nullable
Diffstat (limited to 'src/main/java/org/traccar/handler/CopyAttributesHandler.java')
-rw-r--r--src/main/java/org/traccar/handler/CopyAttributesHandler.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/main/java/org/traccar/handler/CopyAttributesHandler.java b/src/main/java/org/traccar/handler/CopyAttributesHandler.java
index 9c31bf56e..f682c99c9 100644
--- a/src/main/java/org/traccar/handler/CopyAttributesHandler.java
+++ b/src/main/java/org/traccar/handler/CopyAttributesHandler.java
@@ -25,26 +25,22 @@ import org.traccar.session.cache.CacheManager;
public class CopyAttributesHandler extends BasePositionHandler {
- private final boolean enabled;
private final CacheManager cacheManager;
@Inject
public CopyAttributesHandler(Config config, CacheManager cacheManager) {
- enabled = config.getBoolean(Keys.PROCESSING_COPY_ATTRIBUTES_ENABLE);
this.cacheManager = cacheManager;
}
@Override
public void handlePosition(Position position, Callback callback) {
- if (enabled) {
- String attributesString = AttributeUtil.lookup(
- cacheManager, Keys.PROCESSING_COPY_ATTRIBUTES, position.getDeviceId());
- Position last = cacheManager.getPosition(position.getDeviceId());
- if (last != null && attributesString != null) {
- for (String attribute : attributesString.split("[ ,]")) {
- if (last.hasAttribute(attribute) && !position.hasAttribute(attribute)) {
- position.getAttributes().put(attribute, last.getAttributes().get(attribute));
- }
+ String attributesString = AttributeUtil.lookup(
+ cacheManager, Keys.PROCESSING_COPY_ATTRIBUTES, position.getDeviceId());
+ Position last = cacheManager.getPosition(position.getDeviceId());
+ if (last != null && attributesString != null) {
+ for (String attribute : attributesString.split("[ ,]")) {
+ if (last.hasAttribute(attribute) && !position.hasAttribute(attribute)) {
+ position.getAttributes().put(attribute, last.getAttributes().get(attribute));
}
}
}