|
|
|
@ -84,7 +84,6 @@ import org.thingsboard.server.common.data.page.SortOrder; |
|
|
|
import org.thingsboard.server.common.data.page.TimePageLink; |
|
|
|
import org.thingsboard.server.common.data.plugin.ComponentDescriptor; |
|
|
|
import org.thingsboard.server.common.data.plugin.ComponentType; |
|
|
|
import org.thingsboard.server.common.data.relation.EntityRelation; |
|
|
|
import org.thingsboard.server.common.data.rpc.Rpc; |
|
|
|
import org.thingsboard.server.common.data.rule.RuleChain; |
|
|
|
import org.thingsboard.server.common.data.rule.RuleChainType; |
|
|
|
@ -840,45 +839,14 @@ public abstract class BaseController { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
protected void sendRelationNotificationMsg(TenantId tenantId, EntityRelation relation, EdgeEventActionType action) { |
|
|
|
try { |
|
|
|
if (!relation.getFrom().getEntityType().equals(EntityType.EDGE) && |
|
|
|
!relation.getTo().getEntityType().equals(EntityType.EDGE)) { |
|
|
|
sendNotificationMsgToEdge(tenantId, null, null, json.writeValueAsString(relation), EdgeEventType.RELATION, action); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.warn("Failed to push relation to core: {}", relation, e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected void sendDeleteNotificationMsg(TenantId tenantId, EntityId entityId, List<EdgeId> edgeIds) { |
|
|
|
sendDeleteNotificationMsg(tenantId, entityId, edgeIds, null); |
|
|
|
} |
|
|
|
|
|
|
|
protected void sendDeleteNotificationMsg(TenantId tenantId, EntityId entityId, List<EdgeId> edgeIds, String body) { |
|
|
|
if (edgeIds != null && !edgeIds.isEmpty()) { |
|
|
|
for (EdgeId edgeId : edgeIds) { |
|
|
|
sendNotificationMsgToEdge(tenantId, edgeId, entityId, body, null, EdgeEventActionType.DELETED); |
|
|
|
sendNotificationMsgToEdge(tenantId, edgeId, entityId, null, null, EdgeEventActionType.DELETED); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected void sendAlarmDeleteNotificationMsg(TenantId tenantId, EntityId entityId, List<EdgeId> edgeIds, Alarm alarm) { |
|
|
|
try { |
|
|
|
sendDeleteNotificationMsg(tenantId, entityId, edgeIds, json.writeValueAsString(alarm)); |
|
|
|
} catch (Exception e) { |
|
|
|
log.warn("Failed to push delete alarm msg to core: {}", alarm, e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected void sendEntityAssignToCustomerNotificationMsg(TenantId tenantId, EntityId entityId, CustomerId customerId, EdgeEventActionType action) { |
|
|
|
try { |
|
|
|
sendNotificationMsgToEdge(tenantId, null, entityId, json.writeValueAsString(customerId), null, action); |
|
|
|
} catch (Exception e) { |
|
|
|
log.warn("Failed to push assign/unassign to/from customer to core: {}", customerId, e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected void sendEntityNotificationMsg(TenantId tenantId, EntityId entityId, EdgeEventActionType action) { |
|
|
|
sendNotificationMsgToEdge(tenantId, null, entityId, null, null, action); |
|
|
|
} |
|
|
|
|