Commit 117547ae6b239f728406860c2230bb748678e8b9
1 parent
f1517376
Fixed relation propagation to edge. Code review improvements
Showing
12 changed files
with
47 additions
and
50 deletions
@@ -92,7 +92,8 @@ public class AlarmController extends BaseController { | @@ -92,7 +92,8 @@ public class AlarmController extends BaseController { | ||
92 | getCurrentUser().getCustomerId(), | 92 | getCurrentUser().getCustomerId(), |
93 | alarm.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); | 93 | alarm.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); |
94 | 94 | ||
95 | - sendNotificationMsgToEdgeService(getTenantId(), savedAlarm.getId(), alarm.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | 95 | + sendNotificationMsgToEdgeService(getTenantId(), savedAlarm.getId(), |
96 | + alarm.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | ||
96 | 97 | ||
97 | return savedAlarm; | 98 | return savedAlarm; |
98 | } catch (Exception e) { | 99 | } catch (Exception e) { |
@@ -88,13 +88,13 @@ public class AssetController extends BaseController { | @@ -88,13 +88,13 @@ public class AssetController extends BaseController { | ||
88 | 88 | ||
89 | Asset savedAsset = checkNotNull(assetService.saveAsset(asset)); | 89 | Asset savedAsset = checkNotNull(assetService.saveAsset(asset)); |
90 | 90 | ||
91 | - sendNotificationMsgToEdgeService(savedAsset.getTenantId(), null, | ||
92 | - savedAsset.getId(), EdgeEventType.ASSET, asset.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | ||
93 | - | ||
94 | logEntityAction(savedAsset.getId(), savedAsset, | 91 | logEntityAction(savedAsset.getId(), savedAsset, |
95 | savedAsset.getCustomerId(), | 92 | savedAsset.getCustomerId(), |
96 | asset.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); | 93 | asset.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); |
97 | 94 | ||
95 | + sendNotificationMsgToEdgeService(getTenantId(), savedAsset.getId(), | ||
96 | + asset.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | ||
97 | + | ||
98 | return savedAsset; | 98 | return savedAsset; |
99 | } catch (Exception e) { | 99 | } catch (Exception e) { |
100 | logEntityAction(emptyId(EntityType.ASSET), asset, | 100 | logEntityAction(emptyId(EntityType.ASSET), asset, |
@@ -117,7 +117,7 @@ public class AssetController extends BaseController { | @@ -117,7 +117,7 @@ public class AssetController extends BaseController { | ||
117 | asset.getCustomerId(), | 117 | asset.getCustomerId(), |
118 | ActionType.DELETED, null, strAssetId); | 118 | ActionType.DELETED, null, strAssetId); |
119 | 119 | ||
120 | - sendNotificationMsgToEdgeService(getTenantId(), null, assetId, EdgeEventType.ASSET, ActionType.DELETED); | 120 | + sendNotificationMsgToEdgeService(getTenantId(), assetId, ActionType.DELETED); |
121 | } catch (Exception e) { | 121 | } catch (Exception e) { |
122 | logEntityAction(emptyId(EntityType.ASSET), | 122 | logEntityAction(emptyId(EntityType.ASSET), |
123 | null, | 123 | null, |
@@ -360,7 +360,7 @@ public class AssetController extends BaseController { | @@ -360,7 +360,7 @@ public class AssetController extends BaseController { | ||
360 | savedAsset.getCustomerId(), | 360 | savedAsset.getCustomerId(), |
361 | ActionType.ASSIGNED_TO_EDGE, null, strAssetId, strEdgeId, edge.getName()); | 361 | ActionType.ASSIGNED_TO_EDGE, null, strAssetId, strEdgeId, edge.getName()); |
362 | 362 | ||
363 | - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), EdgeEventType.ASSET, ActionType.ASSIGNED_TO_EDGE); | 363 | + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), ActionType.ASSIGNED_TO_EDGE); |
364 | 364 | ||
365 | return savedAsset; | 365 | return savedAsset; |
366 | } catch (Exception e) { | 366 | } catch (Exception e) { |
@@ -393,8 +393,7 @@ public class AssetController extends BaseController { | @@ -393,8 +393,7 @@ public class AssetController extends BaseController { | ||
393 | asset.getCustomerId(), | 393 | asset.getCustomerId(), |
394 | ActionType.UNASSIGNED_FROM_EDGE, null, strAssetId, edge.getId().toString(), edge.getName()); | 394 | ActionType.UNASSIGNED_FROM_EDGE, null, strAssetId, edge.getId().toString(), edge.getName()); |
395 | 395 | ||
396 | - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), | ||
397 | - EdgeEventType.ASSET, ActionType.UNASSIGNED_FROM_EDGE); | 396 | + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), ActionType.UNASSIGNED_FROM_EDGE); |
398 | 397 | ||
399 | return savedAsset; | 398 | return savedAsset; |
400 | } catch (Exception e) { | 399 | } catch (Exception e) { |
@@ -126,7 +126,7 @@ public class AuthController extends BaseController { | @@ -126,7 +126,7 @@ public class AuthController extends BaseController { | ||
126 | userCredentials.setPassword(passwordEncoder.encode(newPassword)); | 126 | userCredentials.setPassword(passwordEncoder.encode(newPassword)); |
127 | userService.replaceUserCredentials(securityUser.getTenantId(), userCredentials); | 127 | userService.replaceUserCredentials(securityUser.getTenantId(), userCredentials); |
128 | 128 | ||
129 | - sendNotificationMsgToEdgeService(getTenantId(), null, userCredentials.getUserId(), EdgeEventType.USER, ActionType.CREDENTIALS_UPDATED); | 129 | + sendNotificationMsgToEdgeService(getTenantId(), userCredentials.getUserId(), ActionType.CREDENTIALS_UPDATED); |
130 | 130 | ||
131 | } catch (Exception e) { | 131 | } catch (Exception e) { |
132 | throw handleException(e); | 132 | throw handleException(e); |
@@ -730,16 +730,16 @@ public abstract class BaseController { | @@ -730,16 +730,16 @@ public abstract class BaseController { | ||
730 | } | 730 | } |
731 | 731 | ||
732 | protected void sendNotificationMsgToEdgeService(TenantId tenantId, EntityId entityId, ActionType edgeEventAction) { | 732 | protected void sendNotificationMsgToEdgeService(TenantId tenantId, EntityId entityId, ActionType edgeEventAction) { |
733 | + sendNotificationMsgToEdgeService(tenantId, null, entityId, edgeEventAction); | ||
734 | + } | ||
735 | + | ||
736 | + protected void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, ActionType edgeEventAction) { | ||
733 | EdgeEventType edgeEventType = EdgeUtils.getEdgeEventTypeByEntityType(entityId.getEntityType()); | 737 | EdgeEventType edgeEventType = EdgeUtils.getEdgeEventTypeByEntityType(entityId.getEntityType()); |
734 | if (edgeEventType != null) { | 738 | if (edgeEventType != null) { |
735 | - sendNotificationMsgToEdgeService(tenantId, null, entityId, null, edgeEventType, edgeEventAction); | 739 | + sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, null, edgeEventType, edgeEventAction); |
736 | } | 740 | } |
737 | } | 741 | } |
738 | 742 | ||
739 | - protected void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, EdgeEventType edgeEventType, ActionType edgeEventAction) { | ||
740 | - sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, null, edgeEventType, edgeEventAction); | ||
741 | - } | ||
742 | - | ||
743 | private void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, String entityBody, EdgeEventType edgeEventType, ActionType edgeEventAction) { | 743 | private void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, String entityBody, EdgeEventType edgeEventType, ActionType edgeEventAction) { |
744 | TransportProtos.EdgeNotificationMsgProto.Builder builder = TransportProtos.EdgeNotificationMsgProto.newBuilder(); | 744 | TransportProtos.EdgeNotificationMsgProto.Builder builder = TransportProtos.EdgeNotificationMsgProto.newBuilder(); |
745 | builder.setTenantIdMSB(tenantId.getId().getMostSignificantBits()); | 745 | builder.setTenantIdMSB(tenantId.getId().getMostSignificantBits()); |
@@ -117,8 +117,8 @@ public class DashboardController extends BaseController { | @@ -117,8 +117,8 @@ public class DashboardController extends BaseController { | ||
117 | null, | 117 | null, |
118 | dashboard.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); | 118 | dashboard.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); |
119 | 119 | ||
120 | - sendNotificationMsgToEdgeService(savedDashboard.getTenantId(), null, savedDashboard.getId(), | ||
121 | - EdgeEventType.DASHBOARD, savedDashboard.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | 120 | + sendNotificationMsgToEdgeService(savedDashboard.getTenantId(), savedDashboard.getId(), |
121 | + dashboard.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | ||
122 | 122 | ||
123 | return savedDashboard; | 123 | return savedDashboard; |
124 | } catch (Exception e) { | 124 | } catch (Exception e) { |
@@ -143,7 +143,7 @@ public class DashboardController extends BaseController { | @@ -143,7 +143,7 @@ public class DashboardController extends BaseController { | ||
143 | null, | 143 | null, |
144 | ActionType.DELETED, null, strDashboardId); | 144 | ActionType.DELETED, null, strDashboardId); |
145 | 145 | ||
146 | - sendNotificationMsgToEdgeService(getTenantId(), null, dashboardId, EdgeEventType.DASHBOARD, ActionType.DELETED); | 146 | + sendNotificationMsgToEdgeService(getTenantId(), dashboardId, ActionType.DELETED); |
147 | } catch (Exception e) { | 147 | } catch (Exception e) { |
148 | 148 | ||
149 | logEntityAction(emptyId(EntityType.DASHBOARD), | 149 | logEntityAction(emptyId(EntityType.DASHBOARD), |
@@ -500,8 +500,7 @@ public class DashboardController extends BaseController { | @@ -500,8 +500,7 @@ public class DashboardController extends BaseController { | ||
500 | null, | 500 | null, |
501 | ActionType.ASSIGNED_TO_EDGE, null, strDashboardId, strEdgeId, edge.getName()); | 501 | ActionType.ASSIGNED_TO_EDGE, null, strDashboardId, strEdgeId, edge.getName()); |
502 | 502 | ||
503 | - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), | ||
504 | - EdgeEventType.DASHBOARD, ActionType.ASSIGNED_TO_EDGE); | 503 | + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), ActionType.ASSIGNED_TO_EDGE); |
505 | 504 | ||
506 | return savedDashboard; | 505 | return savedDashboard; |
507 | } catch (Exception e) { | 506 | } catch (Exception e) { |
@@ -533,8 +532,7 @@ public class DashboardController extends BaseController { | @@ -533,8 +532,7 @@ public class DashboardController extends BaseController { | ||
533 | null, | 532 | null, |
534 | ActionType.UNASSIGNED_FROM_EDGE, null, strDashboardId, edge.getId().toString(), edge.getName()); | 533 | ActionType.UNASSIGNED_FROM_EDGE, null, strDashboardId, edge.getId().toString(), edge.getName()); |
535 | 534 | ||
536 | - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), | ||
537 | - EdgeEventType.DASHBOARD, ActionType.UNASSIGNED_FROM_EDGE); | 535 | + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), ActionType.UNASSIGNED_FROM_EDGE); |
538 | 536 | ||
539 | return savedDashboard; | 537 | return savedDashboard; |
540 | } catch (Exception e) { | 538 | } catch (Exception e) { |
@@ -108,8 +108,8 @@ public class DeviceController extends BaseController { | @@ -108,8 +108,8 @@ public class DeviceController extends BaseController { | ||
108 | tbClusterService.pushMsgToCore(new DeviceNameOrTypeUpdateMsg(savedDevice.getTenantId(), | 108 | tbClusterService.pushMsgToCore(new DeviceNameOrTypeUpdateMsg(savedDevice.getTenantId(), |
109 | savedDevice.getId(), savedDevice.getName(), savedDevice.getType()), null); | 109 | savedDevice.getId(), savedDevice.getName(), savedDevice.getType()), null); |
110 | 110 | ||
111 | - sendNotificationMsgToEdgeService(savedDevice.getTenantId(), null, savedDevice.getId(), | ||
112 | - EdgeEventType.DEVICE, device.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | 111 | + sendNotificationMsgToEdgeService(savedDevice.getTenantId(), savedDevice.getId(), |
112 | + device.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | ||
113 | 113 | ||
114 | logEntityAction(savedDevice.getId(), savedDevice, | 114 | logEntityAction(savedDevice.getId(), savedDevice, |
115 | savedDevice.getCustomerId(), | 115 | savedDevice.getCustomerId(), |
@@ -142,7 +142,7 @@ public class DeviceController extends BaseController { | @@ -142,7 +142,7 @@ public class DeviceController extends BaseController { | ||
142 | device.getCustomerId(), | 142 | device.getCustomerId(), |
143 | ActionType.DELETED, null, strDeviceId); | 143 | ActionType.DELETED, null, strDeviceId); |
144 | 144 | ||
145 | - sendNotificationMsgToEdgeService(getTenantId(), null, deviceId, EdgeEventType.DEVICE, ActionType.DELETED); | 145 | + sendNotificationMsgToEdgeService(getTenantId(), deviceId, ActionType.DELETED); |
146 | 146 | ||
147 | deviceStateService.onDeviceDeleted(device); | 147 | deviceStateService.onDeviceDeleted(device); |
148 | } catch (Exception e) { | 148 | } catch (Exception e) { |
@@ -267,7 +267,7 @@ public class DeviceController extends BaseController { | @@ -267,7 +267,7 @@ public class DeviceController extends BaseController { | ||
267 | 267 | ||
268 | tbClusterService.pushMsgToCore(new DeviceCredentialsUpdateNotificationMsg(getCurrentUser().getTenantId(), deviceCredentials.getDeviceId()), null); | 268 | tbClusterService.pushMsgToCore(new DeviceCredentialsUpdateNotificationMsg(getCurrentUser().getTenantId(), deviceCredentials.getDeviceId()), null); |
269 | 269 | ||
270 | - sendNotificationMsgToEdgeService(getTenantId(), null, device.getId(), EdgeEventType.DEVICE, ActionType.CREDENTIALS_UPDATED); | 270 | + sendNotificationMsgToEdgeService(getTenantId(), device.getId(), ActionType.CREDENTIALS_UPDATED); |
271 | 271 | ||
272 | logEntityAction(device.getId(), device, | 272 | logEntityAction(device.getId(), device, |
273 | device.getCustomerId(), | 273 | device.getCustomerId(), |
@@ -518,7 +518,7 @@ public class DeviceController extends BaseController { | @@ -518,7 +518,7 @@ public class DeviceController extends BaseController { | ||
518 | savedDevice.getCustomerId(), | 518 | savedDevice.getCustomerId(), |
519 | ActionType.ASSIGNED_TO_EDGE, null, strDeviceId, strEdgeId, edge.getName()); | 519 | ActionType.ASSIGNED_TO_EDGE, null, strDeviceId, strEdgeId, edge.getName()); |
520 | 520 | ||
521 | - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), EdgeEventType.DEVICE, ActionType.ASSIGNED_TO_EDGE); | 521 | + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), ActionType.ASSIGNED_TO_EDGE); |
522 | 522 | ||
523 | return savedDevice; | 523 | return savedDevice; |
524 | } catch (Exception e) { | 524 | } catch (Exception e) { |
@@ -549,7 +549,7 @@ public class DeviceController extends BaseController { | @@ -549,7 +549,7 @@ public class DeviceController extends BaseController { | ||
549 | device.getCustomerId(), | 549 | device.getCustomerId(), |
550 | ActionType.UNASSIGNED_FROM_EDGE, null, strDeviceId, edge.getId().toString(), edge.getName()); | 550 | ActionType.UNASSIGNED_FROM_EDGE, null, strDeviceId, edge.getId().toString(), edge.getName()); |
551 | 551 | ||
552 | - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), EdgeEventType.DEVICE, ActionType.UNASSIGNED_FROM_EDGE); | 552 | + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), ActionType.UNASSIGNED_FROM_EDGE); |
553 | 553 | ||
554 | return savedDevice; | 554 | return savedDevice; |
555 | } catch (Exception e) { | 555 | } catch (Exception e) { |
@@ -118,8 +118,8 @@ public class EntityViewController extends BaseController { | @@ -118,8 +118,8 @@ public class EntityViewController extends BaseController { | ||
118 | logEntityAction(savedEntityView.getId(), savedEntityView, null, | 118 | logEntityAction(savedEntityView.getId(), savedEntityView, null, |
119 | entityView.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); | 119 | entityView.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); |
120 | 120 | ||
121 | - sendNotificationMsgToEdgeService(getTenantId(), null, savedEntityView.getId(), | ||
122 | - EdgeEventType.ENTITY_VIEW, entityView.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | 121 | + sendNotificationMsgToEdgeService(getTenantId(), savedEntityView.getId(), |
122 | + entityView.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | ||
123 | return savedEntityView; | 123 | return savedEntityView; |
124 | } catch (Exception e) { | 124 | } catch (Exception e) { |
125 | logEntityAction(emptyId(EntityType.ENTITY_VIEW), entityView, null, | 125 | logEntityAction(emptyId(EntityType.ENTITY_VIEW), entityView, null, |
@@ -190,7 +190,7 @@ public class EntityViewController extends BaseController { | @@ -190,7 +190,7 @@ public class EntityViewController extends BaseController { | ||
190 | logEntityAction(entityViewId, entityView, entityView.getCustomerId(), | 190 | logEntityAction(entityViewId, entityView, entityView.getCustomerId(), |
191 | ActionType.DELETED, null, strEntityViewId); | 191 | ActionType.DELETED, null, strEntityViewId); |
192 | 192 | ||
193 | - sendNotificationMsgToEdgeService(getTenantId(), null, entityViewId, EdgeEventType.ENTITY_VIEW, ActionType.DELETED); | 193 | + sendNotificationMsgToEdgeService(getTenantId(), entityViewId, ActionType.DELETED); |
194 | } catch (Exception e) { | 194 | } catch (Exception e) { |
195 | logEntityAction(emptyId(EntityType.ENTITY_VIEW), | 195 | logEntityAction(emptyId(EntityType.ENTITY_VIEW), |
196 | null, | 196 | null, |
@@ -396,8 +396,7 @@ public class EntityViewController extends BaseController { | @@ -396,8 +396,7 @@ public class EntityViewController extends BaseController { | ||
396 | savedEntityView.getCustomerId(), | 396 | savedEntityView.getCustomerId(), |
397 | ActionType.ASSIGNED_TO_EDGE, null, strEntityViewId, strEdgeId, edge.getName()); | 397 | ActionType.ASSIGNED_TO_EDGE, null, strEntityViewId, strEdgeId, edge.getName()); |
398 | 398 | ||
399 | - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), | ||
400 | - EdgeEventType.ENTITY_VIEW, ActionType.ASSIGNED_TO_EDGE); | 399 | + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), ActionType.ASSIGNED_TO_EDGE); |
401 | 400 | ||
402 | return savedEntityView; | 401 | return savedEntityView; |
403 | } catch (Exception e) { | 402 | } catch (Exception e) { |
@@ -427,8 +426,7 @@ public class EntityViewController extends BaseController { | @@ -427,8 +426,7 @@ public class EntityViewController extends BaseController { | ||
427 | entityView.getCustomerId(), | 426 | entityView.getCustomerId(), |
428 | ActionType.UNASSIGNED_FROM_EDGE, null, strEntityViewId, edge.getId().toString(), edge.getName()); | 427 | ActionType.UNASSIGNED_FROM_EDGE, null, strEntityViewId, edge.getId().toString(), edge.getName()); |
429 | 428 | ||
430 | - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), | ||
431 | - EdgeEventType.ENTITY_VIEW, ActionType.UNASSIGNED_FROM_EDGE); | 429 | + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), ActionType.UNASSIGNED_FROM_EDGE); |
432 | 430 | ||
433 | return savedEntityView; | 431 | return savedEntityView; |
434 | } catch (Exception e) { | 432 | } catch (Exception e) { |
@@ -145,9 +145,8 @@ public class RuleChainController extends BaseController { | @@ -145,9 +145,8 @@ public class RuleChainController extends BaseController { | ||
145 | created ? ActionType.ADDED : ActionType.UPDATED, null); | 145 | created ? ActionType.ADDED : ActionType.UPDATED, null); |
146 | 146 | ||
147 | if (RuleChainType.EDGE.equals(savedRuleChain.getType())) { | 147 | if (RuleChainType.EDGE.equals(savedRuleChain.getType())) { |
148 | - sendNotificationMsgToEdgeService(savedRuleChain.getTenantId(), null, | ||
149 | - savedRuleChain.getId(), EdgeEventType.RULE_CHAIN, | ||
150 | - savedRuleChain.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | 148 | + sendNotificationMsgToEdgeService(savedRuleChain.getTenantId(), savedRuleChain.getId(), |
149 | + created ? ActionType.ADDED : ActionType.UPDATED); | ||
151 | } | 150 | } |
152 | 151 | ||
153 | return savedRuleChain; | 152 | return savedRuleChain; |
@@ -226,9 +225,7 @@ public class RuleChainController extends BaseController { | @@ -226,9 +225,7 @@ public class RuleChainController extends BaseController { | ||
226 | 225 | ||
227 | if (RuleChainType.EDGE.equals(ruleChain.getType())) { | 226 | if (RuleChainType.EDGE.equals(ruleChain.getType())) { |
228 | sendNotificationMsgToEdgeService(ruleChain.getTenantId(), | 227 | sendNotificationMsgToEdgeService(ruleChain.getTenantId(), |
229 | - null, | ||
230 | - ruleChain.getId(), EdgeEventType.RULE_CHAIN, | ||
231 | - ActionType.UPDATED); | 228 | + ruleChain.getId(), ActionType.UPDATED); |
232 | } | 229 | } |
233 | 230 | ||
234 | return savedRuleChainMetaData; | 231 | return savedRuleChainMetaData; |
@@ -293,8 +290,7 @@ public class RuleChainController extends BaseController { | @@ -293,8 +290,7 @@ public class RuleChainController extends BaseController { | ||
293 | ActionType.DELETED, null, strRuleChainId); | 290 | ActionType.DELETED, null, strRuleChainId); |
294 | 291 | ||
295 | if (RuleChainType.EDGE.equals(ruleChain.getType())) { | 292 | if (RuleChainType.EDGE.equals(ruleChain.getType())) { |
296 | - sendNotificationMsgToEdgeService(ruleChain.getTenantId(), null, | ||
297 | - ruleChain.getId(), EdgeEventType.RULE_CHAIN, ActionType.DELETED); | 293 | + sendNotificationMsgToEdgeService(ruleChain.getTenantId(), ruleChain.getId(), ActionType.DELETED); |
298 | } | 294 | } |
299 | 295 | ||
300 | } catch (Exception e) { | 296 | } catch (Exception e) { |
@@ -426,8 +422,7 @@ public class RuleChainController extends BaseController { | @@ -426,8 +422,7 @@ public class RuleChainController extends BaseController { | ||
426 | null, | 422 | null, |
427 | ActionType.ASSIGNED_TO_EDGE, null, strRuleChainId, strEdgeId, edge.getName()); | 423 | ActionType.ASSIGNED_TO_EDGE, null, strRuleChainId, strEdgeId, edge.getName()); |
428 | 424 | ||
429 | - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), | ||
430 | - EdgeEventType.RULE_CHAIN, ActionType.ASSIGNED_TO_EDGE); | 425 | + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), ActionType.ASSIGNED_TO_EDGE); |
431 | 426 | ||
432 | return savedRuleChain; | 427 | return savedRuleChain; |
433 | } catch (Exception e) { | 428 | } catch (Exception e) { |
@@ -459,8 +454,7 @@ public class RuleChainController extends BaseController { | @@ -459,8 +454,7 @@ public class RuleChainController extends BaseController { | ||
459 | null, | 454 | null, |
460 | ActionType.UNASSIGNED_FROM_EDGE, null, strRuleChainId, edge.getId().toString(), edge.getName()); | 455 | ActionType.UNASSIGNED_FROM_EDGE, null, strRuleChainId, edge.getId().toString(), edge.getName()); |
461 | 456 | ||
462 | - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), | ||
463 | - EdgeEventType.RULE_CHAIN, ActionType.UNASSIGNED_FROM_EDGE); | 457 | + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), ActionType.UNASSIGNED_FROM_EDGE); |
464 | 458 | ||
465 | return savedRuleChain; | 459 | return savedRuleChain; |
466 | } catch (Exception e) { | 460 | } catch (Exception e) { |
@@ -162,7 +162,8 @@ public class UserController extends BaseController { | @@ -162,7 +162,8 @@ public class UserController extends BaseController { | ||
162 | savedUser.getCustomerId(), | 162 | savedUser.getCustomerId(), |
163 | user.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); | 163 | user.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null); |
164 | 164 | ||
165 | - sendNotificationMsgToEdgeService(getTenantId(), null, user.getId(), EdgeEventType.USER, user.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | 165 | + sendNotificationMsgToEdgeService(getTenantId(), savedUser.getId(), |
166 | + user.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | ||
166 | 167 | ||
167 | return savedUser; | 168 | return savedUser; |
168 | } catch (Exception e) { | 169 | } catch (Exception e) { |
@@ -239,7 +240,7 @@ public class UserController extends BaseController { | @@ -239,7 +240,7 @@ public class UserController extends BaseController { | ||
239 | user.getCustomerId(), | 240 | user.getCustomerId(), |
240 | ActionType.DELETED, null, strUserId); | 241 | ActionType.DELETED, null, strUserId); |
241 | 242 | ||
242 | - sendNotificationMsgToEdgeService(getTenantId(), null, user.getId(), EdgeEventType.USER, ActionType.DELETED); | 243 | + sendNotificationMsgToEdgeService(getTenantId(), user.getId(), ActionType.DELETED); |
243 | 244 | ||
244 | } catch (Exception e) { | 245 | } catch (Exception e) { |
245 | logEntityAction(emptyId(EntityType.USER), | 246 | logEntityAction(emptyId(EntityType.USER), |
@@ -72,7 +72,8 @@ public class WidgetTypeController extends BaseController { | @@ -72,7 +72,8 @@ public class WidgetTypeController extends BaseController { | ||
72 | checkEntity(widgetType.getId(), widgetType, Resource.WIDGET_TYPE); | 72 | checkEntity(widgetType.getId(), widgetType, Resource.WIDGET_TYPE); |
73 | WidgetType savedWidgetType = widgetTypeService.saveWidgetType(widgetType); | 73 | WidgetType savedWidgetType = widgetTypeService.saveWidgetType(widgetType); |
74 | 74 | ||
75 | - sendNotificationMsgToEdgeService(getTenantId(), savedWidgetType.getId(), widgetType.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | 75 | + sendNotificationMsgToEdgeService(getTenantId(), savedWidgetType.getId(), |
76 | + widgetType.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | ||
76 | 77 | ||
77 | return checkNotNull(savedWidgetType); | 78 | return checkNotNull(savedWidgetType); |
78 | } catch (Exception e) { | 79 | } catch (Exception e) { |
@@ -71,7 +71,8 @@ public class WidgetsBundleController extends BaseController { | @@ -71,7 +71,8 @@ public class WidgetsBundleController extends BaseController { | ||
71 | checkEntity(widgetsBundle.getId(), widgetsBundle, Resource.WIDGETS_BUNDLE); | 71 | checkEntity(widgetsBundle.getId(), widgetsBundle, Resource.WIDGETS_BUNDLE); |
72 | WidgetsBundle savedWidgetsBundle = widgetsBundleService.saveWidgetsBundle(widgetsBundle); | 72 | WidgetsBundle savedWidgetsBundle = widgetsBundleService.saveWidgetsBundle(widgetsBundle); |
73 | 73 | ||
74 | - sendNotificationMsgToEdgeService(getTenantId(), savedWidgetsBundle.getId(), widgetsBundle.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | 74 | + sendNotificationMsgToEdgeService(getTenantId(), savedWidgetsBundle.getId(), |
75 | + widgetsBundle.getId() == null ? ActionType.ADDED : ActionType.UPDATED); | ||
75 | 76 | ||
76 | return checkNotNull(savedWidgetsBundle); | 77 | return checkNotNull(savedWidgetsBundle); |
77 | } catch (Exception e) { | 78 | } catch (Exception e) { |
@@ -234,6 +234,8 @@ public final class EdgeGrpcSession implements Closeable { | @@ -234,6 +234,8 @@ public final class EdgeGrpcSession implements Closeable { | ||
234 | case ALARM_ACK: | 234 | case ALARM_ACK: |
235 | case ALARM_CLEAR: | 235 | case ALARM_CLEAR: |
236 | case CREDENTIALS_UPDATED: | 236 | case CREDENTIALS_UPDATED: |
237 | + case RELATION_ADD_OR_UPDATE: | ||
238 | + case RELATION_DELETED: | ||
237 | processEntityMessage(edgeEvent, edgeEventAction); | 239 | processEntityMessage(edgeEvent, edgeEventAction); |
238 | break; | 240 | break; |
239 | case ATTRIBUTES_UPDATED: | 241 | case ATTRIBUTES_UPDATED: |
@@ -687,9 +689,11 @@ public final class EdgeGrpcSession implements Closeable { | @@ -687,9 +689,11 @@ public final class EdgeGrpcSession implements Closeable { | ||
687 | return UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE; | 689 | return UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE; |
688 | case ADDED: | 690 | case ADDED: |
689 | case ASSIGNED_TO_EDGE: | 691 | case ASSIGNED_TO_EDGE: |
692 | + case RELATION_ADD_OR_UPDATE: | ||
690 | return ENTITY_CREATED_RPC_MESSAGE; | 693 | return ENTITY_CREATED_RPC_MESSAGE; |
691 | case DELETED: | 694 | case DELETED: |
692 | case UNASSIGNED_FROM_EDGE: | 695 | case UNASSIGNED_FROM_EDGE: |
696 | + case RELATION_DELETED: | ||
693 | return UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE; | 697 | return UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE; |
694 | case ALARM_ACK: | 698 | case ALARM_ACK: |
695 | return UpdateMsgType.ALARM_ACK_RPC_MESSAGE; | 699 | return UpdateMsgType.ALARM_ACK_RPC_MESSAGE; |