Commit 36b8bc452ac52f3045cdf966c694f40e588de982

Authored by Volodymyr Babak
1 parent 773d3806

Fixed issue if entity created

... ... @@ -93,7 +93,7 @@ public class AlarmController extends BaseController {
93 93 getCurrentUser().getCustomerId(),
94 94 alarm.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
95 95
96   - sendNotificationMsgToEdgeService(getTenantId(), savedAlarm.getId(),
  96 + sendNotificationMsgToEdgeService(getTenantId(), savedAlarm.getId(), EntityType.ALARM,
97 97 alarm.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
98 98
99 99 return savedAlarm;
... ... @@ -113,7 +113,7 @@ public class AlarmController extends BaseController {
113 113 AlarmId alarmId = new AlarmId(toUUID(strAlarmId));
114 114 checkAlarmId(alarmId, Operation.WRITE);
115 115
116   - sendNotificationMsgToEdgeService(getTenantId(), alarmId, EdgeEventActionType.DELETED);
  116 + sendNotificationMsgToEdgeService(getTenantId(), alarmId, EntityType.ALARM, EdgeEventActionType.DELETED);
117 117
118 118 return alarmService.deleteAlarm(getTenantId(), alarmId);
119 119 } catch (Exception e) {
... ... @@ -135,7 +135,7 @@ public class AlarmController extends BaseController {
135 135 alarm.setStatus(alarm.getStatus().isCleared() ? AlarmStatus.CLEARED_ACK : AlarmStatus.ACTIVE_ACK);
136 136 logEntityAction(alarmId, alarm, getCurrentUser().getCustomerId(), ActionType.ALARM_ACK, null);
137 137
138   - sendNotificationMsgToEdgeService(getTenantId(), alarmId, EdgeEventActionType.ALARM_ACK);
  138 + sendNotificationMsgToEdgeService(getTenantId(), alarmId, EntityType.ALARM, EdgeEventActionType.ALARM_ACK);
139 139 } catch (Exception e) {
140 140 throw handleException(e);
141 141 }
... ... @@ -155,7 +155,7 @@ public class AlarmController extends BaseController {
155 155 alarm.setStatus(alarm.getStatus().isAck() ? AlarmStatus.CLEARED_ACK : AlarmStatus.CLEARED_UNACK);
156 156 logEntityAction(alarmId, alarm, getCurrentUser().getCustomerId(), ActionType.ALARM_CLEAR, null);
157 157
158   - sendNotificationMsgToEdgeService(getTenantId(), alarmId, EdgeEventActionType.ALARM_CLEAR);
  158 + sendNotificationMsgToEdgeService(getTenantId(), alarmId, EntityType.ALARM, EdgeEventActionType.ALARM_CLEAR);
159 159 } catch (Exception e) {
160 160 throw handleException(e);
161 161 }
... ...
... ... @@ -92,7 +92,7 @@ public class AssetController extends BaseController {
92 92 asset.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
93 93
94 94 if (asset.getId() != null) {
95   - sendNotificationMsgToEdgeService(savedAsset.getTenantId(), savedAsset.getId(), EdgeEventActionType.UPDATED);
  95 + sendNotificationMsgToEdgeService(savedAsset.getTenantId(), savedAsset.getId(), EntityType.ASSET, EdgeEventActionType.UPDATED);
96 96 }
97 97
98 98 return savedAsset;
... ... @@ -117,7 +117,7 @@ public class AssetController extends BaseController {
117 117 asset.getCustomerId(),
118 118 ActionType.DELETED, null, strAssetId);
119 119
120   - sendNotificationMsgToEdgeService(getTenantId(), assetId, EdgeEventActionType.DELETED);
  120 + sendNotificationMsgToEdgeService(getTenantId(), assetId, EntityType.ASSET, EdgeEventActionType.DELETED);
121 121 } catch (Exception e) {
122 122 logEntityAction(emptyId(EntityType.ASSET),
123 123 null,
... ... @@ -366,7 +366,7 @@ public class AssetController extends BaseController {
366 366 savedAsset.getCustomerId(),
367 367 ActionType.ASSIGNED_TO_EDGE, null, strAssetId, strEdgeId, edge.getName());
368 368
369   - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), EdgeEventActionType.ASSIGNED_TO_EDGE);
  369 + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), EntityType.ASSET, EdgeEventActionType.ASSIGNED_TO_EDGE);
370 370
371 371 return savedAsset;
372 372 } catch (Exception e) {
... ... @@ -399,7 +399,7 @@ public class AssetController extends BaseController {
399 399 asset.getCustomerId(),
400 400 ActionType.UNASSIGNED_FROM_EDGE, null, strAssetId, strEdgeId, edge.getName());
401 401
402   - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), EdgeEventActionType.UNASSIGNED_FROM_EDGE);
  402 + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), EntityType.ASSET, EdgeEventActionType.UNASSIGNED_FROM_EDGE);
