aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-26 19:05:25 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-02-26 19:05:25 -0800
commit728e55fc00a4b7b980d6e59f2ce8664859a5c848 (patch)
treeaf71d95acbd58370dd7c0ac4463275513360f610 /src/org/traccar/api/resource
parent03539bca46f9242ff62db9a6c9ab722ae2bb6a4d (diff)
downloadtrackermap-server-728e55fc00a4b7b980d6e59f2ce8664859a5c848.tar.gz
trackermap-server-728e55fc00a4b7b980d6e59f2ce8664859a5c848.tar.bz2
trackermap-server-728e55fc00a4b7b980d6e59f2ce8664859a5c848.zip
Refactor computed attributes
Diffstat (limited to 'src/org/traccar/api/resource')
-rw-r--r--src/org/traccar/api/resource/AttributeResource.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/org/traccar/api/resource/AttributeResource.java b/src/org/traccar/api/resource/AttributeResource.java
index fefc84041..de69d871c 100644
--- a/src/org/traccar/api/resource/AttributeResource.java
+++ b/src/org/traccar/api/resource/AttributeResource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
* Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,12 +46,15 @@ public class AttributeResource extends ExtendedObjectResource<Attribute> {
@POST
@Path("test")
- public Response test(@QueryParam("deviceId") long deviceId, Attribute entity) throws SQLException {
+ public Response test(@QueryParam("deviceId") long deviceId, Attribute entity) {
Context.getPermissionsManager().checkAdmin(getUserId());
Context.getPermissionsManager().checkDevice(getUserId(), deviceId);
Position last = Context.getIdentityManager().getLastPosition(deviceId);
if (last != null) {
- Object result = new ComputedAttributesHandler().computeAttribute(entity, last);
+ Object result = new ComputedAttributesHandler(
+ Context.getConfig(),
+ Context.getIdentityManager(),
+ Context.getAttributesManager()).computeAttribute(entity, last);
if (result != null) {
switch (entity.getType()) {
case "number":