aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/handler
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-03 17:06:30 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-03 17:06:30 -0700
commit4030d3207c157a3fcee2653c18440898b6b2a2e6 (patch)
treeb7e04a72bd369f75871edf832f7ff58198001a85 /src/main/java/org/traccar/handler
parent65b0f9c5398ddcb28018cb1963108534c638b1f4 (diff)
downloadtrackermap-server-4030d3207c157a3fcee2653c18440898b6b2a2e6.tar.gz
trackermap-server-4030d3207c157a3fcee2653c18440898b6b2a2e6.tar.bz2
trackermap-server-4030d3207c157a3fcee2653c18440898b6b2a2e6.zip
Remove attributes manager
Diffstat (limited to 'src/main/java/org/traccar/handler')
-rw-r--r--src/main/java/org/traccar/handler/ComputedAttributesHandler.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/handler/ComputedAttributesHandler.java b/src/main/java/org/traccar/handler/ComputedAttributesHandler.java
index 9dc170909..bec3d38e0 100644
--- a/src/main/java/org/traccar/handler/ComputedAttributesHandler.java
+++ b/src/main/java/org/traccar/handler/ComputedAttributesHandler.java
@@ -34,11 +34,11 @@ import org.slf4j.LoggerFactory;
import org.traccar.BaseDataHandler;
import org.traccar.config.Config;
import org.traccar.config.Keys;
-import org.traccar.database.AttributesManager;
import org.traccar.database.IdentityManager;
import org.traccar.model.Attribute;
import org.traccar.model.Device;
import org.traccar.model.Position;
+import org.traccar.session.cache.CacheManager;
import javax.inject.Inject;
@@ -48,7 +48,7 @@ public class ComputedAttributesHandler extends BaseDataHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(ComputedAttributesHandler.class);
private final IdentityManager identityManager;
- private final AttributesManager attributesManager;
+ private final CacheManager cacheManager;
private final JexlEngine engine;
@@ -56,9 +56,9 @@ public class ComputedAttributesHandler extends BaseDataHandler {
@Inject
public ComputedAttributesHandler(
- Config config, IdentityManager identityManager, AttributesManager attributesManager) {
+ Config config, IdentityManager identityManager, CacheManager cacheManager) {
this.identityManager = identityManager;
- this.attributesManager = attributesManager;
+ this.cacheManager = cacheManager;
engine = new JexlEngine();
engine.setStrict(true);
engine.setFunctions(Collections.singletonMap("math", Math.class));
@@ -107,8 +107,7 @@ public class ComputedAttributesHandler extends BaseDataHandler {
@Override
protected Position handlePosition(Position position) {
- Collection<Attribute> attributes = attributesManager.getItems(
- attributesManager.getAllDeviceItems(position.getDeviceId()));
+ Collection<Attribute> attributes = cacheManager.getDeviceObjects(position.getDeviceId(), Attribute.class);
for (Attribute attribute : attributes) {
if (attribute.getAttribute() != null) {
Object result = null;