403 403
404 404 return savedAsset;
405 405 } catch (Exception e) {
... ...
... ... @@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
33 33 import org.springframework.web.bind.annotation.ResponseStatus;
34 34 import org.springframework.web.bind.annotation.RestController;
35 35 import org.thingsboard.rule.engine.api.MailService;
  36 +import org.thingsboard.server.common.data.EntityType;
36 37 import org.thingsboard.server.common.data.User;
37 38 import org.thingsboard.server.common.data.audit.ActionType;
38 39 import org.thingsboard.server.common.data.edge.EdgeEventActionType;
... ... @@ -127,7 +128,7 @@ public class AuthController extends BaseController {
127 128 userCredentials.setPassword(passwordEncoder.encode(newPassword));
128 129 userService.replaceUserCredentials(securityUser.getTenantId(), userCredentials);
129 130
130   - sendNotificationMsgToEdgeService(getTenantId(), userCredentials.getUserId(), EdgeEventActionType.CREDENTIALS_UPDATED);
  131 + sendNotificationMsgToEdgeService(getTenantId(), userCredentials.getUserId(), EntityType.USER, EdgeEventActionType.CREDENTIALS_UPDATED);
131 132
132 133 } catch (Exception e) {
133 134 throw handleException(e);
... ... @@ -237,7 +238,7 @@ public class AuthController extends BaseController {
237 238 }
238 239 }
239 240
240   - sendNotificationMsgToEdgeService(user.getTenantId(), user.getId(), EdgeEventActionType.CREDENTIALS_UPDATED);
  241 + sendNotificationMsgToEdgeService(user.getTenantId(), user.getId(), EntityType.USER, EdgeEventActionType.CREDENTIALS_UPDATED);
241 242
242 243 JwtToken accessToken = tokenFactory.createAccessJwtToken(securityUser);
243 244 JwtToken refreshToken = refreshTokenRepository.requestRefreshToken(securityUser);
... ...
... ... @@ -799,15 +799,15 @@ public abstract class BaseController {
799 799 }
800 800 }
801 801
802   - protected void sendNotificationMsgToEdgeService(TenantId tenantId, EntityId entityId, EdgeEventActionType action) {
803   - sendNotificationMsgToEdgeService(tenantId, null, entityId, action);
  802 + protected void sendNotificationMsgToEdgeService(TenantId tenantId, EntityId entityId, EntityType entityType, EdgeEventActionType action) {
  803 + sendNotificationMsgToEdgeService(tenantId, null, entityId, entityType, action);
804 804 }
805 805
806   - protected void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, EdgeEventActionType action) {
  806 + protected void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, EntityType entityType, EdgeEventActionType action) {
807 807 if (!edgesRpcEnabled) {
808 808 return;
809 809 }
810   - EdgeEventType type = EdgeUtils.getEdgeEventTypeByEntityType(entityId.getEntityType());
  810 + EdgeEventType type = EdgeUtils.getEdgeEventTypeByEntityType(entityType);
811 811 if (type != null) {
812 812 sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, null, type, action);
813 813 }
... ...
... ... @@ -110,7 +110,7 @@ public class CustomerController extends BaseController {
110 110 customer.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
111 111
112 112 if (customer.getId() != null) {
113   - sendNotificationMsgToEdgeService(savedCustomer.getTenantId(), savedCustomer.getId(), EdgeEventActionType.UPDATED);
  113 + sendNotificationMsgToEdgeService(savedCustomer.getTenantId(), savedCustomer.getId(), EntityType.CUSTOMER, EdgeEventActionType.UPDATED);
114 114 }
115 115
116 116 return savedCustomer;
... ... @@ -137,7 +137,7 @@ public class CustomerController extends BaseController {
137 137 customer.getId(),
138 138 ActionType.DELETED, null, strCustomerId);
139 139
140   - sendNotificationMsgToEdgeService(getTenantId(), customerId, EdgeEventActionType.DELETED);
  140 + sendNotificationMsgToEdgeService(getTenantId(), customerId, EntityType.CUSTOMER, EdgeEventActionType.DELETED);
141 141 } catch (Exception e) {
142 142
143 143 logEntityAction(emptyId(EntityType.CUSTOMER),
... ...
... ... @@ -117,7 +117,7 @@ public class DashboardController extends BaseController {
117 117 dashboard.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
118 118
119 119 if (dashboard.getId() != null) {
120   - sendNotificationMsgToEdgeService(savedDashboard.getTenantId(), savedDashboard.getId(), EdgeEventActionType.UPDATED);
  120 + sendNotificationMsgToEdgeService(savedDashboard.getTenantId(), savedDashboard.getId(), EntityType.DASHBOARD, EdgeEventActionType.UPDATED);
121 121 }
122 122
123 123 return savedDashboard;
... ... @@ -143,7 +143,7 @@ public class DashboardController extends BaseController {
143 143 null,
144 144 ActionType.DELETED, null, strDashboardId);
145 145
146   - sendNotificationMsgToEdgeService(getTenantId(), dashboardId, EdgeEventActionType.DELETED);
  146 + sendNotificationMsgToEdgeService(getTenantId(), dashboardId, EntityType.DASHBOARD, EdgeEventActionType.DELETED);
147 147 } catch (Exception e) {
148 148
149 149 logEntityAction(emptyId(EntityType.DASHBOARD),
... ... @@ -505,7 +505,7 @@ public class DashboardController extends BaseController {
505 505 null,
506 506 ActionType.ASSIGNED_TO_EDGE, null, strDashboardId, strEdgeId, edge.getName());
507 507
508   - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), EdgeEventActionType.ASSIGNED_TO_EDGE);
  508 + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), EntityType.DASHBOARD, EdgeEventActionType.ASSIGNED_TO_EDGE);
