diff --git a/application/src/main/java/org/thingsboard/server/service/entitiy/DefaultTbNotificationEntityService.java b/application/src/main/java/org/thingsboard/server/service/entitiy/DefaultTbNotificationEntityService.java index 1565fad175..a556caa16c 100644 --- a/application/src/main/java/org/thingsboard/server/service/entitiy/DefaultTbNotificationEntityService.java +++ b/application/src/main/java/org/thingsboard/server/service/entitiy/DefaultTbNotificationEntityService.java @@ -76,7 +76,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS CustomerId customerId, ActionType actionType, List relatedEdgeIds, SecurityUser user, Object... additionalInfo) { - logEntityAction(tenantId, entityId, entity, customerId, actionType, user, null, additionalInfo); + logEntityAction(tenantId, entityId, entity, customerId, actionType, user, additionalInfo); sendDeleteNotificationMsg(tenantId, entityId, entity, relatedEdgeIds); } @@ -85,7 +85,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS List relatedEdgeIds, SecurityUser user, String body, Object... additionalInfo) { - logEntityAction(tenantId, originatorId, alarm, customerId, ActionType.DELETED, user, null, additionalInfo); + logEntityAction(tenantId, originatorId, alarm, customerId, ActionType.DELETED, user, additionalInfo); sendAlarmDeleteNotificationMsg(tenantId, alarm, relatedEdgeIds, body); } @@ -111,7 +111,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS EdgeEventActionType edgeActionType, SecurityUser user, boolean sendToEdge, Object... additionalInfo) { - logEntityAction(tenantId, entityId, entity, customerId, actionType, user, null, additionalInfo); + logEntityAction(tenantId, entityId, entity, customerId, actionType, user, additionalInfo); if (sendToEdge) { sendEntityAssignToCustomerNotificationMsg(tenantId, entityId, customerId, edgeActionType); @@ -123,7 +123,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS CustomerId customerId, EdgeId edgeId, E entity, ActionType actionType, SecurityUser user, Object... additionalInfo) { - logEntityAction(tenantId, entityId, entity, customerId, actionType, user, null, additionalInfo); + logEntityAction(tenantId, entityId, entity, customerId, actionType, user, additionalInfo); sendEntityAssignToEdgeNotificationMsg(tenantId, edgeId, entityId, edgeTypeByActionType(actionType)); } @@ -144,7 +144,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS Device device, Device oldDevice, ActionType actionType, SecurityUser user, Object... additionalInfo) { tbClusterService.onDeviceUpdated(device, oldDevice); - logEntityAction(tenantId, deviceId, device, customerId, actionType, user, null, additionalInfo); + logEntityAction(tenantId, deviceId, device, customerId, actionType, user, additionalInfo); } @Override @@ -161,19 +161,19 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS DeviceCredentials deviceCredentials, SecurityUser user) { tbClusterService.pushMsgToCore(new DeviceCredentialsUpdateNotificationMsg(tenantId, deviceCredentials.getDeviceId(), deviceCredentials), null); sendEntityNotificationMsg(tenantId, deviceId, EdgeEventActionType.CREDENTIALS_UPDATED); - logEntityAction(tenantId, deviceId, device, customerId, ActionType.CREDENTIALS_UPDATED, user, null, deviceCredentials); + logEntityAction(tenantId, deviceId, device, customerId, ActionType.CREDENTIALS_UPDATED, user, deviceCredentials); } @Override public void notifyAssignDeviceToTenant(TenantId tenantId, TenantId newTenantId, DeviceId deviceId, CustomerId customerId, Device device, Tenant tenant, SecurityUser user, Object... additionalInfo) { - logEntityAction(tenantId, deviceId, device, customerId, ActionType.ASSIGNED_TO_TENANT, user, null, additionalInfo); + logEntityAction(tenantId, deviceId, device, customerId, ActionType.ASSIGNED_TO_TENANT, user, additionalInfo); pushAssignedFromNotification(tenant, newTenantId, device); } @Override public void notifyCreateOrUpdateEntity(TenantId tenantId, I entityId, E entity, CustomerId customerId, ActionType actionType, SecurityUser user, Object... additionalInfo) { - logEntityAction(tenantId, entityId, entity, customerId, actionType, user, null, additionalInfo); + logEntityAction(tenantId, entityId, entity, customerId, actionType, user, additionalInfo); if (actionType == ActionType.UPDATED) { sendEntityNotificationMsg(tenantId, entityId, EdgeEventActionType.UPDATED); } @@ -207,7 +207,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS } tbClusterService.broadcastEntityStateChangeEvent(tenantId, edgeId, lifecycleEvent); - logEntityAction(tenantId, edgeId, edge, customerId, actionType, user, null, additionalInfo); + logEntityAction(tenantId, edgeId, edge, customerId, actionType, user, additionalInfo); //Send notification to edge if (edgeEventActionType != null) { @@ -217,7 +217,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS @Override public void notifyCreateOrUpdateAlarm(Alarm alarm, ActionType actionType, SecurityUser user, Object... additionalInfo) { - logEntityAction(alarm.getTenantId(), alarm.getOriginator(), alarm, alarm.getCustomerId(), actionType, user, null, additionalInfo); + logEntityAction(alarm.getTenantId(), alarm.getOriginator(), alarm, alarm.getCustomerId(), actionType, user, additionalInfo); sendEntityNotificationMsg(alarm.getTenantId(), alarm.getId(), edgeTypeByActionType(actionType)); } @@ -252,6 +252,11 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS } } + private void logEntityAction(TenantId tenantId, I entityId, E entity, CustomerId customerId, + ActionType actionType, SecurityUser user, Object... additionalInfo) { + logEntityAction(tenantId, entityId, entity, customerId, actionType, user, null, additionalInfo); + } + private void logEntityAction(TenantId tenantId, I entityId, E entity, CustomerId customerId, ActionType actionType, SecurityUser user, Exception e, Object... additionalInfo) { if (user != null) {