|
|
|
@ -77,7 +77,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS |
|
|
|
CustomerId customerId, ActionType actionType, |
|
|
|
List<EdgeId> relatedEdgeIds, |
|
|
|
SecurityUser user, Object... additionalInfo) { |
|
|
|
logEntityAction(tenantId, entityId, entity, customerId, actionType, user, additionalInfo); |
|
|
|
logEntityAction(tenantId, entityId, entity, customerId, actionType, user, null, additionalInfo); |
|
|
|
sendDeleteNotificationMsg(tenantId, entityId, entity, relatedEdgeIds); |
|
|
|
} |
|
|
|
|
|
|
|
@ -86,15 +86,15 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS |
|
|
|
List<EdgeId> relatedEdgeIds, |
|
|
|
SecurityUser user, |
|
|
|
String body, Object... additionalInfo) { |
|
|
|
logEntityAction(tenantId, originatorId, alarm, customerId, ActionType.DELETED, user, additionalInfo); |
|
|
|
logEntityAction(tenantId, originatorId, alarm, customerId, ActionType.DELETED, user, null, additionalInfo); |
|
|
|
sendAlarmDeleteNotificationMsg(tenantId, alarm, relatedEdgeIds, body); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void notifyDeleteRuleChane(TenantId tenantId, RuleChain ruleChain, |
|
|
|
public void notifyDeleteRuleChain(TenantId tenantId, RuleChain ruleChain, |
|
|
|
List<EdgeId> relatedEdgeIds, SecurityUser user) { |
|
|
|
RuleChainId ruleChainId = ruleChain.getId(); |
|
|
|
logEntityAction(tenantId, ruleChainId, ruleChain, null, ActionType.DELETED, user, ruleChainId.toString()); |
|
|
|
logEntityAction(tenantId, ruleChainId, ruleChain, null, ActionType.DELETED, user, null, ruleChainId.toString()); |
|
|
|
if (RuleChainType.EDGE.equals(ruleChain.getType())) { |
|
|
|
sendDeleteNotificationMsg(tenantId, ruleChainId, relatedEdgeIds, null); |
|
|
|
} |
|
|
|
@ -108,7 +108,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS |
|
|
|
RuleChain updatedRuleChain = (RuleChain)others[0]; |
|
|
|
RuleChainMetaData updatedRuleChainMetaData = (RuleChainMetaData)others[1]; |
|
|
|
SecurityUser user = (SecurityUser)others[2]; |
|
|
|
logEntityAction(tenantId, updatedRuleChain.getId(), updatedRuleChain, null, ActionType.UPDATED, user, updatedRuleChainMetaData); |
|
|
|
logEntityAction(tenantId, updatedRuleChain.getId(), updatedRuleChain, null, ActionType.UPDATED, user, null, updatedRuleChainMetaData); |
|
|
|
if (RuleChainType.EDGE.equals(ruleChain.getType())) { |
|
|
|
sendEntityNotificationMsg(updatedRuleChain.getTenantId(), updatedRuleChain.getId(), EdgeEventActionType.UPDATED); |
|
|
|
} |
|
|
|
@ -122,7 +122,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS |
|
|
|
EdgeEventActionType edgeActionType, |
|
|
|
SecurityUser user, boolean sendToEdge, |
|
|
|
Object... additionalInfo) { |
|
|
|
logEntityAction(tenantId, entityId, entity, customerId, actionType, user, additionalInfo); |
|
|
|
logEntityAction(tenantId, entityId, entity, customerId, actionType, user, null, additionalInfo); |
|
|
|
|
|
|
|
if (sendToEdge) { |
|
|
|
sendEntityAssignToCustomerNotificationMsg(tenantId, entityId, customerId, edgeActionType); |
|
|
|
@ -134,7 +134,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, additionalInfo); |
|
|
|
logEntityAction(tenantId, entityId, entity, customerId, actionType, user, null, additionalInfo); |
|
|
|
sendEntityAssignToEdgeNotificationMsg(tenantId, edgeId, entityId, edgeTypeByActionType(actionType)); |
|
|
|
} |
|
|
|
|
|
|
|
@ -155,7 +155,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, additionalInfo); |
|
|
|
logEntityAction(tenantId, deviceId, device, customerId, actionType, user, null, additionalInfo); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -172,19 +172,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, deviceCredentials); |
|
|
|
logEntityAction(tenantId, deviceId, device, customerId, ActionType.CREDENTIALS_UPDATED, user, null, 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, additionalInfo); |
|
|
|
logEntityAction(tenantId, deviceId, device, customerId, ActionType.ASSIGNED_TO_TENANT, user, null, 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, additionalInfo); |
|
|
|
logEntityAction(tenantId, entityId, entity, customerId, actionType, user, null, additionalInfo); |
|
|
|
if (actionType == ActionType.UPDATED) { |
|
|
|
sendEntityNotificationMsg(tenantId, entityId, EdgeEventActionType.UPDATED); |
|
|
|
} |
|
|
|
@ -218,7 +218,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS |
|
|
|
} |
|
|
|
|
|
|
|
tbClusterService.broadcastEntityStateChangeEvent(tenantId, edgeId, lifecycleEvent); |
|
|
|
logEntityAction(tenantId, edgeId, edge, customerId, actionType, user, additionalInfo); |
|
|
|
logEntityAction(tenantId, edgeId, edge, customerId, actionType, user, null, additionalInfo); |
|
|
|
|
|
|
|
//Send notification to edge
|
|
|
|
if (edgeEventActionType != null) { |
|
|
|
@ -228,17 +228,17 @@ 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, additionalInfo); |
|
|
|
logEntityAction(alarm.getTenantId(), alarm.getOriginator(), alarm, alarm.getCustomerId(), actionType, user, null, additionalInfo); |
|
|
|
sendEntityNotificationMsg(alarm.getTenantId(), alarm.getId(), edgeTypeByActionType(actionType)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public <E extends HasName, I extends EntityId> void notifyCreateOrUpdateOrDelete(TenantId tenantId, CustomerId customerId, |
|
|
|
I entityId, E entity, SecurityUser user, |
|
|
|
ActionType actionType, boolean isSendMsg, Exception e, |
|
|
|
ActionType actionType, boolean sendNotifyMsgToEdge, Exception e, |
|
|
|
Object... additionalInfo) { |
|
|
|
notifyEntity(tenantId, entityId, entity, customerId, actionType, user, e, additionalInfo); |
|
|
|
if (isSendMsg) { |
|
|
|
if (sendNotifyMsgToEdge) { |
|
|
|
sendEntityNotificationMsg(tenantId, entityId, edgeTypeByActionType(actionType)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -263,11 +263,6 @@ 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) { |
|
|
|
|