509 509
510 510 return savedDashboard;
511 511 } catch (Exception e) {
... ... @@ -537,7 +537,7 @@ public class DashboardController extends BaseController {
537 537 null,
538 538 ActionType.UNASSIGNED_FROM_EDGE, null, strDashboardId, strEdgeId, edge.getName());
539 539
540   - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), EdgeEventActionType.UNASSIGNED_FROM_EDGE);
  540 + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), EntityType.DASHBOARD, EdgeEventActionType.UNASSIGNED_FROM_EDGE);
541 541
542 542 return savedDashboard;
543 543 } catch (Exception e) {
... ...
... ... @@ -114,7 +114,7 @@ public class DeviceController extends BaseController {
114 114 savedDevice.getId(), savedDevice.getName(), savedDevice.getType()), null);
115 115
116 116 if (device.getId() != null) {
117   - sendNotificationMsgToEdgeService(savedDevice.getTenantId(), savedDevice.getId(), EdgeEventActionType.UPDATED);
  117 + sendNotificationMsgToEdgeService(savedDevice.getTenantId(), savedDevice.getId(), EntityType.DEVICE, EdgeEventActionType.UPDATED);
118 118 }
119 119
120 120 logEntityAction(savedDevice.getId(), savedDevice,
... ... @@ -148,7 +148,7 @@ public class DeviceController extends BaseController {
148 148 device.getCustomerId(),
149 149 ActionType.DELETED, null, strDeviceId);
150 150
151   - sendNotificationMsgToEdgeService(getTenantId(), deviceId, EdgeEventActionType.DELETED);
  151 + sendNotificationMsgToEdgeService(getTenantId(), deviceId, EntityType.DEVICE, EdgeEventActionType.DELETED);
152 152
153 153 deviceStateService.onDeviceDeleted(device);
154 154 } catch (Exception e) {
... ... @@ -279,7 +279,7 @@ public class DeviceController extends BaseController {
279 279
280 280 tbClusterService.pushMsgToCore(new DeviceCredentialsUpdateNotificationMsg(getCurrentUser().getTenantId(), deviceCredentials.getDeviceId()), null);
281 281
282   - sendNotificationMsgToEdgeService(getTenantId(), device.getId(), EdgeEventActionType.CREDENTIALS_UPDATED);
  282 + sendNotificationMsgToEdgeService(getTenantId(), device.getId(), EntityType.DEVICE, EdgeEventActionType.CREDENTIALS_UPDATED);
283 283
284 284 logEntityAction(device.getId(), device,
285 285 device.getCustomerId(),
... ... @@ -583,7 +583,7 @@ public class DeviceController extends BaseController {
583 583 savedDevice.getCustomerId(),
584 584 ActionType.ASSIGNED_TO_EDGE, null, strDeviceId, strEdgeId, edge.getName());
585 585
586   - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), EdgeEventActionType.ASSIGNED_TO_EDGE);
  586 + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), EntityType.DEVICE, EdgeEventActionType.ASSIGNED_TO_EDGE);
