Fixed issue if entity created
This commit is contained in:
parent
773d38067b
commit
36b8bc452a
@ -93,7 +93,7 @@ public class AlarmController extends BaseController {
|
|||||||
getCurrentUser().getCustomerId(),
|
getCurrentUser().getCustomerId(),
|
||||||
alarm.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
alarm.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), savedAlarm.getId(),
|
sendNotificationMsgToEdgeService(getTenantId(), savedAlarm.getId(), EntityType.ALARM,
|
||||||
alarm.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
|
alarm.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
|
||||||
|
|
||||||
return savedAlarm;
|
return savedAlarm;
|
||||||
@ -113,7 +113,7 @@ public class AlarmController extends BaseController {
|
|||||||
AlarmId alarmId = new AlarmId(toUUID(strAlarmId));
|
AlarmId alarmId = new AlarmId(toUUID(strAlarmId));
|
||||||
checkAlarmId(alarmId, Operation.WRITE);
|
checkAlarmId(alarmId, Operation.WRITE);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), alarmId, EdgeEventActionType.DELETED);
|
sendNotificationMsgToEdgeService(getTenantId(), alarmId, EntityType.ALARM, EdgeEventActionType.DELETED);
|
||||||
|
|
||||||
return alarmService.deleteAlarm(getTenantId(), alarmId);
|
return alarmService.deleteAlarm(getTenantId(), alarmId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -135,7 +135,7 @@ public class AlarmController extends BaseController {
|
|||||||
alarm.setStatus(alarm.getStatus().isCleared() ? AlarmStatus.CLEARED_ACK : AlarmStatus.ACTIVE_ACK);
|
alarm.setStatus(alarm.getStatus().isCleared() ? AlarmStatus.CLEARED_ACK : AlarmStatus.ACTIVE_ACK);
|
||||||
logEntityAction(alarmId, alarm, getCurrentUser().getCustomerId(), ActionType.ALARM_ACK, null);
|
logEntityAction(alarmId, alarm, getCurrentUser().getCustomerId(), ActionType.ALARM_ACK, null);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), alarmId, EdgeEventActionType.ALARM_ACK);
|
sendNotificationMsgToEdgeService(getTenantId(), alarmId, EntityType.ALARM, EdgeEventActionType.ALARM_ACK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ public class AlarmController extends BaseController {
|
|||||||
alarm.setStatus(alarm.getStatus().isAck() ? AlarmStatus.CLEARED_ACK : AlarmStatus.CLEARED_UNACK);
|
alarm.setStatus(alarm.getStatus().isAck() ? AlarmStatus.CLEARED_ACK : AlarmStatus.CLEARED_UNACK);
|
||||||
logEntityAction(alarmId, alarm, getCurrentUser().getCustomerId(), ActionType.ALARM_CLEAR, null);
|
logEntityAction(alarmId, alarm, getCurrentUser().getCustomerId(), ActionType.ALARM_CLEAR, null);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), alarmId, EdgeEventActionType.ALARM_CLEAR);
|
sendNotificationMsgToEdgeService(getTenantId(), alarmId, EntityType.ALARM, EdgeEventActionType.ALARM_CLEAR);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,7 +92,7 @@ public class AssetController extends BaseController {
|
|||||||
asset.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
asset.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
||||||
|
|
||||||
if (asset.getId() != null) {
|
if (asset.getId() != null) {
|
||||||
sendNotificationMsgToEdgeService(savedAsset.getTenantId(), savedAsset.getId(), EdgeEventActionType.UPDATED);
|
sendNotificationMsgToEdgeService(savedAsset.getTenantId(), savedAsset.getId(), EntityType.ASSET, EdgeEventActionType.UPDATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return savedAsset;
|
return savedAsset;
|
||||||
@ -117,7 +117,7 @@ public class AssetController extends BaseController {
|
|||||||
asset.getCustomerId(),
|
asset.getCustomerId(),
|
||||||
ActionType.DELETED, null, strAssetId);
|
ActionType.DELETED, null, strAssetId);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), assetId, EdgeEventActionType.DELETED);
|
sendNotificationMsgToEdgeService(getTenantId(), assetId, EntityType.ASSET, EdgeEventActionType.DELETED);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logEntityAction(emptyId(EntityType.ASSET),
|
logEntityAction(emptyId(EntityType.ASSET),
|
||||||
null,
|
null,
|
||||||
@ -366,7 +366,7 @@ public class AssetController extends BaseController {
|
|||||||
savedAsset.getCustomerId(),
|
savedAsset.getCustomerId(),
|
||||||
ActionType.ASSIGNED_TO_EDGE, null, strAssetId, strEdgeId, edge.getName());
|
ActionType.ASSIGNED_TO_EDGE, null, strAssetId, strEdgeId, edge.getName());
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), EdgeEventActionType.ASSIGNED_TO_EDGE);
|
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), EntityType.ASSET, EdgeEventActionType.ASSIGNED_TO_EDGE);
|
||||||
|
|
||||||
return savedAsset;
|
return savedAsset;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -399,7 +399,7 @@ public class AssetController extends BaseController {
|
|||||||
asset.getCustomerId(),
|
asset.getCustomerId(),
|
||||||
ActionType.UNASSIGNED_FROM_EDGE, null, strAssetId, strEdgeId, edge.getName());
|
ActionType.UNASSIGNED_FROM_EDGE, null, strAssetId, strEdgeId, edge.getName());
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), EdgeEventActionType.UNASSIGNED_FROM_EDGE);
|
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedAsset.getId(), EntityType.ASSET, EdgeEventActionType.UNASSIGNED_FROM_EDGE);
|
||||||
|
|
||||||
return savedAsset;
|
return savedAsset;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.thingsboard.rule.engine.api.MailService;
|
import org.thingsboard.rule.engine.api.MailService;
|
||||||
|
import org.thingsboard.server.common.data.EntityType;
|
||||||
import org.thingsboard.server.common.data.User;
|
import org.thingsboard.server.common.data.User;
|
||||||
import org.thingsboard.server.common.data.audit.ActionType;
|
import org.thingsboard.server.common.data.audit.ActionType;
|
||||||
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
|
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
|
||||||
@ -127,7 +128,7 @@ public class AuthController extends BaseController {
|
|||||||
userCredentials.setPassword(passwordEncoder.encode(newPassword));
|
userCredentials.setPassword(passwordEncoder.encode(newPassword));
|
||||||
userService.replaceUserCredentials(securityUser.getTenantId(), userCredentials);
|
userService.replaceUserCredentials(securityUser.getTenantId(), userCredentials);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), userCredentials.getUserId(), EdgeEventActionType.CREDENTIALS_UPDATED);
|
sendNotificationMsgToEdgeService(getTenantId(), userCredentials.getUserId(), EntityType.USER, EdgeEventActionType.CREDENTIALS_UPDATED);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
@ -237,7 +238,7 @@ public class AuthController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(user.getTenantId(), user.getId(), EdgeEventActionType.CREDENTIALS_UPDATED);
|
sendNotificationMsgToEdgeService(user.getTenantId(), user.getId(), EntityType.USER, EdgeEventActionType.CREDENTIALS_UPDATED);
|
||||||
|
|
||||||
JwtToken accessToken = tokenFactory.createAccessJwtToken(securityUser);
|
JwtToken accessToken = tokenFactory.createAccessJwtToken(securityUser);
|
||||||
JwtToken refreshToken = refreshTokenRepository.requestRefreshToken(securityUser);
|
JwtToken refreshToken = refreshTokenRepository.requestRefreshToken(securityUser);
|
||||||
|
|||||||
@ -799,15 +799,15 @@ public abstract class BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendNotificationMsgToEdgeService(TenantId tenantId, EntityId entityId, EdgeEventActionType action) {
|
protected void sendNotificationMsgToEdgeService(TenantId tenantId, EntityId entityId, EntityType entityType, EdgeEventActionType action) {
|
||||||
sendNotificationMsgToEdgeService(tenantId, null, entityId, action);
|
sendNotificationMsgToEdgeService(tenantId, null, entityId, entityType, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, EdgeEventActionType action) {
|
protected void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, EntityType entityType, EdgeEventActionType action) {
|
||||||
if (!edgesRpcEnabled) {
|
if (!edgesRpcEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EdgeEventType type = EdgeUtils.getEdgeEventTypeByEntityType(entityId.getEntityType());
|
EdgeEventType type = EdgeUtils.getEdgeEventTypeByEntityType(entityType);
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, null, type, action);
|
sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, null, type, action);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,7 +110,7 @@ public class CustomerController extends BaseController {
|
|||||||
customer.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
customer.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
||||||
|
|
||||||
if (customer.getId() != null) {
|
if (customer.getId() != null) {
|
||||||
sendNotificationMsgToEdgeService(savedCustomer.getTenantId(), savedCustomer.getId(), EdgeEventActionType.UPDATED);
|
sendNotificationMsgToEdgeService(savedCustomer.getTenantId(), savedCustomer.getId(), EntityType.CUSTOMER, EdgeEventActionType.UPDATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return savedCustomer;
|
return savedCustomer;
|
||||||
@ -137,7 +137,7 @@ public class CustomerController extends BaseController {
|
|||||||
customer.getId(),
|
customer.getId(),
|
||||||
ActionType.DELETED, null, strCustomerId);
|
ActionType.DELETED, null, strCustomerId);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), customerId, EdgeEventActionType.DELETED);
|
sendNotificationMsgToEdgeService(getTenantId(), customerId, EntityType.CUSTOMER, EdgeEventActionType.DELETED);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
logEntityAction(emptyId(EntityType.CUSTOMER),
|
logEntityAction(emptyId(EntityType.CUSTOMER),
|
||||||
|
|||||||
@ -117,7 +117,7 @@ public class DashboardController extends BaseController {
|
|||||||
dashboard.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
dashboard.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
||||||
|
|
||||||
if (dashboard.getId() != null) {
|
if (dashboard.getId() != null) {
|
||||||
sendNotificationMsgToEdgeService(savedDashboard.getTenantId(), savedDashboard.getId(), EdgeEventActionType.UPDATED);
|
sendNotificationMsgToEdgeService(savedDashboard.getTenantId(), savedDashboard.getId(), EntityType.DASHBOARD, EdgeEventActionType.UPDATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return savedDashboard;
|
return savedDashboard;
|
||||||
@ -143,7 +143,7 @@ public class DashboardController extends BaseController {
|
|||||||
null,
|
null,
|
||||||
ActionType.DELETED, null, strDashboardId);
|
ActionType.DELETED, null, strDashboardId);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), dashboardId, EdgeEventActionType.DELETED);
|
sendNotificationMsgToEdgeService(getTenantId(), dashboardId, EntityType.DASHBOARD, EdgeEventActionType.DELETED);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
logEntityAction(emptyId(EntityType.DASHBOARD),
|
logEntityAction(emptyId(EntityType.DASHBOARD),
|
||||||
@ -505,7 +505,7 @@ public class DashboardController extends BaseController {
|
|||||||
null,
|
null,
|
||||||
ActionType.ASSIGNED_TO_EDGE, null, strDashboardId, strEdgeId, edge.getName());
|
ActionType.ASSIGNED_TO_EDGE, null, strDashboardId, strEdgeId, edge.getName());
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), EdgeEventActionType.ASSIGNED_TO_EDGE);
|
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), EntityType.DASHBOARD, EdgeEventActionType.ASSIGNED_TO_EDGE);
|
||||||
|
|
||||||
return savedDashboard;
|
return savedDashboard;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -537,7 +537,7 @@ public class DashboardController extends BaseController {
|
|||||||
null,
|
null,
|
||||||
ActionType.UNASSIGNED_FROM_EDGE, null, strDashboardId, strEdgeId, edge.getName());
|
ActionType.UNASSIGNED_FROM_EDGE, null, strDashboardId, strEdgeId, edge.getName());
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), EdgeEventActionType.UNASSIGNED_FROM_EDGE);
|
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDashboard.getId(), EntityType.DASHBOARD, EdgeEventActionType.UNASSIGNED_FROM_EDGE);
|
||||||
|
|
||||||
return savedDashboard;
|
return savedDashboard;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -114,7 +114,7 @@ public class DeviceController extends BaseController {
|
|||||||
savedDevice.getId(), savedDevice.getName(), savedDevice.getType()), null);
|
savedDevice.getId(), savedDevice.getName(), savedDevice.getType()), null);
|
||||||
|
|
||||||
if (device.getId() != null) {
|
if (device.getId() != null) {
|
||||||
sendNotificationMsgToEdgeService(savedDevice.getTenantId(), savedDevice.getId(), EdgeEventActionType.UPDATED);
|
sendNotificationMsgToEdgeService(savedDevice.getTenantId(), savedDevice.getId(), EntityType.DEVICE, EdgeEventActionType.UPDATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
logEntityAction(savedDevice.getId(), savedDevice,
|
logEntityAction(savedDevice.getId(), savedDevice,
|
||||||
@ -148,7 +148,7 @@ public class DeviceController extends BaseController {
|
|||||||
device.getCustomerId(),
|
device.getCustomerId(),
|
||||||
ActionType.DELETED, null, strDeviceId);
|
ActionType.DELETED, null, strDeviceId);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), deviceId, EdgeEventActionType.DELETED);
|
sendNotificationMsgToEdgeService(getTenantId(), deviceId, EntityType.DEVICE, EdgeEventActionType.DELETED);
|
||||||
|
|
||||||
deviceStateService.onDeviceDeleted(device);
|
deviceStateService.onDeviceDeleted(device);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -279,7 +279,7 @@ public class DeviceController extends BaseController {
|
|||||||
|
|
||||||
tbClusterService.pushMsgToCore(new DeviceCredentialsUpdateNotificationMsg(getCurrentUser().getTenantId(), deviceCredentials.getDeviceId()), null);
|
tbClusterService.pushMsgToCore(new DeviceCredentialsUpdateNotificationMsg(getCurrentUser().getTenantId(), deviceCredentials.getDeviceId()), null);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), device.getId(), EdgeEventActionType.CREDENTIALS_UPDATED);
|
sendNotificationMsgToEdgeService(getTenantId(), device.getId(), EntityType.DEVICE, EdgeEventActionType.CREDENTIALS_UPDATED);
|
||||||
|
|
||||||
logEntityAction(device.getId(), device,
|
logEntityAction(device.getId(), device,
|
||||||
device.getCustomerId(),
|
device.getCustomerId(),
|
||||||
@ -583,7 +583,7 @@ public class DeviceController extends BaseController {
|
|||||||
savedDevice.getCustomerId(),
|
savedDevice.getCustomerId(),
|
||||||
ActionType.ASSIGNED_TO_EDGE, null, strDeviceId, strEdgeId, edge.getName());
|
ActionType.ASSIGNED_TO_EDGE, null, strDeviceId, strEdgeId, edge.getName());
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), EdgeEventActionType.ASSIGNED_TO_EDGE);
|
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), EntityType.DEVICE, EdgeEventActionType.ASSIGNED_TO_EDGE);
|
||||||
|
|
||||||
return savedDevice;
|
return savedDevice;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -617,7 +617,7 @@ public class DeviceController extends BaseController {
|
|||||||
device.getCustomerId(),
|
device.getCustomerId(),
|
||||||
ActionType.UNASSIGNED_FROM_EDGE, null, strDeviceId, strEdgeId, edge.getName());
|
ActionType.UNASSIGNED_FROM_EDGE, null, strDeviceId, strEdgeId, edge.getName());
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), EdgeEventActionType.UNASSIGNED_FROM_EDGE);
|
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedDevice.getId(), EntityType.DEVICE, EdgeEventActionType.UNASSIGNED_FROM_EDGE);
|
||||||
|
|
||||||
return savedDevice;
|
return savedDevice;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -119,7 +119,7 @@ public class EntityViewController extends BaseController {
|
|||||||
entityView.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
entityView.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
||||||
|
|
||||||
if (entityView.getId() != null) {
|
if (entityView.getId() != null) {
|
||||||
sendNotificationMsgToEdgeService(savedEntityView.getTenantId(), savedEntityView.getId(), EdgeEventActionType.UPDATED);
|
sendNotificationMsgToEdgeService(savedEntityView.getTenantId(), savedEntityView.getId(), EntityType.ENTITY_VIEW, EdgeEventActionType.UPDATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return savedEntityView;
|
return savedEntityView;
|
||||||
@ -192,7 +192,7 @@ public class EntityViewController extends BaseController {
|
|||||||
logEntityAction(entityViewId, entityView, entityView.getCustomerId(),
|
logEntityAction(entityViewId, entityView, entityView.getCustomerId(),
|
||||||
ActionType.DELETED, null, strEntityViewId);
|
ActionType.DELETED, null, strEntityViewId);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), entityViewId, EdgeEventActionType.DELETED);
|
sendNotificationMsgToEdgeService(getTenantId(), entityViewId, EntityType.ENTITY_VIEW, EdgeEventActionType.DELETED);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logEntityAction(emptyId(EntityType.ENTITY_VIEW),
|
logEntityAction(emptyId(EntityType.ENTITY_VIEW),
|
||||||
null,
|
null,
|
||||||
@ -405,7 +405,7 @@ public class EntityViewController extends BaseController {
|
|||||||
savedEntityView.getCustomerId(),
|
savedEntityView.getCustomerId(),
|
||||||
ActionType.ASSIGNED_TO_EDGE, null, strEntityViewId, strEdgeId, edge.getName());
|
ActionType.ASSIGNED_TO_EDGE, null, strEntityViewId, strEdgeId, edge.getName());
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), EdgeEventActionType.ASSIGNED_TO_EDGE);
|
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), EntityType.ENTITY_VIEW, EdgeEventActionType.ASSIGNED_TO_EDGE);
|
||||||
|
|
||||||
return savedEntityView;
|
return savedEntityView;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -435,7 +435,7 @@ public class EntityViewController extends BaseController {
|
|||||||
entityView.getCustomerId(),
|
entityView.getCustomerId(),
|
||||||
ActionType.UNASSIGNED_FROM_EDGE, null, strEntityViewId, strEdgeId, edge.getName());
|
ActionType.UNASSIGNED_FROM_EDGE, null, strEntityViewId, strEdgeId, edge.getName());
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), EdgeEventActionType.UNASSIGNED_FROM_EDGE);
|
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedEntityView.getId(), EntityType.ENTITY_VIEW, EdgeEventActionType.UNASSIGNED_FROM_EDGE);
|
||||||
|
|
||||||
return savedEntityView;
|
return savedEntityView;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -146,7 +146,7 @@ public class RuleChainController extends BaseController {
|
|||||||
|
|
||||||
if (RuleChainType.EDGE.equals(savedRuleChain.getType())) {
|
if (RuleChainType.EDGE.equals(savedRuleChain.getType())) {
|
||||||
if (!created) {
|
if (!created) {
|
||||||
sendNotificationMsgToEdgeService(savedRuleChain.getTenantId(), savedRuleChain.getId(), EdgeEventActionType.UPDATED);
|
sendNotificationMsgToEdgeService(savedRuleChain.getTenantId(), savedRuleChain.getId(), EntityType.RULE_CHAIN, EdgeEventActionType.UPDATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ public class RuleChainController extends BaseController {
|
|||||||
|
|
||||||
if (RuleChainType.EDGE.equals(ruleChain.getType())) {
|
if (RuleChainType.EDGE.equals(ruleChain.getType())) {
|
||||||
sendNotificationMsgToEdgeService(ruleChain.getTenantId(),
|
sendNotificationMsgToEdgeService(ruleChain.getTenantId(),
|
||||||
ruleChain.getId(), EdgeEventActionType.UPDATED);
|
ruleChain.getId(), EntityType.RULE_CHAIN, EdgeEventActionType.UPDATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return savedRuleChainMetaData;
|
return savedRuleChainMetaData;
|
||||||
@ -290,7 +290,7 @@ public class RuleChainController extends BaseController {
|
|||||||
ActionType.DELETED, null, strRuleChainId);
|
ActionType.DELETED, null, strRuleChainId);
|
||||||
|
|
||||||
if (RuleChainType.EDGE.equals(ruleChain.getType())) {
|
if (RuleChainType.EDGE.equals(ruleChain.getType())) {
|
||||||
sendNotificationMsgToEdgeService(ruleChain.getTenantId(), ruleChain.getId(), EdgeEventActionType.DELETED);
|
sendNotificationMsgToEdgeService(ruleChain.getTenantId(), ruleChain.getId(), EntityType.RULE_CHAIN, EdgeEventActionType.DELETED);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -422,7 +422,7 @@ public class RuleChainController extends BaseController {
|
|||||||
null,
|
null,
|
||||||
ActionType.ASSIGNED_TO_EDGE, null, strRuleChainId, strEdgeId, edge.getName());
|
ActionType.ASSIGNED_TO_EDGE, null, strRuleChainId, strEdgeId, edge.getName());
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), EdgeEventActionType.ASSIGNED_TO_EDGE);
|
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), EntityType.RULE_CHAIN, EdgeEventActionType.ASSIGNED_TO_EDGE);
|
||||||
|
|
||||||
return savedRuleChain;
|
return savedRuleChain;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -454,7 +454,7 @@ public class RuleChainController extends BaseController {
|
|||||||
null,
|
null,
|
||||||
ActionType.UNASSIGNED_FROM_EDGE, null, strRuleChainId, strEdgeId, edge.getName());
|
ActionType.UNASSIGNED_FROM_EDGE, null, strRuleChainId, strEdgeId, edge.getName());
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), EdgeEventActionType.UNASSIGNED_FROM_EDGE);
|
sendNotificationMsgToEdgeService(getTenantId(), edgeId, savedRuleChain.getId(), EntityType.RULE_CHAIN, EdgeEventActionType.UNASSIGNED_FROM_EDGE);
|
||||||
|
|
||||||
return savedRuleChain;
|
return savedRuleChain;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -166,7 +166,7 @@ public class UserController extends BaseController {
|
|||||||
savedUser.getCustomerId(),
|
savedUser.getCustomerId(),
|
||||||
user.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
user.getId() == null ? ActionType.ADDED : ActionType.UPDATED, null);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), savedUser.getId(),
|
sendNotificationMsgToEdgeService(getTenantId(), savedUser.getId(), EntityType.USER,
|
||||||
user.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
|
user.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
|
||||||
|
|
||||||
return savedUser;
|
return savedUser;
|
||||||
@ -244,7 +244,7 @@ public class UserController extends BaseController {
|
|||||||
user.getCustomerId(),
|
user.getCustomerId(),
|
||||||
ActionType.DELETED, null, strUserId);
|
ActionType.DELETED, null, strUserId);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), user.getId(), EdgeEventActionType.DELETED);
|
sendNotificationMsgToEdgeService(getTenantId(), user.getId(), EntityType.USER, EdgeEventActionType.DELETED);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logEntityAction(emptyId(EntityType.USER),
|
logEntityAction(emptyId(EntityType.USER),
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.thingsboard.server.common.data.EntityType;
|
||||||
import org.thingsboard.server.common.data.audit.ActionType;
|
import org.thingsboard.server.common.data.audit.ActionType;
|
||||||
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
|
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
|
||||||
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
||||||
@ -73,7 +74,7 @@ public class WidgetTypeController extends BaseController {
|
|||||||
checkEntity(widgetType.getId(), widgetType, Resource.WIDGET_TYPE);
|
checkEntity(widgetType.getId(), widgetType, Resource.WIDGET_TYPE);
|
||||||
WidgetType savedWidgetType = widgetTypeService.saveWidgetType(widgetType);
|
WidgetType savedWidgetType = widgetTypeService.saveWidgetType(widgetType);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), savedWidgetType.getId(),
|
sendNotificationMsgToEdgeService(getTenantId(), savedWidgetType.getId(), EntityType.WIDGET_TYPE,
|
||||||
widgetType.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
|
widgetType.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
|
||||||
|
|
||||||
return checkNotNull(savedWidgetType);
|
return checkNotNull(savedWidgetType);
|
||||||
@ -92,7 +93,7 @@ public class WidgetTypeController extends BaseController {
|
|||||||
checkWidgetTypeId(widgetTypeId, Operation.DELETE);
|
checkWidgetTypeId(widgetTypeId, Operation.DELETE);
|
||||||
widgetTypeService.deleteWidgetType(getCurrentUser().getTenantId(), widgetTypeId);
|
widgetTypeService.deleteWidgetType(getCurrentUser().getTenantId(), widgetTypeId);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), widgetTypeId, EdgeEventActionType.DELETED);
|
sendNotificationMsgToEdgeService(getTenantId(), widgetTypeId, EntityType.WIDGET_TYPE, EdgeEventActionType.DELETED);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.thingsboard.server.common.data.EntityType;
|
||||||
import org.thingsboard.server.common.data.audit.ActionType;
|
import org.thingsboard.server.common.data.audit.ActionType;
|
||||||
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
|
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
|
||||||
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
import org.thingsboard.server.common.data.exception.ThingsboardException;
|
||||||
@ -72,7 +73,7 @@ public class WidgetsBundleController extends BaseController {
|
|||||||
checkEntity(widgetsBundle.getId(), widgetsBundle, Resource.WIDGETS_BUNDLE);
|
checkEntity(widgetsBundle.getId(), widgetsBundle, Resource.WIDGETS_BUNDLE);
|
||||||
WidgetsBundle savedWidgetsBundle = widgetsBundleService.saveWidgetsBundle(widgetsBundle);
|
WidgetsBundle savedWidgetsBundle = widgetsBundleService.saveWidgetsBundle(widgetsBundle);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), savedWidgetsBundle.getId(),
|
sendNotificationMsgToEdgeService(getTenantId(), savedWidgetsBundle.getId(), EntityType.WIDGETS_BUNDLE,
|
||||||
widgetsBundle.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
|
widgetsBundle.getId() == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
|
||||||
|
|
||||||
return checkNotNull(savedWidgetsBundle);
|
return checkNotNull(savedWidgetsBundle);
|
||||||
@ -91,7 +92,7 @@ public class WidgetsBundleController extends BaseController {
|
|||||||
checkWidgetsBundleId(widgetsBundleId, Operation.DELETE);
|
checkWidgetsBundleId(widgetsBundleId, Operation.DELETE);
|
||||||
widgetsBundleService.deleteWidgetsBundle(getTenantId(), widgetsBundleId);
|
widgetsBundleService.deleteWidgetsBundle(getTenantId(), widgetsBundleId);
|
||||||
|
|
||||||
sendNotificationMsgToEdgeService(getTenantId(), widgetsBundleId, EdgeEventActionType.DELETED);
|
sendNotificationMsgToEdgeService(getTenantId(), widgetsBundleId, EntityType.WIDGETS_BUNDLE, EdgeEventActionType.DELETED);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user