diff options
author | Gabor Somogyi <Gabor_Somogyi@epam.com> | 2016-05-05 15:36:56 +0200 |
---|---|---|
committer | Gabor Somogyi <Gabor_Somogyi@epam.com> | 2016-05-05 15:36:56 +0200 |
commit | be0040a7c18f5c165f1aaa27a194a189f50b1510 (patch) | |
tree | 7f566c14e753e58ab784328ef40a33bdc9793c91 | |
parent | be2e936c935fa8674f09ee3617b1ecfae4b90ff9 (diff) | |
download | trackermap-server-be0040a7c18f5c165f1aaa27a194a189f50b1510.tar.gz trackermap-server-be0040a7c18f5c165f1aaa27a194a189f50b1510.tar.bz2 trackermap-server-be0040a7c18f5c165f1aaa27a194a189f50b1510.zip |
Backend side model put back
-rw-r--r-- | src/org/traccar/ServerManager.java | 10 | ||||
-rw-r--r-- | src/org/traccar/api/resource/SupportedCommandResource.java | 3 | ||||
-rw-r--r-- | src/org/traccar/model/SupportedCommand.java | 29 | ||||
-rw-r--r-- | web/app/store/SupportedCommands.js | 4 |
4 files changed, 39 insertions, 7 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 59bb88829..f79d543ff 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -15,6 +15,8 @@ */ package org.traccar; +import org.traccar.model.SupportedCommand; + import java.io.File; import java.net.URI; import java.net.URL; @@ -96,13 +98,15 @@ public class ServerManager { } } - public Collection<String> getProtocolSuppportedCommands(String protocol) { - List<String> result = new ArrayList<>(); + public Collection<SupportedCommand> getProtocolSuppportedCommands(String protocol) { + List<SupportedCommand> result = new ArrayList<>(); if (protocol != null) { BaseProtocol baseProtocol = protocols.get(protocol); for (String commandKey : baseProtocol.getSupportedCommands()) { - result.add(commandKey); + SupportedCommand supportedCommand = new SupportedCommand(); + supportedCommand.setKey(commandKey); + result.add(supportedCommand); } } diff --git a/src/org/traccar/api/resource/SupportedCommandResource.java b/src/org/traccar/api/resource/SupportedCommandResource.java index 393588d9b..1d5ce8595 100644 --- a/src/org/traccar/api/resource/SupportedCommandResource.java +++ b/src/org/traccar/api/resource/SupportedCommandResource.java @@ -18,6 +18,7 @@ package org.traccar.api.resource; import org.traccar.Context; import org.traccar.api.BaseResource; import org.traccar.model.Position; +import org.traccar.model.SupportedCommand; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -35,7 +36,7 @@ import java.util.Collections; public class SupportedCommandResource extends BaseResource { @GET - public Collection<String> get(@QueryParam("deviceId") long deviceId) throws SQLException { + public Collection<SupportedCommand> get(@QueryParam("deviceId") long deviceId) throws SQLException { Context.getPermissionsManager().checkDevice(getUserId(), deviceId); Position lastPosition = Context.getConnectionManager().getLastPosition(deviceId); if (lastPosition != null) { diff --git a/src/org/traccar/model/SupportedCommand.java b/src/org/traccar/model/SupportedCommand.java new file mode 100644 index 000000000..59a24d033 --- /dev/null +++ b/src/org/traccar/model/SupportedCommand.java @@ -0,0 +1,29 @@ +/* + * Copyright 2016 Gabor Somogyi (gabor.g.somogyi@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.model; + +public class SupportedCommand { + + private String key; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } +} diff --git a/web/app/store/SupportedCommands.js b/web/app/store/SupportedCommands.js index 612909180..2bb73839b 100644 --- a/web/app/store/SupportedCommands.js +++ b/web/app/store/SupportedCommands.js @@ -16,9 +16,7 @@ Ext.define('Traccar.store.SupportedCommands', { extend: 'Ext.data.Store', - fields: [ - { type: 'string', name: 'key'} - ], + fields: ['key'], listeners: { 'beforeload' : function(store, eOpts) { |