Refactor TelemetrySubscriptionUpdate
This commit is contained in:
parent
69c9c4616c
commit
da6fa2c00b
@ -155,7 +155,7 @@ public abstract class TbAbstractEntityQuerySubCtx<T extends EntityCountQuery> ex
|
||||
private void dynamicValueSubUpdate(String sessionId, TelemetrySubscriptionUpdate subscriptionUpdate,
|
||||
Map<String, DynamicValueKeySub> dynamicValueKeySubMap) {
|
||||
Map<String, TsValue> latestUpdate = new HashMap<>();
|
||||
subscriptionUpdate.getData().forEach((key, values) -> {
|
||||
subscriptionUpdate.getValues().forEach((key, values) -> {
|
||||
latestUpdate.put(key, getLatest(values));
|
||||
});
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ public class TbAlarmDataSubCtx extends TbAbstractDataSubCtx<AlarmDataQuery> {
|
||||
EntityId entityId = subToEntityIdMap.get(subscriptionUpdate.getSubscriptionId());
|
||||
if (entityId != null) {
|
||||
Map<String, TsValue> latestUpdate = new HashMap<>();
|
||||
subscriptionUpdate.getData().forEach((key, values) -> {
|
||||
subscriptionUpdate.getValues().forEach((key, values) -> {
|
||||
latestUpdate.put(key, getLatest(values));
|
||||
});
|
||||
EntityData entityData = entitiesMap.get(entityId);
|
||||
|
||||
@ -93,7 +93,7 @@ public class TbEntityDataSubCtx extends TbAbstractDataSubCtx<EntityDataQuery> {
|
||||
|
||||
private void sendLatestWsMsg(EntityId entityId, String sessionId, TelemetrySubscriptionUpdate subscriptionUpdate, EntityKeyType keyType) {
|
||||
Map<String, TsValue> latestUpdate = new HashMap<>();
|
||||
subscriptionUpdate.getData().forEach((key, values) -> {
|
||||
subscriptionUpdate.getValues().forEach((key, values) -> {
|
||||
latestUpdate.put(key, getLatest(values));
|
||||
});
|
||||
EntityData entityData = getDataForEntity(entityId);
|
||||
@ -129,7 +129,7 @@ public class TbEntityDataSubCtx extends TbAbstractDataSubCtx<EntityDataQuery> {
|
||||
|
||||
private void sendTsWsMsg(EntityId entityId, String sessionId, TelemetrySubscriptionUpdate subscriptionUpdate, EntityKeyType keyType) {
|
||||
Map<String, List<TsValue>> tsUpdate = new HashMap<>();
|
||||
subscriptionUpdate.getData().forEach((key, values) -> {
|
||||
subscriptionUpdate.getValues().forEach((key, values) -> {
|
||||
tsUpdate.put(key, new ArrayList<>(values));
|
||||
});
|
||||
Map<String, TsValue> latestCtxValues = getLatestTsValuesForEntity(entityId);
|
||||
|
||||
@ -31,15 +31,13 @@ import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class TelemetrySubscriptionUpdate {
|
||||
|
||||
@Getter
|
||||
@With
|
||||
private final int subscriptionId;
|
||||
@Getter
|
||||
private int errorCode;
|
||||
@Getter
|
||||
private String errorMsg;
|
||||
private Map<String, List<Object>> data;
|
||||
|
||||
@ -75,7 +73,7 @@ public class TelemetrySubscriptionUpdate {
|
||||
this.errorMsg = errorMsg != null ? errorMsg : errorCode.getDefaultMsg();
|
||||
}
|
||||
|
||||
public Map<String, List<TsValue>> getData() {
|
||||
public Map<String, List<TsValue>> getValues() {
|
||||
if (data == null || data.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user