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