refactoring: - dashboard comments3
This commit is contained in:
parent
8232fc4b70
commit
c61a50afe5
@ -75,11 +75,11 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
|
|||||||
sendDeleteNotificationMsg(tenantId, entityId, entity, relatedEdgeIds);
|
sendDeleteNotificationMsg(tenantId, entityId, entity, relatedEdgeIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <E extends HasName, I extends EntityId> void notifyDeleteEntityAlarm(TenantId tenantId, I entityId, E entity, EntityId originatorId,
|
public <E extends HasName, I extends EntityId> void notifyDeleteAlarm(TenantId tenantId, I entityId, E entity, EntityId originatorId,
|
||||||
CustomerId customerId, ActionType actionType,
|
CustomerId customerId, ActionType actionType,
|
||||||
List<EdgeId> relatedEdgeIds,
|
List<EdgeId> relatedEdgeIds,
|
||||||
SecurityUser user,
|
SecurityUser user,
|
||||||
String body, Object... additionalInfo) {
|
String body, Object... additionalInfo) {
|
||||||
logEntityAction(tenantId, originatorId, entity, customerId, actionType, user, additionalInfo);
|
logEntityAction(tenantId, originatorId, entity, customerId, actionType, user, additionalInfo);
|
||||||
sendAlarmDeleteNotificationMsg(tenantId, entityId, entity, relatedEdgeIds, body);
|
sendAlarmDeleteNotificationMsg(tenantId, entityId, entity, relatedEdgeIds, body);
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
|
|||||||
gatewayNotificationsService.onDeviceDeleted(device);
|
gatewayNotificationsService.onDeviceDeleted(device);
|
||||||
tbClusterService.onDeviceDeleted(device, null);
|
tbClusterService.onDeviceDeleted(device, null);
|
||||||
|
|
||||||
notifyDeleteEntity(tenantId, deviceId, device, customerId, ActionType.DELETED, relatedEdgeIds, user,null, additionalInfo);
|
notifyDeleteEntity(tenantId, deviceId, device, customerId, ActionType.DELETED, relatedEdgeIds, user, additionalInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -48,10 +48,10 @@ public interface TbNotificationEntityService {
|
|||||||
List<EdgeId> relatedEdgeIds,
|
List<EdgeId> relatedEdgeIds,
|
||||||
SecurityUser user, Object... additionalInfo);
|
SecurityUser user, Object... additionalInfo);
|
||||||
|
|
||||||
<E extends HasName, I extends EntityId> void notifyDeleteEntityAlarm(TenantId tenantId, I entityId, E entity, EntityId originatorId,
|
<E extends HasName, I extends EntityId> void notifyDeleteAlarm(TenantId tenantId, I entityId, E entity, EntityId originatorId,
|
||||||
CustomerId customerId, ActionType actionType,
|
CustomerId customerId, ActionType actionType,
|
||||||
List<EdgeId> relatedEdgeIds,
|
List<EdgeId> relatedEdgeIds,
|
||||||
SecurityUser user, String body, Object... additionalInfo);
|
SecurityUser user, String body, Object... additionalInfo);
|
||||||
|
|
||||||
<E extends HasName, I extends EntityId> void notifyAssignOrUnassignEntityToCustomer(TenantId tenantId, I entityId,
|
<E extends HasName, I extends EntityId> void notifyAssignOrUnassignEntityToCustomer(TenantId tenantId, I entityId,
|
||||||
CustomerId customerId, E entity,
|
CustomerId customerId, E entity,
|
||||||
|
|||||||
@ -80,7 +80,7 @@ public class DefaultTbAlarmService extends AbstractTbEntityService implements Tb
|
|||||||
public Boolean delete(Alarm alarm, SecurityUser user) throws ThingsboardException {
|
public Boolean delete(Alarm alarm, SecurityUser user) throws ThingsboardException {
|
||||||
try {
|
try {
|
||||||
List<EdgeId> relatedEdgeIds = findRelatedEdgeIds(user.getTenantId(), alarm.getOriginator());
|
List<EdgeId> relatedEdgeIds = findRelatedEdgeIds(user.getTenantId(), alarm.getOriginator());
|
||||||
notificationEntityService.notifyDeleteEntityAlarm(user.getTenantId(), alarm.getId(), alarm, alarm.getOriginator(), user.getCustomerId(),
|
notificationEntityService.notifyDeleteAlarm(user.getTenantId(), alarm.getId(), alarm, alarm.getOriginator(), user.getCustomerId(),
|
||||||
ActionType.DELETED, relatedEdgeIds, user, JacksonUtil.OBJECT_MAPPER.writeValueAsString(alarm));
|
ActionType.DELETED, relatedEdgeIds, user, JacksonUtil.OBJECT_MAPPER.writeValueAsString(alarm));
|
||||||
return alarmService.deleteAlarm(user.getTenantId(), alarm.getId()).isSuccessful();
|
return alarmService.deleteAlarm(user.getTenantId(), alarm.getId()).isSuccessful();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -62,12 +62,12 @@ public class DefaultTbAssetService extends AbstractTbEntityService implements Tb
|
|||||||
List<EdgeId> relatedEdgeIds = findRelatedEdgeIds(tenantId, assetId);
|
List<EdgeId> relatedEdgeIds = findRelatedEdgeIds(tenantId, assetId);
|
||||||
assetService.deleteAsset(tenantId, assetId);
|
assetService.deleteAsset(tenantId, assetId);
|
||||||
notificationEntityService.notifyDeleteEntity(tenantId, assetId, asset, asset.getCustomerId(), ActionType.DELETED,
|
notificationEntityService.notifyDeleteEntity(tenantId, assetId, asset, asset.getCustomerId(), ActionType.DELETED,
|
||||||
relatedEdgeIds, user, null, asset.toString());
|
relatedEdgeIds, user, assetId.toString());
|
||||||
|
|
||||||
return removeAlarmsByEntityId(tenantId, assetId);
|
return removeAlarmsByEntityId(tenantId, assetId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
notificationEntityService.notifyEntity(tenantId, emptyId(EntityType.ASSET), null, null,
|
notificationEntityService.notifyEntity(tenantId, emptyId(EntityType.ASSET), null, null,
|
||||||
ActionType.DELETED, user, e, asset.toString());
|
ActionType.DELETED, user, e, assetId.toString());
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,10 +62,11 @@ public class DefaultTbCustomerService extends AbstractTbEntityService implements
|
|||||||
List<EdgeId> relatedEdgeIds = findRelatedEdgeIds(tenantId, customerId);
|
List<EdgeId> relatedEdgeIds = findRelatedEdgeIds(tenantId, customerId);
|
||||||
customerService.deleteCustomer(tenantId, customerId);
|
customerService.deleteCustomer(tenantId, customerId);
|
||||||
notificationEntityService.notifyDeleteEntity(tenantId, customerId, customer, customerId,
|
notificationEntityService.notifyDeleteEntity(tenantId, customerId, customer, customerId,
|
||||||
ActionType.DELETED, relatedEdgeIds, user, null);
|
ActionType.DELETED, relatedEdgeIds, user, customerId.toString());
|
||||||
tbClusterService.broadcastEntityStateChangeEvent(tenantId, customerId, ComponentLifecycleEvent.DELETED);
|
tbClusterService.broadcastEntityStateChangeEvent(tenantId, customerId, ComponentLifecycleEvent.DELETED);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
notificationEntityService.notifyEntity(tenantId, emptyId(EntityType.CUSTOMER), null, null, ActionType.DELETED, user, e);
|
notificationEntityService.notifyEntity(tenantId, emptyId(EntityType.CUSTOMER), null, null,
|
||||||
|
ActionType.DELETED, user, e, customerId.toString());
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,7 +65,7 @@ public class DefaultTbDashboardService extends AbstractTbEntityService implement
|
|||||||
List<EdgeId> relatedEdgeIds = findRelatedEdgeIds(tenantId, dashboardId);
|
List<EdgeId> relatedEdgeIds = findRelatedEdgeIds(tenantId, dashboardId);
|
||||||
dashboardService.deleteDashboard(tenantId, dashboardId);
|
dashboardService.deleteDashboard(tenantId, dashboardId);
|
||||||
notificationEntityService.notifyDeleteEntity(tenantId, dashboardId, dashboard, user.getCustomerId(),
|
notificationEntityService.notifyDeleteEntity(tenantId, dashboardId, dashboard, user.getCustomerId(),
|
||||||
ActionType.DELETED, relatedEdgeIds, user, null);
|
ActionType.DELETED, relatedEdgeIds, user, dashboardId.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
notificationEntityService.notifyEntity(tenantId, emptyId(EntityType.DASHBOARD), null, null,
|
notificationEntityService.notifyEntity(tenantId, emptyId(EntityType.DASHBOARD), null, null,
|
||||||
ActionType.DELETED, user, e, dashboardId.toString());
|
ActionType.DELETED, user, e, dashboardId.toString());
|
||||||
|
|||||||
@ -69,9 +69,9 @@ public class DefaultTbEdgeService extends AbstractTbEntityService implements TbE
|
|||||||
try {
|
try {
|
||||||
edgeService.deleteEdge(tenantId, edgeId);
|
edgeService.deleteEdge(tenantId, edgeId);
|
||||||
notificationEntityService.notifyEdge(tenantId, edgeId, edge.getCustomerId(), edge, actionType, user, edgeId.toString());
|
notificationEntityService.notifyEdge(tenantId, edgeId, edge.getCustomerId(), edge, actionType, user, edgeId.toString());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
notificationEntityService.notifyEntity(tenantId, emptyId(EntityType.EDGE), edge, null, actionType, user, e);
|
notificationEntityService.notifyEntity(tenantId, emptyId(EntityType.EDGE), edge, null, actionType,
|
||||||
|
user, e, edgeId.toString());
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user