@ -15,11 +15,10 @@
* /
* /
package org.thingsboard.server.service.entitiy ;
package org.thingsboard.server.service.entitiy ;
import com.fasterxml.jackson.core.JsonProcessingException ;
import com.fasterxml.jackson.databind.ObjectMapper ;
import lombok.RequiredArgsConstructor ;
import lombok.RequiredArgsConstructor ;
import lombok.extern.slf4j.Slf4j ;
import lombok.extern.slf4j.Slf4j ;
import org.springframework.stereotype.Service ;
import org.springframework.stereotype.Service ;
import org.thingsboard.common.util.JacksonUtil ;
import org.thingsboard.rule.engine.api.msg.DeviceCredentialsUpdateNotificationMsg ;
import org.thingsboard.rule.engine.api.msg.DeviceCredentialsUpdateNotificationMsg ;
import org.thingsboard.server.cluster.TbClusterService ;
import org.thingsboard.server.cluster.TbClusterService ;
import org.thingsboard.server.common.data.DataConstants ;
import org.thingsboard.server.common.data.DataConstants ;
@ -27,6 +26,7 @@ import org.thingsboard.server.common.data.Device;
import org.thingsboard.server.common.data.EntityType ;
import org.thingsboard.server.common.data.EntityType ;
import org.thingsboard.server.common.data.HasName ;
import org.thingsboard.server.common.data.HasName ;
import org.thingsboard.server.common.data.Tenant ;
import org.thingsboard.server.common.data.Tenant ;
import org.thingsboard.server.common.data.User ;
import org.thingsboard.server.common.data.alarm.Alarm ;
import org.thingsboard.server.common.data.alarm.Alarm ;
import org.thingsboard.server.common.data.audit.ActionType ;
import org.thingsboard.server.common.data.audit.ActionType ;
import org.thingsboard.server.common.data.edge.Edge ;
import org.thingsboard.server.common.data.edge.Edge ;
@ -46,52 +46,74 @@ import org.thingsboard.server.common.data.security.DeviceCredentials;
import org.thingsboard.server.common.msg.TbMsg ;
import org.thingsboard.server.common.msg.TbMsg ;
import org.thingsboard.server.common.msg.TbMsgDataType ;
import org.thingsboard.server.common.msg.TbMsgDataType ;
import org.thingsboard.server.common.msg.TbMsgMetaData ;
import org.thingsboard.server.common.msg.TbMsgMetaData ;
import org.thingsboard.server.queue.util.TbCoreComponent ;
import org.thingsboard.server.service.action.EntityActionService ;
import org.thingsboard.server.service.action.EntityActionService ;
import org.thingsboard.server.service.gateway_device.GatewayNotificationsService ;
import org.thingsboard.server.service.gateway_device.GatewayNotificationsService ;
import org.thingsboard.server.service.security.model.SecurityUser ;
import java.util.List ;
import java.util.List ;
@Slf4j
@Slf4j
@Service
@Service
@TbCoreComponent
@RequiredArgsConstructor
@RequiredArgsConstructor
public class DefaultTbNotificationEntityService implements TbNotificationEntityService {
public class DefaultTbNotificationEntityService implements TbNotificationEntityService {
private static final ObjectMapper json = new ObjectMapper ( ) ;
private final EntityActionService entityActionService ;
private final EntityActionService entityActionService ;
private final TbClusterService tbClusterService ;
private final TbClusterService tbClusterService ;
private final GatewayNotificationsService gatewayNotificationsService ;
private final GatewayNotificationsService gatewayNotificationsService ;
@Override
@Override
public < E extends HasName , I extends EntityId > void notifyEntity ( TenantId tenantId , I entityId , E entity , CustomerId customerId ,
public < I extends EntityId > void logEntityAction ( TenantId tenantId , I entityId , ActionType actionType ,
ActionType actionType , SecurityUser user , Exception e ,
User user , Exception e , Object . . . additionalInfo ) {
Object . . . additionalInfo ) {
logEntityAction ( tenantId , entityId , null , null , actionType , user , e , additionalInfo ) ;
logEntityAction ( tenantId , entityId , entity , customerId , actionType , user , e , additionalInfo ) ;
}
@Override
public < E extends HasName , I extends EntityId > void logEntityAction ( TenantId tenantId , I entityId , E entity ,
ActionType actionType , User user , Object . . . additionalInfo ) {
logEntityAction ( tenantId , entityId , entity , null , actionType , user , null , additionalInfo ) ;
}
@Override
public < E extends HasName , I extends EntityId > void logEntityAction ( TenantId tenantId , I entityId , E entity ,
ActionType actionType , User user , Exception e ,
Object . . . additionalInfo ) {
logEntityAction ( tenantId , entityId , entity , null , actionType , user , e , additionalInfo ) ;
}
@Override
public < E extends HasName , I extends EntityId > void logEntityAction ( TenantId tenantId , I entityId , E entity , CustomerId customerId ,
ActionType actionType , User user , Object . . . additionalInfo ) {
logEntityAction ( tenantId , entityId , entity , customerId , actionType , user , null , additionalInfo ) ;
}
@Override
public < E extends HasName , I extends EntityId > void logEntityAction ( TenantId tenantId , I entityId , E entity ,
CustomerId customerId , ActionType actionType ,
User user , Exception e , Object . . . additionalInfo ) {
if ( user ! = null ) {
entityActionService . logEntityAction ( user , entityId , entity , customerId , actionType , e , additionalInfo ) ;
} else if ( e = = null ) {
entityActionService . pushEntityActionToRuleEngine ( entityId , entity , tenantId , customerId , actionType , null , additionalInfo ) ;
}
}
}
@Override
@Override
public < E extends HasName , I extends EntityId > void notifyDeleteEntity ( TenantId tenantId , I entityId , E entity ,
public < E extends HasName , I extends EntityId > void notifyDeleteEntity ( TenantId tenantId , I entityId , E entity ,
CustomerId customerId , ActionType actionType ,
CustomerId customerId , ActionType actionType ,
List < EdgeId > relatedEdgeIds ,
List < EdgeId > relatedEdgeIds ,
SecurityUser user , Object . . . additionalInfo ) {
User user , Object . . . additionalInfo ) {
logEntityAction ( tenantId , entityId , entity , customerId , actionType , user , additionalInfo ) ;
logEntityAction ( tenantId , entityId , entity , customerId , actionType , user , additionalInfo ) ;
sendDeleteNotificationMsg ( tenantId , entityId , entity , relatedEdgeIds ) ;
sendDeleteNotificationMsg ( tenantId , entityId , entity , relatedEdgeIds ) ;
}
}
public void notifyDeleteAlarm ( TenantId tenantId , Alarm alarm , EntityId originatorId ,
@Override
CustomerId customerId ,
public void notifyDeleteAlarm ( TenantId tenantId , Alarm alarm , EntityId originatorId , CustomerId customerId ,
List < EdgeId > relatedEdgeIds ,
List < EdgeId > relatedEdgeIds , User user , String body , Object . . . additionalInfo ) {
SecurityUser user ,
String body , Object . . . additionalInfo ) {
logEntityAction ( tenantId , originatorId , alarm , customerId , ActionType . DELETED , user , additionalInfo ) ;
logEntityAction ( tenantId , originatorId , alarm , customerId , ActionType . DELETED , user , additionalInfo ) ;
sendAlarmDeleteNotificationMsg ( tenantId , alarm , relatedEdgeIds , body ) ;
sendAlarmDeleteNotificationMsg ( tenantId , alarm , relatedEdgeIds , body ) ;
}
}
@Override
@Override
public void notifyDeleteRuleChain ( TenantId tenantId , RuleChain ruleChain ,
public void notifyDeleteRuleChain ( TenantId tenantId , RuleChain ruleChain , List < EdgeId > relatedEdgeIds , User user ) {
List < EdgeId > relatedEdgeIds , SecurityUser user ) {
RuleChainId ruleChainId = ruleChain . getId ( ) ;
RuleChainId ruleChainId = ruleChain . getId ( ) ;
logEntityAction ( tenantId , ruleChainId , ruleChain , null , ActionType . DELETED , user , null , ruleChainId . toString ( ) ) ;
logEntityAction ( tenantId , ruleChainId , ruleChain , null , ActionType . DELETED , user , null , ruleChainId . toString ( ) ) ;
if ( RuleChainType . EDGE . equals ( ruleChain . getType ( ) ) ) {
if ( RuleChainType . EDGE . equals ( ruleChain . getType ( ) ) ) {
@ -102,19 +124,18 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
@Override
@Override
public < I extends EntityId > void notifySendMsgToEdgeService ( TenantId tenantId , I entityId , EdgeEventActionType edgeEventActionType ) {
public < I extends EntityId > void notifySendMsgToEdgeService ( TenantId tenantId , I entityId , EdgeEventActionType edgeEventActionType ) {
sendEntityNotificationMsg ( tenantId , entityId , edgeEventActionType ) ;
sendEntityNotificationMsg ( tenantId , entityId , edgeEventActionType ) ;
}
}
@Override
@Override
public < E extends HasName , I extends EntityId > void notifyAssignOrUnassignEntityToCustomer ( TenantId tenantId , I entityId ,
public < E extends HasName , I extends EntityId > void notifyAssignOrUnassignEntityToCustomer ( TenantId tenantId , I entityId ,
CustomerId customerId , E entity ,
CustomerId customerId , E entity ,
ActionType actionType ,
ActionType actionType ,
EdgeEventActionType edgeActionType ,
User user , boolean sendToEdge ,
SecurityUser user , boolean sendToEdge ,
Object . . . additionalInfo ) {
Object . . . additionalInfo ) {
logEntityAction ( tenantId , entityId , entity , customerId , actionType , user , additionalInfo ) ;
logEntityAction ( tenantId , entityId , entity , customerId , actionType , user , additionalInfo ) ;
if ( sendToEdge ) {
if ( sendToEdge ) {
sendEntityAssignToCustomerNotificationMsg ( tenantId , entityId , customerId , edgeActionType ) ;
sendEntityAssignToCustomerNotificationMsg ( tenantId , entityId , customerId , edgeTypeBy ActionType ( actionType ) ) ;
}
}
}
}
@ -122,7 +143,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
public < E extends HasName , I extends EntityId > void notifyAssignOrUnassignEntityToEdge ( TenantId tenantId , I entityId ,
public < E extends HasName , I extends EntityId > void notifyAssignOrUnassignEntityToEdge ( TenantId tenantId , I entityId ,
CustomerId customerId , EdgeId edgeId ,
CustomerId customerId , EdgeId edgeId ,
E entity , ActionType actionType ,
E entity , ActionType actionType ,
Security User user , Object . . . additionalInfo ) {
User user , Object . . . additionalInfo ) {
logEntityAction ( tenantId , entityId , entity , customerId , actionType , user , additionalInfo ) ;
logEntityAction ( tenantId , entityId , entity , customerId , actionType , user , additionalInfo ) ;
sendEntityAssignToEdgeNotificationMsg ( tenantId , edgeId , entityId , edgeTypeByActionType ( actionType ) ) ;
sendEntityAssignToEdgeNotificationMsg ( tenantId , edgeId , entityId , edgeTypeByActionType ( actionType ) ) ;
}
}
@ -142,14 +163,14 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
@Override
@Override
public void notifyCreateOrUpdateDevice ( TenantId tenantId , DeviceId deviceId , CustomerId customerId ,
public void notifyCreateOrUpdateDevice ( TenantId tenantId , DeviceId deviceId , CustomerId customerId ,
Device device , Device oldDevice , ActionType actionType ,
Device device , Device oldDevice , ActionType actionType ,
Security User user , Object . . . additionalInfo ) {
User user , Object . . . additionalInfo ) {
tbClusterService . onDeviceUpdated ( device , oldDevice ) ;
tbClusterService . onDeviceUpdated ( device , oldDevice ) ;
logEntityAction ( tenantId , deviceId , device , customerId , actionType , user , additionalInfo ) ;
logEntityAction ( tenantId , deviceId , device , customerId , actionType , user , additionalInfo ) ;
}
}
@Override
@Override
public void notifyDeleteDevice ( TenantId tenantId , DeviceId deviceId , CustomerId customerId , Device device ,
public void notifyDeleteDevice ( TenantId tenantId , DeviceId deviceId , CustomerId customerId , Device device ,
List < EdgeId > relatedEdgeIds , Security User user , Object . . . additionalInfo ) {
List < EdgeId > relatedEdgeIds , User user , Object . . . additionalInfo ) {
gatewayNotificationsService . onDeviceDeleted ( device ) ;
gatewayNotificationsService . onDeviceDeleted ( device ) ;
tbClusterService . onDeviceDeleted ( device , null ) ;
tbClusterService . onDeviceDeleted ( device , null ) ;
@ -158,7 +179,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
@Override
@Override
public void notifyUpdateDeviceCredentials ( TenantId tenantId , DeviceId deviceId , CustomerId customerId , Device device ,
public void notifyUpdateDeviceCredentials ( TenantId tenantId , DeviceId deviceId , CustomerId customerId , Device device ,
DeviceCredentials deviceCredentials , Security User user ) {
DeviceCredentials deviceCredentials , User user ) {
tbClusterService . pushMsgToCore ( new DeviceCredentialsUpdateNotificationMsg ( tenantId , deviceCredentials . getDeviceId ( ) , deviceCredentials ) , null ) ;
tbClusterService . pushMsgToCore ( new DeviceCredentialsUpdateNotificationMsg ( tenantId , deviceCredentials . getDeviceId ( ) , deviceCredentials ) , null ) ;
sendEntityNotificationMsg ( tenantId , deviceId , EdgeEventActionType . CREDENTIALS_UPDATED ) ;
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 , deviceCredentials ) ;
@ -166,13 +187,15 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
@Override
@Override
public void notifyAssignDeviceToTenant ( TenantId tenantId , TenantId newTenantId , DeviceId deviceId , CustomerId customerId ,
public void notifyAssignDeviceToTenant ( TenantId tenantId , TenantId newTenantId , DeviceId deviceId , CustomerId customerId ,
Device device , Tenant tenant , Security User user , Object . . . additionalInfo ) {
Device device , Tenant tenant , User user , Object . . . additionalInfo ) {
logEntityAction ( tenantId , deviceId , device , customerId , ActionType . ASSIGNED_TO_TENANT , user , additionalInfo ) ;
logEntityAction ( tenantId , deviceId , device , customerId , ActionType . ASSIGNED_TO_TENANT , user , additionalInfo ) ;
pushAssignedFromNotification ( tenant , newTenantId , device ) ;
pushAssignedFromNotification ( tenant , newTenantId , device ) ;
}
}
@Override
@Override
public < E extends HasName , I extends EntityId > void notifyCreateOrUpdateEntity ( TenantId tenantId , I entityId , E entity , CustomerId customerId , ActionType actionType , SecurityUser user , Object . . . additionalInfo ) {
public < E extends HasName , I extends EntityId > void notifyCreateOrUpdateEntity ( TenantId tenantId , I entityId , E entity ,
CustomerId customerId , ActionType actionType ,
User user , Object . . . additionalInfo ) {
logEntityAction ( tenantId , entityId , entity , customerId , actionType , user , additionalInfo ) ;
logEntityAction ( tenantId , entityId , entity , customerId , actionType , user , additionalInfo ) ;
if ( actionType = = ActionType . UPDATED ) {
if ( actionType = = ActionType . UPDATED ) {
sendEntityNotificationMsg ( tenantId , entityId , EdgeEventActionType . UPDATED ) ;
sendEntityNotificationMsg ( tenantId , entityId , EdgeEventActionType . UPDATED ) ;
@ -180,8 +203,8 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
}
}
@Override
@Override
public void notifyEdge ( TenantId tenantId , EdgeId edgeId , CustomerId customerId , Edge edge , ActionType actionType ,
public void notifyEdge ( TenantId tenantId , EdgeId edgeId , CustomerId customerId , Edge edge ,
Security User user , Object . . . additionalInfo ) {
ActionType actionType , User user , Object . . . additionalInfo ) {
ComponentLifecycleEvent lifecycleEvent ;
ComponentLifecycleEvent lifecycleEvent ;
EdgeEventActionType edgeEventActionType = null ;
EdgeEventActionType edgeEventActionType = null ;
switch ( actionType ) {
switch ( actionType ) {
@ -216,53 +239,34 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
}
}
@Override
@Override
public void notifyCreateOrUpdateAlarm ( Alarm alarm , ActionType actionType , Security User user , Object . . . additionalInfo ) {
public void notifyCreateOrUpdateAlarm ( Alarm alarm , ActionType actionType , User user , Object . . . additionalInfo ) {
logEntityAction ( alarm . getTenantId ( ) , alarm . getOriginator ( ) , alarm , alarm . getCustomerId ( ) , actionType , user , additionalInfo ) ;
logEntityAction ( alarm . getTenantId ( ) , alarm . getOriginator ( ) , alarm , alarm . getCustomerId ( ) , actionType , user , additionalInfo ) ;
sendEntityNotificationMsg ( alarm . getTenantId ( ) , alarm . getId ( ) , edgeTypeByActionType ( actionType ) ) ;
sendEntityNotificationMsg ( alarm . getTenantId ( ) , alarm . getId ( ) , edgeTypeByActionType ( actionType ) ) ;
}
}
@Override
@Override
public < E extends HasName , I extends EntityId > void notifyCreateOrUpdateOrDelete ( TenantId tenantId , CustomerId customerId ,
public < E extends HasName , I extends EntityId > void notifyCreateOrUpdateOrDelete ( TenantId tenantId , CustomerId customerId ,
I entityId , E entity , Security User user ,
I entityId , E entity , User user ,
ActionType actionType , boolean sendNotifyMsgToEdge , Exception e ,
ActionType actionType , boolean sendNotifyMsgToEdge , Exception e ,
Object . . . additionalInfo ) {
Object . . . additionalInfo ) {
notifyEntity ( tenantId , entityId , entity , customerId , actionType , user , e , additionalInfo ) ;
logEntityAction ( tenantId , entityId , entity , customerId , actionType , user , e , additionalInfo ) ;
if ( sendNotifyMsgToEdge ) {
if ( sendNotifyMsgToEdge ) {
sendEntityNotificationMsg ( tenantId , entityId , edgeTypeByActionType ( actionType ) ) ;
sendEntityNotificationMsg ( tenantId , entityId , edgeTypeByActionType ( actionType ) ) ;
}
}
}
}
@Override
@Override
public void notifyCreateOrUpdateOrDeleteRelation ( TenantId tenantId , CustomerId customerId ,
public void notifyRelation ( TenantId tenantId , CustomerId customerId , EntityRelation relation , User user ,
EntityRelation relation , SecurityUser user ,
ActionType actionType , Object . . . additionalInfo ) {
ActionType actionType , Exception e ,
logEntityAction ( tenantId , relation . getFrom ( ) , null , customerId , actionType , user , additionalInfo ) ;
Object . . . additionalInfo ) {
logEntityAction ( tenantId , relation . getTo ( ) , null , customerId , actionType , user , additionalInfo ) ;
notifyEntity ( tenantId , relation . getFrom ( ) , null , customerId , actionType , user , e , additionalInfo ) ;
try {
notifyEntity ( tenantId , relation . getTo ( ) , null , customerId , actionType , user , e , additionalInfo ) ;
if ( ! relation . getFrom ( ) . getEntityType ( ) . equals ( EntityType . EDGE ) & & ! relation . getTo ( ) . getEntityType ( ) . equals ( EntityType . EDGE ) ) {
if ( e = = null ) {
sendNotificationMsgToEdge ( tenantId , null , null , JacksonUtil . toString ( relation ) ,
try {
EdgeEventType . RELATION , edgeTypeByActionType ( actionType ) ) ;
if ( ! relation . getFrom ( ) . getEntityType ( ) . equals ( EntityType . EDGE ) & &
! relation . getTo ( ) . getEntityType ( ) . equals ( EntityType . EDGE ) ) {
sendNotificationMsgToEdge ( tenantId , null , null , json . writeValueAsString ( relation ) ,
EdgeEventType . RELATION , edgeTypeByActionType ( actionType ) ) ;
}
} catch ( Exception e1 ) {
log . warn ( "Failed to push relation to core: {}" , relation , e1 ) ;
}
}
}
} catch ( Exception e ) {
}
log . warn ( "Failed to push relation to core: {}" , relation , e ) ;
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 ) {
entityActionService . logEntityAction ( user , entityId , entity , customerId , actionType , e , additionalInfo ) ;
} else if ( e = = null ) {
entityActionService . pushEntityActionToRuleEngine ( entityId , entity , tenantId , customerId , actionType , null , additionalInfo ) ;
}
}
}
}
@ -272,7 +276,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
private void sendEntityAssignToCustomerNotificationMsg ( TenantId tenantId , EntityId entityId , CustomerId customerId , EdgeEventActionType action ) {
private void sendEntityAssignToCustomerNotificationMsg ( TenantId tenantId , EntityId entityId , CustomerId customerId , EdgeEventActionType action ) {
try {
try {
sendNotificationMsgToEdge ( tenantId , null , entityId , json . writeValueAs String( customerId ) , null , action ) ;
sendNotificationMsgToEdge ( tenantId , null , entityId , JacksonUtil . to String( customerId ) , null , action ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
log . warn ( "Failed to push assign/unassign to/from customer to core: {}" , customerId , e ) ;
log . warn ( "Failed to push assign/unassign to/from customer to core: {}" , customerId , e ) ;
}
}
@ -306,14 +310,16 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
sendNotificationMsgToEdge ( tenantId , edgeId , entityId , null , null , action ) ;
sendNotificationMsgToEdge ( tenantId , edgeId , entityId , null , null , action ) ;
}
}
private void sendNotificationMsgToEdge ( TenantId tenantId , EdgeId edgeId , EntityId entityId , String body , EdgeEventType type , EdgeEventActionType action ) {
private void sendNotificationMsgToEdge ( TenantId tenantId , EdgeId edgeId , EntityId entityId , String body ,
EdgeEventType type , EdgeEventActionType action ) {
tbClusterService . sendNotificationMsgToEdge ( tenantId , edgeId , entityId , body , type , action ) ;
tbClusterService . sendNotificationMsgToEdge ( tenantId , edgeId , entityId , body , type , action ) ;
}
}
private void pushAssignedFromNotification ( Tenant currentTenant , TenantId newTenantId , Device assignedDevice ) {
private void pushAssignedFromNotification ( Tenant currentTenant , TenantId newTenantId , Device assignedDevice ) {
String data = entityToStr ( assignedDevice ) ;
String data = JacksonUtil . toString ( JacksonUtil . valueToTree ( assignedDevice ) ) ;
if ( data ! = null ) {
if ( data ! = null ) {
TbMsg tbMsg = TbMsg . newMsg ( DataConstants . ENTITY_ASSIGNED_FROM_TENANT , assignedDevice . getId ( ) , assignedDevice . getCustomerId ( ) , getMetaDataForAssignedFrom ( currentTenant ) , TbMsgDataType . JSON , data ) ;
TbMsg tbMsg = TbMsg . newMsg ( DataConstants . ENTITY_ASSIGNED_FROM_TENANT , assignedDevice . getId ( ) ,
assignedDevice . getCustomerId ( ) , getMetaDataForAssignedFrom ( currentTenant ) , TbMsgDataType . JSON , data ) ;
tbClusterService . pushMsgToRuleEngine ( newTenantId , assignedDevice . getId ( ) , tbMsg , null ) ;
tbClusterService . pushMsgToRuleEngine ( newTenantId , assignedDevice . getId ( ) , tbMsg , null ) ;
}
}
}
}
@ -325,15 +331,6 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
return metaData ;
return metaData ;
}
}
private < E extends HasName > String entityToStr ( E entity ) {
try {
return json . writeValueAsString ( json . valueToTree ( entity ) ) ;
} catch ( JsonProcessingException e ) {
log . warn ( "[{}] Failed to convert entity to string!" , entity , e ) ;
}
return null ;
}
public static EdgeEventActionType edgeTypeByActionType ( ActionType actionType ) {
public static EdgeEventActionType edgeTypeByActionType ( ActionType actionType ) {
switch ( actionType ) {
switch ( actionType ) {
case ADDED :
case ADDED :