|
|
|
@ -76,7 +76,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS |
|
|
|
CustomerId customerId, ActionType actionType, |
|
|
|
List<EdgeId> 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<EdgeId> 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 <E extends HasName, I extends EntityId> 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 <E extends HasName, I extends EntityId> 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 <E extends HasName, I extends EntityId> void logEntityAction(TenantId tenantId, I entityId, E entity, CustomerId customerId, |
|
|
|
ActionType actionType, SecurityUser user, Exception e, Object... additionalInfo) { |
|
|
|
if (user != null) { |
|
|
|
|