From 728e55fc00a4b7b980d6e59f2ce8664859a5c848 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 26 Feb 2019 19:05:25 -0800 Subject: Refactor computed attributes --- src/org/traccar/api/resource/AttributeResource.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/org/traccar/api') 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 { @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": -- cgit v1.2.3