Commit 83f179e8c776e205cfdc4e15c06f6fd4f1473bee

Authored by Andrew Shvayka
Committed by mp-loki
1 parent 3aeafecf

Fixed bug with REST API data representation for telemetry plugin

... ... @@ -291,7 +291,6 @@ public class SubscriptionManager {
291 291 } else {
292 292 log.trace("[{}] Remote subscription is now handled on new server address: [{}]", s.getWsSessionId(), newAddress);
293 293 subscriptionIterator.remove();
294   -
295 294 //TODO: onUpdate state of subscription by WsSessionId and other maps.
296 295 }
297 296 }
... ...
... ... @@ -139,7 +139,12 @@ public class TelemetryRestMsgHandler extends DefaultRestMsgHandler {
139 139 public void onSuccess(PluginContext ctx, List<TsKvEntry> data) {
140 140 Map<String, List<TsData>> result = new LinkedHashMap<>();
141 141 for (TsKvEntry entry : data) {
142   - result.put(entry.getKey(), data.stream().map(v -> new TsData(v.getTs(), v.getValueAsString())).collect(Collectors.toList()));
  142 + List<TsData> vList = result.get(entry.getKey());
  143 + if (vList == null) {
  144 + vList = new ArrayList<>();
  145 + result.put(entry.getKey(), vList);
  146 + }
  147 + vList.add(new TsData(entry.getTs(), entry.getValueAsString()));
143 148 }
144 149 msg.getResponseHolder().setResult(new ResponseEntity<>(result, HttpStatus.OK));
145 150 }
... ...