Browse Source

Changed method usage - single set instead of collection

pull/4918/head
Volodymyr Babak 5 years ago
parent
commit
94bc3e2d1b
  1. 6
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/AdminSettingsEdgeProcessor.java
  2. 3
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/AlarmEdgeProcessor.java
  3. 6
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/AssetEdgeProcessor.java
  4. 5
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/CustomerEdgeProcessor.java
  5. 4
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/DashboardEdgeProcessor.java
  6. 9
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/DeviceEdgeProcessor.java
  7. 6
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/DeviceProfileEdgeProcessor.java
  8. 7
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EntityEdgeProcessor.java
  9. 6
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EntityViewEdgeProcessor.java
  10. 5
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/RelationEdgeProcessor.java
  11. 8
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/RuleChainEdgeProcessor.java
  12. 3
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/TelemetryEdgeProcessor.java
  13. 8
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/UserEdgeProcessor.java
  14. 6
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/WidgetBundleEdgeProcessor.java
  15. 6
      application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/WidgetTypeEdgeProcessor.java

6
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/AdminSettingsEdgeProcessor.java

@ -24,8 +24,6 @@ import org.thingsboard.server.gen.edge.v1.AdminSettingsUpdateMsg;
import org.thingsboard.server.gen.edge.v1.DownlinkMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.Collections;
@Component @Component
@Slf4j @Slf4j
@TbCoreComponent @TbCoreComponent
@ -33,10 +31,10 @@ public class AdminSettingsEdgeProcessor extends BaseEdgeProcessor {
public DownlinkMsg processAdminSettingsToEdge(EdgeEvent edgeEvent) { public DownlinkMsg processAdminSettingsToEdge(EdgeEvent edgeEvent) {
AdminSettings adminSettings = mapper.convertValue(edgeEvent.getBody(), AdminSettings.class); AdminSettings adminSettings = mapper.convertValue(edgeEvent.getBody(), AdminSettings.class);
AdminSettingsUpdateMsg t = adminSettingsMsgConstructor.constructAdminSettingsUpdateMsg(adminSettings); AdminSettingsUpdateMsg adminSettingsUpdateMsg = adminSettingsMsgConstructor.constructAdminSettingsUpdateMsg(adminSettings);
return DownlinkMsg.newBuilder() return DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllAdminSettingsUpdateMsg(Collections.singletonList(t)) .addAdminSettingsUpdateMsg(adminSettingsUpdateMsg)
.build(); .build();
} }

3
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/AlarmEdgeProcessor.java

@ -42,7 +42,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.gen.transport.TransportProtos;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.Collections;
import java.util.UUID; import java.util.UUID;
@Component @Component
@ -122,7 +121,7 @@ public class AlarmEdgeProcessor extends BaseEdgeProcessor {
if (alarm != null) { if (alarm != null) {
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllAlarmUpdateMsg(Collections.singletonList(alarmMsgConstructor.constructAlarmUpdatedMsg(edge.getTenantId(), msgType, alarm))) .addAlarmUpdateMsg(alarmMsgConstructor.constructAlarmUpdatedMsg(edge.getTenantId(), msgType, alarm))
.build(); .build();
} }
} catch (Exception e) { } catch (Exception e) {

6
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/AssetEdgeProcessor.java

@ -29,8 +29,6 @@ import org.thingsboard.server.gen.edge.v1.DownlinkMsg;
import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.Collections;
@Component @Component
@Slf4j @Slf4j
@TbCoreComponent @TbCoreComponent
@ -52,7 +50,7 @@ public class AssetEdgeProcessor extends BaseEdgeProcessor {
assetMsgConstructor.constructAssetUpdatedMsg(msgType, asset, customerId); assetMsgConstructor.constructAssetUpdatedMsg(msgType, asset, customerId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllAssetUpdateMsg(Collections.singletonList(assetUpdateMsg)) .addAssetUpdateMsg(assetUpdateMsg)
.build(); .build();
} }
break; break;
@ -62,7 +60,7 @@ public class AssetEdgeProcessor extends BaseEdgeProcessor {
assetMsgConstructor.constructAssetDeleteMsg(assetId); assetMsgConstructor.constructAssetDeleteMsg(assetId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllAssetUpdateMsg(Collections.singletonList(assetUpdateMsg)) .addAssetUpdateMsg(assetUpdateMsg)
.build(); .build();
break; break;
} }

5
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/CustomerEdgeProcessor.java

@ -35,7 +35,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.gen.transport.TransportProtos;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.Collections;
import java.util.UUID; import java.util.UUID;
@Component @Component
@ -55,7 +54,7 @@ public class CustomerEdgeProcessor extends BaseEdgeProcessor {
customerMsgConstructor.constructCustomerUpdatedMsg(msgType, customer); customerMsgConstructor.constructCustomerUpdatedMsg(msgType, customer);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllCustomerUpdateMsg(Collections.singletonList(customerUpdateMsg)) .addCustomerUpdateMsg(customerUpdateMsg)
.build(); .build();
} }
break; break;
@ -64,7 +63,7 @@ public class CustomerEdgeProcessor extends BaseEdgeProcessor {
customerMsgConstructor.constructCustomerDeleteMsg(customerId); customerMsgConstructor.constructCustomerDeleteMsg(customerId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllCustomerUpdateMsg(Collections.singletonList(customerUpdateMsg)) .addCustomerUpdateMsg(customerUpdateMsg)
.build(); .build();
break; break;
} }

4
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/DashboardEdgeProcessor.java

@ -55,7 +55,7 @@ public class DashboardEdgeProcessor extends BaseEdgeProcessor {
dashboardMsgConstructor.constructDashboardUpdatedMsg(msgType, dashboard, customerId); dashboardMsgConstructor.constructDashboardUpdatedMsg(msgType, dashboard, customerId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllDashboardUpdateMsg(Collections.singletonList(dashboardUpdateMsg)) .addDashboardUpdateMsg(dashboardUpdateMsg)
.build(); .build();
} }
break; break;
@ -65,7 +65,7 @@ public class DashboardEdgeProcessor extends BaseEdgeProcessor {
dashboardMsgConstructor.constructDashboardDeleteMsg(dashboardId); dashboardMsgConstructor.constructDashboardDeleteMsg(dashboardId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllDashboardUpdateMsg(Collections.singletonList(dashboardUpdateMsg)) .addDashboardUpdateMsg(dashboardUpdateMsg)
.build(); .build();
break; break;
} }

9
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/DeviceEdgeProcessor.java

@ -63,7 +63,6 @@ import org.thingsboard.server.queue.util.TbCoreComponent;
import org.thingsboard.server.service.rpc.FromDeviceRpcResponse; import org.thingsboard.server.service.rpc.FromDeviceRpcResponse;
import org.thingsboard.server.service.rpc.FromDeviceRpcResponseActorMsg; import org.thingsboard.server.service.rpc.FromDeviceRpcResponseActorMsg;
import java.util.Collections;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
@ -340,7 +339,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor {
deviceMsgConstructor.constructDeviceUpdatedMsg(msgType, device, customerId, null); deviceMsgConstructor.constructDeviceUpdatedMsg(msgType, device, customerId, null);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllDeviceUpdateMsg(Collections.singletonList(deviceUpdateMsg)) .addDeviceUpdateMsg(deviceUpdateMsg)
.build(); .build();
} }
break; break;
@ -350,7 +349,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor {
deviceMsgConstructor.constructDeviceDeleteMsg(deviceId); deviceMsgConstructor.constructDeviceDeleteMsg(deviceId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllDeviceUpdateMsg(Collections.singletonList(deviceUpdateMsg)) .addDeviceUpdateMsg(deviceUpdateMsg)
.build(); .build();
break; break;
case CREDENTIALS_UPDATED: case CREDENTIALS_UPDATED:
@ -360,7 +359,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor {
deviceMsgConstructor.constructDeviceCredentialsUpdatedMsg(deviceCredentials); deviceMsgConstructor.constructDeviceCredentialsUpdatedMsg(deviceCredentials);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllDeviceCredentialsUpdateMsg(Collections.singletonList(deviceCredentialsUpdateMsg)) .addDeviceCredentialsUpdateMsg(deviceCredentialsUpdateMsg)
.build(); .build();
} }
break; break;
@ -374,7 +373,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor {
deviceMsgConstructor.constructDeviceRpcCallMsg(edgeEvent.getEntityId(), edgeEvent.getBody()); deviceMsgConstructor.constructDeviceRpcCallMsg(edgeEvent.getEntityId(), edgeEvent.getBody());
return DownlinkMsg.newBuilder() return DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllDeviceRpcCallMsg(Collections.singletonList(deviceRpcCallMsg)) .addDeviceRpcCallMsg(deviceRpcCallMsg)
.build(); .build();
} }
} }

