Commit 94bc3e2d1b82e8295545e86024c840e7b05092b0
1 parent
d30ac7d2
Changed method usage - single set instead of collection
Showing
15 changed files
with
33 additions
and
55 deletions
@@ -24,8 +24,6 @@ import org.thingsboard.server.gen.edge.v1.AdminSettingsUpdateMsg; | @@ -24,8 +24,6 @@ import org.thingsboard.server.gen.edge.v1.AdminSettingsUpdateMsg; | ||
24 | import org.thingsboard.server.gen.edge.v1.DownlinkMsg; | 24 | import org.thingsboard.server.gen.edge.v1.DownlinkMsg; |
25 | import org.thingsboard.server.queue.util.TbCoreComponent; | 25 | import org.thingsboard.server.queue.util.TbCoreComponent; |
26 | 26 | ||
27 | -import java.util.Collections; | ||
28 | - | ||
29 | @Component | 27 | @Component |
30 | @Slf4j | 28 | @Slf4j |
31 | @TbCoreComponent | 29 | @TbCoreComponent |
@@ -33,10 +31,10 @@ public class AdminSettingsEdgeProcessor extends BaseEdgeProcessor { | @@ -33,10 +31,10 @@ public class AdminSettingsEdgeProcessor extends BaseEdgeProcessor { | ||
33 | 31 | ||
34 | public DownlinkMsg processAdminSettingsToEdge(EdgeEvent edgeEvent) { | 32 | public DownlinkMsg processAdminSettingsToEdge(EdgeEvent edgeEvent) { |
35 | AdminSettings adminSettings = mapper.convertValue(edgeEvent.getBody(), AdminSettings.class); | 33 | AdminSettings adminSettings = mapper.convertValue(edgeEvent.getBody(), AdminSettings.class); |
36 | - AdminSettingsUpdateMsg t = adminSettingsMsgConstructor.constructAdminSettingsUpdateMsg(adminSettings); | 34 | + AdminSettingsUpdateMsg adminSettingsUpdateMsg = adminSettingsMsgConstructor.constructAdminSettingsUpdateMsg(adminSettings); |
37 | return DownlinkMsg.newBuilder() | 35 | return DownlinkMsg.newBuilder() |
38 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 36 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
39 | - .addAllAdminSettingsUpdateMsg(Collections.singletonList(t)) | 37 | + .addAdminSettingsUpdateMsg(adminSettingsUpdateMsg) |
40 | .build(); | 38 | .build(); |
41 | } | 39 | } |
42 | 40 |
@@ -42,7 +42,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | @@ -42,7 +42,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | ||
42 | import org.thingsboard.server.gen.transport.TransportProtos; | 42 | import org.thingsboard.server.gen.transport.TransportProtos; |
43 | import org.thingsboard.server.queue.util.TbCoreComponent; | 43 | import org.thingsboard.server.queue.util.TbCoreComponent; |
44 | 44 | ||
45 | -import java.util.Collections; | ||
46 | import java.util.UUID; | 45 | import java.util.UUID; |
47 | 46 | ||
48 | @Component | 47 | @Component |
@@ -122,7 +121,7 @@ public class AlarmEdgeProcessor extends BaseEdgeProcessor { | @@ -122,7 +121,7 @@ public class AlarmEdgeProcessor extends BaseEdgeProcessor { | ||
122 | if (alarm != null) { | 121 | if (alarm != null) { |
123 | downlinkMsg = DownlinkMsg.newBuilder() | 122 | downlinkMsg = DownlinkMsg.newBuilder() |
124 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 123 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
125 | - .addAllAlarmUpdateMsg(Collections.singletonList(alarmMsgConstructor.constructAlarmUpdatedMsg(edge.getTenantId(), msgType, alarm))) | 124 | + .addAlarmUpdateMsg(alarmMsgConstructor.constructAlarmUpdatedMsg(edge.getTenantId(), msgType, alarm)) |
126 | .build(); | 125 | .build(); |
127 | } | 126 | } |
128 | } catch (Exception e) { | 127 | } catch (Exception e) { |
@@ -29,8 +29,6 @@ import org.thingsboard.server.gen.edge.v1.DownlinkMsg; | @@ -29,8 +29,6 @@ import org.thingsboard.server.gen.edge.v1.DownlinkMsg; | ||
29 | import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | 29 | import org.thingsboard.server.gen.edge.v1.UpdateMsgType; |
30 | import org.thingsboard.server.queue.util.TbCoreComponent; | 30 | import org.thingsboard.server.queue.util.TbCoreComponent; |
31 | 31 | ||
32 | -import java.util.Collections; | ||
33 | - | ||
34 | @Component | 32 | @Component |
35 | @Slf4j | 33 | @Slf4j |
36 | @TbCoreComponent | 34 | @TbCoreComponent |
@@ -52,7 +50,7 @@ public class AssetEdgeProcessor extends BaseEdgeProcessor { | @@ -52,7 +50,7 @@ public class AssetEdgeProcessor extends BaseEdgeProcessor { | ||
52 | assetMsgConstructor.constructAssetUpdatedMsg(msgType, asset, customerId); | 50 | assetMsgConstructor.constructAssetUpdatedMsg(msgType, asset, customerId); |
53 | downlinkMsg = DownlinkMsg.newBuilder() | 51 | downlinkMsg = DownlinkMsg.newBuilder() |
54 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 52 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
55 | - .addAllAssetUpdateMsg(Collections.singletonList(assetUpdateMsg)) | 53 | + .addAssetUpdateMsg(assetUpdateMsg) |
56 | .build(); | 54 | .build(); |
57 | } | 55 | } |
58 | break; | 56 | break; |
@@ -62,7 +60,7 @@ public class AssetEdgeProcessor extends BaseEdgeProcessor { | @@ -62,7 +60,7 @@ public class AssetEdgeProcessor extends BaseEdgeProcessor { | ||
62 | assetMsgConstructor.constructAssetDeleteMsg(assetId); | 60 | assetMsgConstructor.constructAssetDeleteMsg(assetId); |
63 | downlinkMsg = DownlinkMsg.newBuilder() | 61 | downlinkMsg = DownlinkMsg.newBuilder() |
64 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 62 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
65 | - .addAllAssetUpdateMsg(Collections.singletonList(assetUpdateMsg)) | 63 | + .addAssetUpdateMsg(assetUpdateMsg) |
66 | .build(); | 64 | .build(); |
67 | break; | 65 | break; |
68 | } | 66 | } |
@@ -35,7 +35,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | @@ -35,7 +35,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | ||
35 | import org.thingsboard.server.gen.transport.TransportProtos; | 35 | import org.thingsboard.server.gen.transport.TransportProtos; |
36 | import org.thingsboard.server.queue.util.TbCoreComponent; | 36 | import org.thingsboard.server.queue.util.TbCoreComponent; |
37 | 37 | ||
38 | -import java.util.Collections; | ||
39 | import java.util.UUID; | 38 | import java.util.UUID; |
40 | 39 | ||
41 | @Component | 40 | @Component |
@@ -55,7 +54,7 @@ public class CustomerEdgeProcessor extends BaseEdgeProcessor { | @@ -55,7 +54,7 @@ public class CustomerEdgeProcessor extends BaseEdgeProcessor { | ||
55 | customerMsgConstructor.constructCustomerUpdatedMsg(msgType, customer); | 54 | customerMsgConstructor.constructCustomerUpdatedMsg(msgType, customer); |
56 | downlinkMsg = DownlinkMsg.newBuilder() | 55 | downlinkMsg = DownlinkMsg.newBuilder() |
57 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 56 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
58 | - .addAllCustomerUpdateMsg(Collections.singletonList(customerUpdateMsg)) | 57 | + .addCustomerUpdateMsg(customerUpdateMsg) |
59 | .build(); | 58 | .build(); |
60 | } | 59 | } |
61 | break; | 60 | break; |
@@ -64,7 +63,7 @@ public class CustomerEdgeProcessor extends BaseEdgeProcessor { | @@ -64,7 +63,7 @@ public class CustomerEdgeProcessor extends BaseEdgeProcessor { | ||
64 | customerMsgConstructor.constructCustomerDeleteMsg(customerId); | 63 | customerMsgConstructor.constructCustomerDeleteMsg(customerId); |
65 | downlinkMsg = DownlinkMsg.newBuilder() | 64 | downlinkMsg = DownlinkMsg.newBuilder() |
66 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 65 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
67 | - .addAllCustomerUpdateMsg(Collections.singletonList(customerUpdateMsg)) | 66 | + .addCustomerUpdateMsg(customerUpdateMsg) |
68 | .build(); | 67 | .build(); |
69 | break; | 68 | break; |
70 | } | 69 | } |
@@ -55,7 +55,7 @@ public class DashboardEdgeProcessor extends BaseEdgeProcessor { | @@ -55,7 +55,7 @@ public class DashboardEdgeProcessor extends BaseEdgeProcessor { | ||
55 | dashboardMsgConstructor.constructDashboardUpdatedMsg(msgType, dashboard, customerId); | 55 | dashboardMsgConstructor.constructDashboardUpdatedMsg(msgType, dashboard, customerId); |
56 | downlinkMsg = DownlinkMsg.newBuilder() | 56 | downlinkMsg = DownlinkMsg.newBuilder() |
57 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 57 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
58 | - .addAllDashboardUpdateMsg(Collections.singletonList(dashboardUpdateMsg)) | 58 | + .addDashboardUpdateMsg(dashboardUpdateMsg) |
59 | .build(); | 59 | .build(); |
60 | } | 60 | } |
61 | break; | 61 | break; |
@@ -65,7 +65,7 @@ public class DashboardEdgeProcessor extends BaseEdgeProcessor { | @@ -65,7 +65,7 @@ public class DashboardEdgeProcessor extends BaseEdgeProcessor { | ||
65 | dashboardMsgConstructor.constructDashboardDeleteMsg(dashboardId); | 65 | dashboardMsgConstructor.constructDashboardDeleteMsg(dashboardId); |
66 | downlinkMsg = DownlinkMsg.newBuilder() | 66 | downlinkMsg = DownlinkMsg.newBuilder() |
67 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 67 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
68 | - .addAllDashboardUpdateMsg(Collections.singletonList(dashboardUpdateMsg)) | 68 | + .addDashboardUpdateMsg(dashboardUpdateMsg) |
69 | .build(); | 69 | .build(); |
70 | break; | 70 | break; |
71 | } | 71 | } |
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/DeviceEdgeProcessor.java
@@ -63,7 +63,6 @@ import org.thingsboard.server.queue.util.TbCoreComponent; | @@ -63,7 +63,6 @@ import org.thingsboard.server.queue.util.TbCoreComponent; | ||
63 | import org.thingsboard.server.service.rpc.FromDeviceRpcResponse; | 63 | import org.thingsboard.server.service.rpc.FromDeviceRpcResponse; |
64 | import org.thingsboard.server.service.rpc.FromDeviceRpcResponseActorMsg; | 64 | import org.thingsboard.server.service.rpc.FromDeviceRpcResponseActorMsg; |
65 | 65 | ||
66 | -import java.util.Collections; | ||
67 | import java.util.UUID; | 66 | import java.util.UUID; |
68 | import java.util.concurrent.locks.ReentrantLock; | 67 | import java.util.concurrent.locks.ReentrantLock; |
69 | 68 | ||
@@ -340,7 +339,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor { | @@ -340,7 +339,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor { | ||
340 | deviceMsgConstructor.constructDeviceUpdatedMsg(msgType, device, customerId, null); | 339 | deviceMsgConstructor.constructDeviceUpdatedMsg(msgType, device, customerId, null); |
341 | downlinkMsg = DownlinkMsg.newBuilder() | 340 | downlinkMsg = DownlinkMsg.newBuilder() |
342 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 341 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
343 | - .addAllDeviceUpdateMsg(Collections.singletonList(deviceUpdateMsg)) | 342 | + .addDeviceUpdateMsg(deviceUpdateMsg) |
344 | .build(); | 343 | .build(); |
345 | } | 344 | } |
346 | break; | 345 | break; |
@@ -350,7 +349,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor { | @@ -350,7 +349,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor { | ||
350 | deviceMsgConstructor.constructDeviceDeleteMsg(deviceId); | 349 | deviceMsgConstructor.constructDeviceDeleteMsg(deviceId); |
351 | downlinkMsg = DownlinkMsg.newBuilder() | 350 | downlinkMsg = DownlinkMsg.newBuilder() |
352 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 351 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
353 | - .addAllDeviceUpdateMsg(Collections.singletonList(deviceUpdateMsg)) | 352 | + .addDeviceUpdateMsg(deviceUpdateMsg) |
354 | .build(); | 353 | .build(); |
355 | break; | 354 | break; |
356 | case CREDENTIALS_UPDATED: | 355 | case CREDENTIALS_UPDATED: |
@@ -360,7 +359,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor { | @@ -360,7 +359,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor { | ||
360 | deviceMsgConstructor.constructDeviceCredentialsUpdatedMsg(deviceCredentials); | 359 | deviceMsgConstructor.constructDeviceCredentialsUpdatedMsg(deviceCredentials); |
361 | downlinkMsg = DownlinkMsg.newBuilder() | 360 | downlinkMsg = DownlinkMsg.newBuilder() |
362 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 361 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
363 | - .addAllDeviceCredentialsUpdateMsg(Collections.singletonList(deviceCredentialsUpdateMsg)) | 362 | + .addDeviceCredentialsUpdateMsg(deviceCredentialsUpdateMsg) |
364 | .build(); | 363 | .build(); |
365 | } | 364 | } |
366 | break; | 365 | break; |
@@ -374,7 +373,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor { | @@ -374,7 +373,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor { | ||
374 | deviceMsgConstructor.constructDeviceRpcCallMsg(edgeEvent.getEntityId(), edgeEvent.getBody()); | 373 | deviceMsgConstructor.constructDeviceRpcCallMsg(edgeEvent.getEntityId(), edgeEvent.getBody()); |
375 | return DownlinkMsg.newBuilder() | 374 | return DownlinkMsg.newBuilder() |
376 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 375 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
377 | - .addAllDeviceRpcCallMsg(Collections.singletonList(deviceRpcCallMsg)) | 376 | + .addDeviceRpcCallMsg(deviceRpcCallMsg) |
378 | .build(); | 377 | .build(); |
379 | } | 378 | } |
380 | } | 379 | } |
@@ -27,8 +27,6 @@ import org.thingsboard.server.gen.edge.v1.DownlinkMsg; | @@ -27,8 +27,6 @@ import org.thingsboard.server.gen.edge.v1.DownlinkMsg; | ||
27 | import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | 27 | import org.thingsboard.server.gen.edge.v1.UpdateMsgType; |
28 | import org.thingsboard.server.queue.util.TbCoreComponent; | 28 | import org.thingsboard.server.queue.util.TbCoreComponent; |
29 | 29 | ||
30 | -import java.util.Collections; | ||
31 | - | ||
32 | @Component | 30 | @Component |
33 | @Slf4j | 31 | @Slf4j |
34 | @TbCoreComponent | 32 | @TbCoreComponent |
@@ -46,7 +44,7 @@ public class DeviceProfileEdgeProcessor extends BaseEdgeProcessor { | @@ -46,7 +44,7 @@ public class DeviceProfileEdgeProcessor extends BaseEdgeProcessor { | ||
46 | deviceProfileMsgConstructor.constructDeviceProfileUpdatedMsg(msgType, deviceProfile); | 44 | deviceProfileMsgConstructor.constructDeviceProfileUpdatedMsg(msgType, deviceProfile); |
47 | downlinkMsg = DownlinkMsg.newBuilder() | 45 | downlinkMsg = DownlinkMsg.newBuilder() |
48 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 46 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
49 | - .addAllDeviceProfileUpdateMsg(Collections.singletonList(deviceProfileUpdateMsg)) | 47 | + .addDeviceProfileUpdateMsg(deviceProfileUpdateMsg) |
50 | .build(); | 48 | .build(); |
51 | } | 49 | } |
52 | break; | 50 | break; |
@@ -55,7 +53,7 @@ public class DeviceProfileEdgeProcessor extends BaseEdgeProcessor { | @@ -55,7 +53,7 @@ public class DeviceProfileEdgeProcessor extends BaseEdgeProcessor { | ||
55 | deviceProfileMsgConstructor.constructDeviceProfileDeleteMsg(deviceProfileId); | 53 | deviceProfileMsgConstructor.constructDeviceProfileDeleteMsg(deviceProfileId); |
56 | downlinkMsg = DownlinkMsg.newBuilder() | 54 | downlinkMsg = DownlinkMsg.newBuilder() |
57 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 55 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
58 | - .addAllDeviceProfileUpdateMsg(Collections.singletonList(deviceProfileUpdateMsg)) | 56 | + .addDeviceProfileUpdateMsg(deviceProfileUpdateMsg) |
59 | .build(); | 57 | .build(); |
60 | break; | 58 | break; |
61 | } | 59 | } |
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EntityEdgeProcessor.java
@@ -45,7 +45,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | @@ -45,7 +45,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | ||
45 | import org.thingsboard.server.gen.transport.TransportProtos; | 45 | import org.thingsboard.server.gen.transport.TransportProtos; |
46 | import org.thingsboard.server.queue.util.TbCoreComponent; | 46 | import org.thingsboard.server.queue.util.TbCoreComponent; |
47 | 47 | ||
48 | -import java.util.Collections; | ||
49 | import java.util.List; | 48 | import java.util.List; |
50 | import java.util.UUID; | 49 | import java.util.UUID; |
51 | 50 | ||
@@ -64,11 +63,11 @@ public class EntityEdgeProcessor extends BaseEdgeProcessor { | @@ -64,11 +63,11 @@ public class EntityEdgeProcessor extends BaseEdgeProcessor { | ||
64 | if(edgeEvent.getBody() != null) { | 63 | if(edgeEvent.getBody() != null) { |
65 | conflictName = edgeEvent.getBody().get("conflictName").asText(); | 64 | conflictName = edgeEvent.getBody().get("conflictName").asText(); |
66 | } | 65 | } |
67 | - DeviceUpdateMsg d = deviceMsgConstructor | 66 | + DeviceUpdateMsg deviceUpdateMsg = deviceMsgConstructor |
68 | .constructDeviceUpdatedMsg(UpdateMsgType.ENTITY_MERGE_RPC_MESSAGE, device, customerId, conflictName); | 67 | .constructDeviceUpdatedMsg(UpdateMsgType.ENTITY_MERGE_RPC_MESSAGE, device, customerId, conflictName); |
69 | downlinkMsg = DownlinkMsg.newBuilder() | 68 | downlinkMsg = DownlinkMsg.newBuilder() |
70 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 69 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
71 | - .addAllDeviceUpdateMsg(Collections.singletonList(d)) | 70 | + .addDeviceUpdateMsg(deviceUpdateMsg) |
72 | .build(); | 71 | .build(); |
73 | } | 72 | } |
74 | return downlinkMsg; | 73 | return downlinkMsg; |
@@ -84,7 +83,7 @@ public class EntityEdgeProcessor extends BaseEdgeProcessor { | @@ -84,7 +83,7 @@ public class EntityEdgeProcessor extends BaseEdgeProcessor { | ||
84 | .build(); | 83 | .build(); |
85 | DownlinkMsg.Builder builder = DownlinkMsg.newBuilder() | 84 | DownlinkMsg.Builder builder = DownlinkMsg.newBuilder() |
86 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 85 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
87 | - .addAllDeviceCredentialsRequestMsg(Collections.singletonList(deviceCredentialsRequestMsg)); | 86 | + .addDeviceCredentialsRequestMsg(deviceCredentialsRequestMsg); |
88 | downlinkMsg = builder.build(); | 87 | downlinkMsg = builder.build(); |
89 | } | 88 | } |
90 | return downlinkMsg; | 89 | return downlinkMsg; |
@@ -29,8 +29,6 @@ import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; | @@ -29,8 +29,6 @@ import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; | ||
29 | import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | 29 | import org.thingsboard.server.gen.edge.v1.UpdateMsgType; |
30 | import org.thingsboard.server.queue.util.TbCoreComponent; | 30 | import org.thingsboard.server.queue.util.TbCoreComponent; |
31 | 31 | ||
32 | -import java.util.Collections; | ||
33 | - | ||
34 | @Component | 32 | @Component |
35 | @Slf4j | 33 | @Slf4j |
36 | @TbCoreComponent | 34 | @TbCoreComponent |
@@ -52,7 +50,7 @@ public class EntityViewEdgeProcessor extends BaseEdgeProcessor { | @@ -52,7 +50,7 @@ public class EntityViewEdgeProcessor extends BaseEdgeProcessor { | ||
52 | entityViewMsgConstructor.constructEntityViewUpdatedMsg(msgType, entityView, customerId); | 50 | entityViewMsgConstructor.constructEntityViewUpdatedMsg(msgType, entityView, customerId); |
53 | downlinkMsg = DownlinkMsg.newBuilder() | 51 | downlinkMsg = DownlinkMsg.newBuilder() |
54 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 52 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
55 | - .addAllEntityViewUpdateMsg(Collections.singletonList(entityViewUpdateMsg)) | 53 | + .addEntityViewUpdateMsg(entityViewUpdateMsg) |
56 | .build(); | 54 | .build(); |
57 | } | 55 | } |
58 | break; | 56 | break; |
@@ -62,7 +60,7 @@ public class EntityViewEdgeProcessor extends BaseEdgeProcessor { | @@ -62,7 +60,7 @@ public class EntityViewEdgeProcessor extends BaseEdgeProcessor { | ||
62 | entityViewMsgConstructor.constructEntityViewDeleteMsg(entityViewId); | 60 | entityViewMsgConstructor.constructEntityViewDeleteMsg(entityViewId); |
63 | downlinkMsg = DownlinkMsg.newBuilder() | 61 | downlinkMsg = DownlinkMsg.newBuilder() |
64 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 62 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
65 | - .addAllEntityViewUpdateMsg(Collections.singletonList(entityViewUpdateMsg)) | 63 | + .addEntityViewUpdateMsg(entityViewUpdateMsg) |
66 | .build(); | 64 | .build(); |
67 | break; | 65 | break; |
68 | } | 66 | } |
@@ -48,7 +48,6 @@ import org.thingsboard.server.gen.transport.TransportProtos; | @@ -48,7 +48,6 @@ import org.thingsboard.server.gen.transport.TransportProtos; | ||
48 | import org.thingsboard.server.queue.util.TbCoreComponent; | 48 | import org.thingsboard.server.queue.util.TbCoreComponent; |
49 | 49 | ||
50 | import java.util.ArrayList; | 50 | import java.util.ArrayList; |
51 | -import java.util.Collections; | ||
52 | import java.util.HashSet; | 51 | import java.util.HashSet; |
53 | import java.util.List; | 52 | import java.util.List; |
54 | import java.util.Set; | 53 | import java.util.Set; |
@@ -118,10 +117,10 @@ public class RelationEdgeProcessor extends BaseEdgeProcessor { | @@ -118,10 +117,10 @@ public class RelationEdgeProcessor extends BaseEdgeProcessor { | ||
118 | 117 | ||
119 | public DownlinkMsg processRelationToEdge(EdgeEvent edgeEvent, UpdateMsgType msgType) { | 118 | public DownlinkMsg processRelationToEdge(EdgeEvent edgeEvent, UpdateMsgType msgType) { |
120 | EntityRelation entityRelation = mapper.convertValue(edgeEvent.getBody(), EntityRelation.class); | 119 | EntityRelation entityRelation = mapper.convertValue(edgeEvent.getBody(), EntityRelation.class); |
121 | - RelationUpdateMsg r = relationMsgConstructor.constructRelationUpdatedMsg(msgType, entityRelation); | 120 | + RelationUpdateMsg relationUpdateMsg = relationMsgConstructor.constructRelationUpdatedMsg(msgType, entityRelation); |
122 | return DownlinkMsg.newBuilder() | 121 | return DownlinkMsg.newBuilder() |
123 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 122 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
124 | - .addAllRelationUpdateMsg(Collections.singletonList(r)) | 123 | + .addRelationUpdateMsg(relationUpdateMsg) |
125 | .build(); | 124 | .build(); |
126 | } | 125 | } |
127 | 126 |
@@ -30,8 +30,6 @@ import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; | @@ -30,8 +30,6 @@ import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; | ||
30 | import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | 30 | import org.thingsboard.server.gen.edge.v1.UpdateMsgType; |
31 | import org.thingsboard.server.queue.util.TbCoreComponent; | 31 | import org.thingsboard.server.queue.util.TbCoreComponent; |
32 | 32 | ||
33 | -import java.util.Collections; | ||
34 | - | ||
35 | @Component | 33 | @Component |
36 | @Slf4j | 34 | @Slf4j |
37 | @TbCoreComponent | 35 | @TbCoreComponent |
@@ -50,7 +48,7 @@ public class RuleChainEdgeProcessor extends BaseEdgeProcessor { | @@ -50,7 +48,7 @@ public class RuleChainEdgeProcessor extends BaseEdgeProcessor { | ||
50 | ruleChainMsgConstructor.constructRuleChainUpdatedMsg(edge.getRootRuleChainId(), msgType, ruleChain); | 48 | ruleChainMsgConstructor.constructRuleChainUpdatedMsg(edge.getRootRuleChainId(), msgType, ruleChain); |
51 | downlinkMsg = DownlinkMsg.newBuilder() | 49 | downlinkMsg = DownlinkMsg.newBuilder() |
52 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 50 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
53 | - .addAllRuleChainUpdateMsg(Collections.singletonList(ruleChainUpdateMsg)) | 51 | + .addRuleChainUpdateMsg(ruleChainUpdateMsg) |
54 | .build(); | 52 | .build(); |
55 | } | 53 | } |
56 | break; | 54 | break; |
@@ -58,7 +56,7 @@ public class RuleChainEdgeProcessor extends BaseEdgeProcessor { | @@ -58,7 +56,7 @@ public class RuleChainEdgeProcessor extends BaseEdgeProcessor { | ||
58 | case UNASSIGNED_FROM_EDGE: | 56 | case UNASSIGNED_FROM_EDGE: |
59 | downlinkMsg = DownlinkMsg.newBuilder() | 57 | downlinkMsg = DownlinkMsg.newBuilder() |
60 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 58 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
61 | - .addAllRuleChainUpdateMsg(Collections.singletonList(ruleChainMsgConstructor.constructRuleChainDeleteMsg(ruleChainId))) | 59 | + .addRuleChainUpdateMsg(ruleChainMsgConstructor.constructRuleChainDeleteMsg(ruleChainId)) |
62 | .build(); | 60 | .build(); |
63 | break; | 61 | break; |
64 | } | 62 | } |
@@ -76,7 +74,7 @@ public class RuleChainEdgeProcessor extends BaseEdgeProcessor { | @@ -76,7 +74,7 @@ public class RuleChainEdgeProcessor extends BaseEdgeProcessor { | ||
76 | if (ruleChainMetadataUpdateMsg != null) { | 74 | if (ruleChainMetadataUpdateMsg != null) { |
77 | downlinkMsg = DownlinkMsg.newBuilder() | 75 | downlinkMsg = DownlinkMsg.newBuilder() |
78 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 76 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
79 | - .addAllRuleChainMetadataUpdateMsg(Collections.singletonList(ruleChainMetadataUpdateMsg)) | 77 | + .addRuleChainMetadataUpdateMsg(ruleChainMetadataUpdateMsg) |
80 | .build(); | 78 | .build(); |
81 | } | 79 | } |
82 | } | 80 | } |
@@ -65,7 +65,6 @@ import org.thingsboard.server.queue.util.TbCoreComponent; | @@ -65,7 +65,6 @@ import org.thingsboard.server.queue.util.TbCoreComponent; | ||
65 | 65 | ||
66 | import javax.annotation.Nullable; | 66 | import javax.annotation.Nullable; |
67 | import java.util.ArrayList; | 67 | import java.util.ArrayList; |
68 | -import java.util.Collections; | ||
69 | import java.util.HashSet; | 68 | import java.util.HashSet; |
70 | import java.util.List; | 69 | import java.util.List; |
71 | import java.util.Set; | 70 | import java.util.Set; |
@@ -323,7 +322,7 @@ public class TelemetryEdgeProcessor extends BaseEdgeProcessor { | @@ -323,7 +322,7 @@ public class TelemetryEdgeProcessor extends BaseEdgeProcessor { | ||
323 | EntityDataProto entityDataProto = entityDataMsgConstructor.constructEntityDataMsg(entityId, actionType, entityData); | 322 | EntityDataProto entityDataProto = entityDataMsgConstructor.constructEntityDataMsg(entityId, actionType, entityData); |
324 | return DownlinkMsg.newBuilder() | 323 | return DownlinkMsg.newBuilder() |
325 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 324 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
326 | - .addAllEntityData(Collections.singletonList(entityDataProto)) | 325 | + .addEntityData(entityDataProto) |
327 | .build(); | 326 | .build(); |
328 | } | 327 | } |
329 | 328 |
@@ -30,8 +30,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | @@ -30,8 +30,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | ||
30 | import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; | 30 | import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; |
31 | import org.thingsboard.server.queue.util.TbCoreComponent; | 31 | import org.thingsboard.server.queue.util.TbCoreComponent; |
32 | 32 | ||
33 | -import java.util.Collections; | ||
34 | - | ||
35 | @Component | 33 | @Component |
36 | @Slf4j | 34 | @Slf4j |
37 | @TbCoreComponent | 35 | @TbCoreComponent |
@@ -48,14 +46,14 @@ public class UserEdgeProcessor extends BaseEdgeProcessor { | @@ -48,14 +46,14 @@ public class UserEdgeProcessor extends BaseEdgeProcessor { | ||
48 | CustomerId customerId = getCustomerIdIfEdgeAssignedToCustomer(user, edge); | 46 | CustomerId customerId = getCustomerIdIfEdgeAssignedToCustomer(user, edge); |
49 | downlinkMsg = DownlinkMsg.newBuilder() | 47 | downlinkMsg = DownlinkMsg.newBuilder() |
50 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 48 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
51 | - .addAllUserUpdateMsg(Collections.singletonList(userMsgConstructor.constructUserUpdatedMsg(msgType, user, customerId))) | 49 | + .addUserUpdateMsg(userMsgConstructor.constructUserUpdatedMsg(msgType, user, customerId)) |
52 | .build(); | 50 | .build(); |
53 | } | 51 | } |
54 | break; | 52 | break; |
55 | case DELETED: | 53 | case DELETED: |
56 | downlinkMsg = DownlinkMsg.newBuilder() | 54 | downlinkMsg = DownlinkMsg.newBuilder() |
57 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 55 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
58 | - .addAllUserUpdateMsg(Collections.singletonList(userMsgConstructor.constructUserDeleteMsg(userId))) | 56 | + .addUserUpdateMsg(userMsgConstructor.constructUserDeleteMsg(userId)) |
59 | .build(); | 57 | .build(); |
60 | break; | 58 | break; |
61 | case CREDENTIALS_UPDATED: | 59 | case CREDENTIALS_UPDATED: |
@@ -65,7 +63,7 @@ public class UserEdgeProcessor extends BaseEdgeProcessor { | @@ -65,7 +63,7 @@ public class UserEdgeProcessor extends BaseEdgeProcessor { | ||
65 | userMsgConstructor.constructUserCredentialsUpdatedMsg(userCredentialsByUserId); | 63 | userMsgConstructor.constructUserCredentialsUpdatedMsg(userCredentialsByUserId); |
66 | downlinkMsg = DownlinkMsg.newBuilder() | 64 | downlinkMsg = DownlinkMsg.newBuilder() |
67 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 65 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
68 | - .addAllUserCredentialsUpdateMsg(Collections.singletonList(userCredentialsUpdateMsg)) | 66 | + .addUserCredentialsUpdateMsg(userCredentialsUpdateMsg) |
69 | .build(); | 67 | .build(); |
70 | } | 68 | } |
71 | } | 69 | } |
@@ -27,8 +27,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | @@ -27,8 +27,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | ||
27 | import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; | 27 | import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; |
28 | import org.thingsboard.server.queue.util.TbCoreComponent; | 28 | import org.thingsboard.server.queue.util.TbCoreComponent; |
29 | 29 | ||
30 | -import java.util.Collections; | ||
31 | - | ||
32 | @Component | 30 | @Component |
33 | @Slf4j | 31 | @Slf4j |
34 | @TbCoreComponent | 32 | @TbCoreComponent |
@@ -46,7 +44,7 @@ public class WidgetBundleEdgeProcessor extends BaseEdgeProcessor { | @@ -46,7 +44,7 @@ public class WidgetBundleEdgeProcessor extends BaseEdgeProcessor { | ||
46 | widgetsBundleMsgConstructor.constructWidgetsBundleUpdateMsg(msgType, widgetsBundle); | 44 | widgetsBundleMsgConstructor.constructWidgetsBundleUpdateMsg(msgType, widgetsBundle); |
47 | downlinkMsg = DownlinkMsg.newBuilder() | 45 | downlinkMsg = DownlinkMsg.newBuilder() |
48 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 46 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
49 | - .addAllWidgetsBundleUpdateMsg(Collections.singletonList(widgetsBundleUpdateMsg)) | 47 | + .addWidgetsBundleUpdateMsg(widgetsBundleUpdateMsg) |
50 | .build(); | 48 | .build(); |
51 | } | 49 | } |
52 | break; | 50 | break; |
@@ -55,7 +53,7 @@ public class WidgetBundleEdgeProcessor extends BaseEdgeProcessor { | @@ -55,7 +53,7 @@ public class WidgetBundleEdgeProcessor extends BaseEdgeProcessor { | ||
55 | widgetsBundleMsgConstructor.constructWidgetsBundleDeleteMsg(widgetsBundleId); | 53 | widgetsBundleMsgConstructor.constructWidgetsBundleDeleteMsg(widgetsBundleId); |
56 | downlinkMsg = DownlinkMsg.newBuilder() | 54 | downlinkMsg = DownlinkMsg.newBuilder() |
57 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 55 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
58 | - .addAllWidgetsBundleUpdateMsg(Collections.singletonList(widgetsBundleUpdateMsg)) | 56 | + .addWidgetsBundleUpdateMsg(widgetsBundleUpdateMsg) |
59 | .build(); | 57 | .build(); |
60 | break; | 58 | break; |
61 | } | 59 | } |
@@ -27,8 +27,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | @@ -27,8 +27,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; | ||
27 | import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; | 27 | import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; |
28 | import org.thingsboard.server.queue.util.TbCoreComponent; | 28 | import org.thingsboard.server.queue.util.TbCoreComponent; |
29 | 29 | ||
30 | -import java.util.Collections; | ||
31 | - | ||
32 | @Component | 30 | @Component |
33 | @Slf4j | 31 | @Slf4j |
34 | @TbCoreComponent | 32 | @TbCoreComponent |
@@ -46,7 +44,7 @@ public class WidgetTypeEdgeProcessor extends BaseEdgeProcessor { | @@ -46,7 +44,7 @@ public class WidgetTypeEdgeProcessor extends BaseEdgeProcessor { | ||
46 | widgetTypeMsgConstructor.constructWidgetTypeUpdateMsg(msgType, widgetType); | 44 | widgetTypeMsgConstructor.constructWidgetTypeUpdateMsg(msgType, widgetType); |
47 | downlinkMsg = DownlinkMsg.newBuilder() | 45 | downlinkMsg = DownlinkMsg.newBuilder() |
48 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 46 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
49 | - .addAllWidgetTypeUpdateMsg(Collections.singletonList(widgetTypeUpdateMsg)) | 47 | + .addWidgetTypeUpdateMsg(widgetTypeUpdateMsg) |
50 | .build(); | 48 | .build(); |
51 | } | 49 | } |
52 | break; | 50 | break; |
@@ -55,7 +53,7 @@ public class WidgetTypeEdgeProcessor extends BaseEdgeProcessor { | @@ -55,7 +53,7 @@ public class WidgetTypeEdgeProcessor extends BaseEdgeProcessor { | ||
55 | widgetTypeMsgConstructor.constructWidgetTypeDeleteMsg(widgetTypeId); | 53 | widgetTypeMsgConstructor.constructWidgetTypeDeleteMsg(widgetTypeId); |
56 | downlinkMsg = DownlinkMsg.newBuilder() | 54 | downlinkMsg = DownlinkMsg.newBuilder() |
57 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) | 55 | .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) |
58 | - .addAllWidgetTypeUpdateMsg(Collections.singletonList(widgetTypeUpdateMsg)) | 56 | + .addWidgetTypeUpdateMsg(widgetTypeUpdateMsg) |
59 | .build(); | 57 | .build(); |
60 | break; | 58 | break; |
61 | } | 59 | } |