587 587
588 588 return savedDevice;
589 589 } catch (Exception e) {
... ... @@ -617,7 +617,7 @@ public class DeviceController extends BaseController {
617 617 device.getCustomerId(),
618 618 ActionType.UNASSIGNED_FROM_EDGE, null, strDeviceId, strEdgeId, edge.getName());
619 619
620   - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), EdgeEventActionType.UNASSIGNED_FROM_EDGE);
  620 + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), EntityType.DEVICE, EdgeEventActionType.UNASSIGNED_FROM_EDGE);
621 621
622 622 return savedDevice;
623 623 } catch (Exception e) {
... ...
... ... @@ -119,7 +119,7 @@ public class EntityViewController extends BaseController {
119 119 entityView.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
120 120
121 121 if (entityView.getId() != null) {
122   - sendNotificationMsgToEdgeService(savedEntityView.getTenantId(), savedEntityView.getId(), EdgeEventActionType.UPDATED);
  122 + sendNotificationMsgToEdgeService(savedEntityView.getTenantId(), savedEntityView.getId(), EntityType.ENTITY_VIEW, EdgeEventActionType.UPDATED);
123 123 }
124 124
125 125 return savedEntityView;
... ... @@ -192,7 +192,7 @@ public class EntityViewController extends BaseController {
192 192 logEntityAction(entityViewId, entityView, entityView.getCustomerId(),
193 193 ActionType.DELETED, null, strEntityViewId);
194 194
195   - sendNotificationMsgToEdgeService(getTenantId(), entityViewId, EdgeEventActionType.DELETED);
  195 + sendNotificationMsgToEdgeService(getTenantId(), entityViewId, EntityType.ENTITY_VIEW, EdgeEventActionType.DELETED);
196 196 } catch (Exception e) {
197 197 logEntityAction(emptyId(EntityType.ENTITY_VIEW),
198 198 null,
... ... @@ -405,7 +405,7 @@ public class EntityViewController extends BaseController {
405 405 savedEntityView.getCustomerId(),
406 406 ActionType.ASSIGNED_TO_EDGE, null, strEntityViewId, strEdgeId, edge.getName());
407 407
408   - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), EdgeEventActionType.ASSIGNED_TO_EDGE);
  408 + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), EntityType.ENTITY_VIEW, EdgeEventActionType.ASSIGNED_TO_EDGE);