6
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/DeviceProfileEdgeProcessor.java

@ -27,8 +27,6 @@ import org.thingsboard.server.gen.edge.v1.DownlinkMsg;
import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.Collections;
@Component @Component
@Slf4j @Slf4j
@TbCoreComponent @TbCoreComponent
@ -46,7 +44,7 @@ public class DeviceProfileEdgeProcessor extends BaseEdgeProcessor {
deviceProfileMsgConstructor.constructDeviceProfileUpdatedMsg(msgType, deviceProfile); deviceProfileMsgConstructor.constructDeviceProfileUpdatedMsg(msgType, deviceProfile);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllDeviceProfileUpdateMsg(Collections.singletonList(deviceProfileUpdateMsg)) .addDeviceProfileUpdateMsg(deviceProfileUpdateMsg)
.build(); .build();
} }
break; break;
@ -55,7 +53,7 @@ public class DeviceProfileEdgeProcessor extends BaseEdgeProcessor {
deviceProfileMsgConstructor.constructDeviceProfileDeleteMsg(deviceProfileId); deviceProfileMsgConstructor.constructDeviceProfileDeleteMsg(deviceProfileId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllDeviceProfileUpdateMsg(Collections.singletonList(deviceProfileUpdateMsg)) .addDeviceProfileUpdateMsg(deviceProfileUpdateMsg)
.build(); .build();
break; break;
} }

7
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;
import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.gen.transport.TransportProtos;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -64,11 +63,11 @@ public class EntityEdgeProcessor extends BaseEdgeProcessor {
if(edgeEvent.getBody() != null) { if(edgeEvent.getBody() != null) {
conflictName = edgeEvent.getBody().get("conflictName").asText(); conflictName = edgeEvent.getBody().get("conflictName").asText();
} }
DeviceUpdateMsg d = deviceMsgConstructor DeviceUpdateMsg deviceUpdateMsg = deviceMsgConstructor
.constructDeviceUpdatedMsg(UpdateMsgType.ENTITY_MERGE_RPC_MESSAGE, device, customerId, conflictName); .constructDeviceUpdatedMsg(UpdateMsgType.ENTITY_MERGE_RPC_MESSAGE, device, customerId, conflictName);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllDeviceUpdateMsg(Collections.singletonList(d)) .addDeviceUpdateMsg(deviceUpdateMsg)
.build(); .build();
} }
return downlinkMsg; return downlinkMsg;
@ -84,7 +83,7 @@ public class EntityEdgeProcessor extends BaseEdgeProcessor {
.build(); .build();
DownlinkMsg.Builder builder = DownlinkMsg.newBuilder() DownlinkMsg.Builder builder = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllDeviceCredentialsRequestMsg(Collections.singletonList(deviceCredentialsRequestMsg)); .addDeviceCredentialsRequestMsg(deviceCredentialsRequestMsg);
downlinkMsg = builder.build(); downlinkMsg = builder.build();
} }
return downlinkMsg; return downlinkMsg;

6
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EntityViewEdgeProcessor.java

@ -29,8 +29,6 @@ import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg;
import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.Collections;
@Component @Component
@Slf4j @Slf4j
@TbCoreComponent @TbCoreComponent
@ -52,7 +50,7 @@ public class EntityViewEdgeProcessor extends BaseEdgeProcessor {
entityViewMsgConstructor.constructEntityViewUpdatedMsg(msgType, entityView, customerId); entityViewMsgConstructor.constructEntityViewUpdatedMsg(msgType, entityView, customerId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllEntityViewUpdateMsg(Collections.singletonList(entityViewUpdateMsg)) .addEntityViewUpdateMsg(entityViewUpdateMsg)
.build(); .build();
} }
break; break;
@ -62,7 +60,7 @@ public class EntityViewEdgeProcessor extends BaseEdgeProcessor {
entityViewMsgConstructor.constructEntityViewDeleteMsg(entityViewId); entityViewMsgConstructor.constructEntityViewDeleteMsg(entityViewId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllEntityViewUpdateMsg(Collections.singletonList(entityViewUpdateMsg)) .addEntityViewUpdateMsg(entityViewUpdateMsg)
.build(); .build();
break; break;
} }