409 409
410 410 return savedEntityView;
411 411 } catch (Exception e) {
... ... @@ -435,7 +435,7 @@ public class EntityViewController extends BaseController {
435 435 entityView.getCustomerId(),
436 436 ActionType.UNASSIGNED_FROM_EDGE, null, strEntityViewId, strEdgeId, edge.getName());
437 437
438   - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), EdgeEventActionType.UNASSIGNED_FROM_EDGE);
  438 + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), EntityType.ENTITY_VIEW, EdgeEventActionType.UNASSIGNED_FROM_EDGE);
439 439
440 440 return savedEntityView;
441 441 } catch (Exception e) {
... ...
... ... @@ -146,7 +146,7 @@ public class RuleChainController extends BaseController {
146 146
147 147 if (RuleChainType.EDGE.equals(savedRuleChain.getType())) {
148 148 if (!created) {
149   - sendNotificationMsgToEdgeService(savedRuleChain.getTenantId(), savedRuleChain.getId(), EdgeEventActionType.UPDATED);
  149 + sendNotificationMsgToEdgeService(savedRuleChain.getTenantId(), savedRuleChain.getId(), EntityType.RULE_CHAIN, EdgeEventActionType.UPDATED);
150 150 }
151 151 }
152 152
... ... @@ -226,7 +226,7 @@ public class RuleChainController extends BaseController {
226 226
227 227 if (RuleChainType.EDGE.equals(ruleChain.getType())) {
228 228 sendNotificationMsgToEdgeService(ruleChain.getTenantId(),
229   - ruleChain.getId(), EdgeEventActionType.UPDATED);
  229 + ruleChain.getId(), EntityType.RULE_CHAIN, EdgeEventActionType.UPDATED);
230 230 }
231 231
232 232 return savedRuleChainMetaData;
... ... @@ -290,7 +290,7 @@ public class RuleChainController extends BaseController {
290 290 ActionType.DELETED, null, strRuleChainId);
291 291
292 292 if (RuleChainType.EDGE.equals(ruleChain.getType())) {
293   - sendNotificationMsgToEdgeService(ruleChain.getTenantId(), ruleChain.getId(), EdgeEventActionType.DELETED);
  293 + sendNotificationMsgToEdgeService(ruleChain.getTenantId(), ruleChain.getId(), EntityType.RULE_CHAIN, EdgeEventActionType.DELETED);
294 294 }
295 295
296 296 } catch (Exception e) {
... ... @@ -422,7 +422,7 @@ public class RuleChainController extends BaseController {
422 422 null,
423 423 ActionType.ASSIGNED_TO_EDGE, null, strRuleChainId, strEdgeId, edge.getName());
424 424
425   - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), EdgeEventActionType.ASSIGNED_TO_EDGE);
  425 + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), EntityType.RULE_CHAIN, EdgeEventActionType.ASSIGNED_TO_EDGE);
426 426
427 427 return savedRuleChain;
428 428 } catch (Exception e) {
... ... @@ -454,7 +454,7 @@ public class RuleChainController extends BaseController {
454 454 null,
455 455 ActionType.UNASSIGNED_FROM_EDGE, null, strRuleChainId, strEdgeId, edge.getName());
456 456
457   - sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), EdgeEventActionType.UNASSIGNED_FROM_EDGE);
  457 + sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), EntityType.RULE_CHAIN, EdgeEventActionType.UNASSIGNED_FROM_EDGE);