5
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/RelationEdgeProcessor.java

@ -48,7 +48,6 @@ import org.thingsboard.server.gen.transport.TransportProtos;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -118,10 +117,10 @@ public class RelationEdgeProcessor extends BaseEdgeProcessor {
public DownlinkMsg processRelationToEdge(EdgeEvent edgeEvent, UpdateMsgType msgType) { public DownlinkMsg processRelationToEdge(EdgeEvent edgeEvent, UpdateMsgType msgType) {
EntityRelation entityRelation = mapper.convertValue(edgeEvent.getBody(), EntityRelation.class); EntityRelation entityRelation = mapper.convertValue(edgeEvent.getBody(), EntityRelation.class);
RelationUpdateMsg r = relationMsgConstructor.constructRelationUpdatedMsg(msgType, entityRelation); RelationUpdateMsg relationUpdateMsg = relationMsgConstructor.constructRelationUpdatedMsg(msgType, entityRelation);
return DownlinkMsg.newBuilder() return DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllRelationUpdateMsg(Collections.singletonList(r)) .addRelationUpdateMsg(relationUpdateMsg)
.build(); .build();
} }

8
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/RuleChainEdgeProcessor.java

@ -30,8 +30,6 @@ import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg;
import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.Collections;
@Component @Component
@Slf4j @Slf4j
@TbCoreComponent @TbCoreComponent
@ -50,7 +48,7 @@ public class RuleChainEdgeProcessor extends BaseEdgeProcessor {
ruleChainMsgConstructor.constructRuleChainUpdatedMsg(edge.getRootRuleChainId(), msgType, ruleChain); ruleChainMsgConstructor.constructRuleChainUpdatedMsg(edge.getRootRuleChainId(), msgType, ruleChain);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllRuleChainUpdateMsg(Collections.singletonList(ruleChainUpdateMsg)) .addRuleChainUpdateMsg(ruleChainUpdateMsg)
.build(); .build();
} }
break; break;
@ -58,7 +56,7 @@ public class RuleChainEdgeProcessor extends BaseEdgeProcessor {
case UNASSIGNED_FROM_EDGE: case UNASSIGNED_FROM_EDGE:
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllRuleChainUpdateMsg(Collections.singletonList(ruleChainMsgConstructor.constructRuleChainDeleteMsg(ruleChainId))) .addRuleChainUpdateMsg(ruleChainMsgConstructor.constructRuleChainDeleteMsg(ruleChainId))
.build(); .build();
break; break;
} }
@ -76,7 +74,7 @@ public class RuleChainEdgeProcessor extends BaseEdgeProcessor {
if (ruleChainMetadataUpdateMsg != null) { if (ruleChainMetadataUpdateMsg != null) {
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllRuleChainMetadataUpdateMsg(Collections.singletonList(ruleChainMetadataUpdateMsg)) .addRuleChainMetadataUpdateMsg(ruleChainMetadataUpdateMsg)
.build(); .build();
} }
} }

3
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/TelemetryEdgeProcessor.java

@ -65,7 +65,6 @@ import org.thingsboard.server.queue.util.TbCoreComponent;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -323,7 +322,7 @@ public class TelemetryEdgeProcessor extends BaseEdgeProcessor {
EntityDataProto entityDataProto = entityDataMsgConstructor.constructEntityDataMsg(entityId, actionType, entityData); EntityDataProto entityDataProto = entityDataMsgConstructor.constructEntityDataMsg(entityId, actionType, entityData);
return DownlinkMsg.newBuilder() return DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllEntityData(Collections.singletonList(entityDataProto)) .addEntityData(entityDataProto)
.build(); .build();
} }

8
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/UserEdgeProcessor.java

@ -30,8 +30,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.Collections;
@Component @Component
@Slf4j @Slf4j
@TbCoreComponent @TbCoreComponent
@ -48,14 +46,14 @@ public class UserEdgeProcessor extends BaseEdgeProcessor {
CustomerId customerId = getCustomerIdIfEdgeAssignedToCustomer(user, edge); CustomerId customerId = getCustomerIdIfEdgeAssignedToCustomer(user, edge);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllUserUpdateMsg(Collections.singletonList(userMsgConstructor.constructUserUpdatedMsg(msgType, user, customerId))) .addUserUpdateMsg(userMsgConstructor.constructUserUpdatedMsg(msgType, user, customerId))
.build(); .build();
} }
break; break;
case DELETED: case DELETED:
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllUserUpdateMsg(Collections.singletonList(userMsgConstructor.constructUserDeleteMsg(userId))) .addUserUpdateMsg(userMsgConstructor.constructUserDeleteMsg(userId))
.build(); .build();
break; break;
case CREDENTIALS_UPDATED: case CREDENTIALS_UPDATED:
@ -65,7 +63,7 @@ public class UserEdgeProcessor extends BaseEdgeProcessor {
userMsgConstructor.constructUserCredentialsUpdatedMsg(userCredentialsByUserId); userMsgConstructor.constructUserCredentialsUpdatedMsg(userCredentialsByUserId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllUserCredentialsUpdateMsg(Collections.singletonList(userCredentialsUpdateMsg)) .addUserCredentialsUpdateMsg(userCredentialsUpdateMsg)
.build(); .build();
} }
} }

6
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/WidgetBundleEdgeProcessor.java

@ -27,8 +27,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.Collections;
@Component @Component
@Slf4j @Slf4j
@TbCoreComponent @TbCoreComponent
@ -46,7 +44,7 @@ public class WidgetBundleEdgeProcessor extends BaseEdgeProcessor {
widgetsBundleMsgConstructor.constructWidgetsBundleUpdateMsg(msgType, widgetsBundle); widgetsBundleMsgConstructor.constructWidgetsBundleUpdateMsg(msgType, widgetsBundle);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllWidgetsBundleUpdateMsg(Collections.singletonList(widgetsBundleUpdateMsg)) .addWidgetsBundleUpdateMsg(widgetsBundleUpdateMsg)
.build(); .build();
} }
break; break;
@ -55,7 +53,7 @@ public class WidgetBundleEdgeProcessor extends BaseEdgeProcessor {
widgetsBundleMsgConstructor.constructWidgetsBundleDeleteMsg(widgetsBundleId); widgetsBundleMsgConstructor.constructWidgetsBundleDeleteMsg(widgetsBundleId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllWidgetsBundleUpdateMsg(Collections.singletonList(widgetsBundleUpdateMsg)) .addWidgetsBundleUpdateMsg(widgetsBundleUpdateMsg)
.build(); .build();
break; break;
} }

6
application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/WidgetTypeEdgeProcessor.java

@ -27,8 +27,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import java.util.Collections;
@Component @Component
@Slf4j @Slf4j
@TbCoreComponent @TbCoreComponent
@ -46,7 +44,7 @@ public class WidgetTypeEdgeProcessor extends BaseEdgeProcessor {
widgetTypeMsgConstructor.constructWidgetTypeUpdateMsg(msgType, widgetType); widgetTypeMsgConstructor.constructWidgetTypeUpdateMsg(msgType, widgetType);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllWidgetTypeUpdateMsg(Collections.singletonList(widgetTypeUpdateMsg)) .addWidgetTypeUpdateMsg(widgetTypeUpdateMsg)
.build(); .build();
} }
break; break;
@ -55,7 +53,7 @@ public class WidgetTypeEdgeProcessor extends BaseEdgeProcessor {
widgetTypeMsgConstructor.constructWidgetTypeDeleteMsg(widgetTypeId); widgetTypeMsgConstructor.constructWidgetTypeDeleteMsg(widgetTypeId);
downlinkMsg = DownlinkMsg.newBuilder() downlinkMsg = DownlinkMsg.newBuilder()
.setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .setDownlinkMsgId(EdgeUtils.nextPositiveInt())
.addAllWidgetTypeUpdateMsg(Collections.singletonList(widgetTypeUpdateMsg)) .addWidgetTypeUpdateMsg(widgetTypeUpdateMsg)
.build(); .build();
break; break;
} }

Loading…
Cancel
Save