458 458
459 459 return savedRuleChain;
460 460 } catch (Exception e) {
... ...
... ... @@ -166,7 +166,7 @@ public class UserController extends BaseController {
166 166 savedUser.getCustomerId(),
167 167 user.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
168 168
169   - sendNotificationMsgToEdgeService(getTenantId(), savedUser.getId(),
  169 + sendNotificationMsgToEdgeService(getTenantId(), savedUser.getId(), EntityType.USER,
170 170 user.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
171 171
172 172 return savedUser;
... ... @@ -244,7 +244,7 @@ public class UserController extends BaseController {
244 244 user.getCustomerId(),
245 245 ActionType.DELETED, null, strUserId);
246 246
247   - sendNotificationMsgToEdgeService(getTenantId(), user.getId(), EdgeEventActionType.DELETED);
  247 + sendNotificationMsgToEdgeService(getTenantId(), user.getId(), EntityType.USER, EdgeEventActionType.DELETED);
248 248
249 249 } catch (Exception e) {
250 250 logEntityAction(emptyId(EntityType.USER),
... ...
... ... @@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam;
26 26 import org.springframework.web.bind.annotation.ResponseBody;
27 27 import org.springframework.web.bind.annotation.ResponseStatus;
28 28 import org.springframework.web.bind.annotation.RestController;
  29 +import org.thingsboard.server.common.data.EntityType;
29 30 import org.thingsboard.server.common.data.audit.ActionType;
30 31 import org.thingsboard.server.common.data.edge.EdgeEventActionType;
31 32 import org.thingsboard.server.common.data.exception.ThingsboardException;
... ... @@ -73,7 +74,7 @@ public class WidgetTypeController extends BaseController {
73 74 checkEntity(widgetType.getId(), widgetType, Resource.WIDGET_TYPE);
74 75 WidgetType savedWidgetType = widgetTypeService.saveWidgetType(widgetType);
75 76
76   - sendNotificationMsgToEdgeService(getTenantId(), savedWidgetType.getId(),
  77 + sendNotificationMsgToEdgeService(getTenantId(), savedWidgetType.getId(), EntityType.WIDGET_TYPE,
77 78 widgetType.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
78 79
79 80 return checkNotNull(savedWidgetType);
... ... @@ -92,7 +93,7 @@ public class WidgetTypeController extends BaseController {
92 93 checkWidgetTypeId(widgetTypeId, Operation.DELETE);
93 94 widgetTypeService.deleteWidgetType(getCurrentUser().getTenantId(), widgetTypeId);
94 95
95   - sendNotificationMsgToEdgeService(getTenantId(), widgetTypeId, EdgeEventActionType.DELETED);
  96 + sendNotificationMsgToEdgeService(getTenantId(), widgetTypeId, EntityType.WIDGET_TYPE, EdgeEventActionType.DELETED);
96 97
97 98 } catch (Exception e) {
98 99 throw handleException(e);
... ...
... ... @@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestParam;
25 25 import org.springframework.web.bind.annotation.ResponseBody;
26 26 import org.springframework.web.bind.annotation.ResponseStatus;
27 27 import org.springframework.web.bind.annotation.RestController;
  28 +import org.thingsboard.server.common.data.EntityType;
28 29 import org.thingsboard.server.common.data.audit.ActionType;
29 30 import org.thingsboard.server.common.data.edge.EdgeEventActionType;
30 31 import org.thingsboard.server.common.data.exception.ThingsboardException;
... ... @@ -72,7 +73,7 @@ public class WidgetsBundleController extends BaseController {
72 73 checkEntity(widgetsBundle.getId(), widgetsBundle, Resource.WIDGETS_BUNDLE);
73 74 WidgetsBundle savedWidgetsBundle = widgetsBundleService.saveWidgetsBundle(widgetsBundle);
74 75
75   - sendNotificationMsgToEdgeService(getTenantId(), savedWidgetsBundle.getId(),
  76 + sendNotificationMsgToEdgeService(getTenantId(), savedWidgetsBundle.getId(), EntityType.WIDGETS_BUNDLE,
76 77 widgetsBundle.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
77 78
78 79 return checkNotNull(savedWidgetsBundle);
... ... @@ -91,7 +92,7 @@ public class WidgetsBundleController extends BaseController {
91 92 checkWidgetsBundleId(widgetsBundleId, Operation.DELETE);
92 93 widgetsBundleService.deleteWidgetsBundle(getTenantId(), widgetsBundleId);
93 94
94   - sendNotificationMsgToEdgeService(getTenantId(), widgetsBundleId, EdgeEventActionType.DELETED);
  95 + sendNotificationMsgToEdgeService(getTenantId(), widgetsBundleId, EntityType.WIDGETS_BUNDLE, EdgeEventActionType.DELETED);
95 96
96 97 } catch (Exception e) {
97 98 throw handleException(e);
... ...