refactoring: EntityRelationController comments1
This commit is contained in:
parent
71b81f984a
commit
d74459d891
@ -127,12 +127,7 @@ public class EntityRelationController extends BaseController {
|
|||||||
checkParameter("entityType", strType);
|
checkParameter("entityType", strType);
|
||||||
EntityId entityId = EntityIdFactory.getByTypeAndId(strType, strId);
|
EntityId entityId = EntityIdFactory.getByTypeAndId(strType, strId);
|
||||||
checkEntityId(entityId, Operation.WRITE);
|
checkEntityId(entityId, Operation.WRITE);
|
||||||
try {
|
tbEntityRelationService.deleteRelations (getTenantId(), getCurrentUser().getCustomerId(), entityId, getCurrentUser());
|
||||||
tbEntityRelationService.deleteRelations (getTenantId(), getCurrentUser().getCustomerId(), entityId, getCurrentUser(), null);
|
|
||||||
} catch (Exception e) {
|
|
||||||
tbEntityRelationService.deleteRelations (getTenantId(), getCurrentUser().getCustomerId(), entityId, getCurrentUser(), e);
|
|
||||||
throw handleException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "Get Relation (getRelation)",
|
@ApiOperation(value = "Get Relation (getRelation)",
|
||||||
|
|||||||
@ -64,10 +64,13 @@ public class DefaultTbEntityRelationService extends AbstractTbEntityService impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteRelations(TenantId tenantId, CustomerId customerId, EntityId entityId, SecurityUser user, Exception e) throws ThingsboardException {
|
public void deleteRelations(TenantId tenantId, CustomerId customerId, EntityId entityId, SecurityUser user) throws ThingsboardException {
|
||||||
if (e == null) {
|
try {
|
||||||
relationService.deleteEntityRelations(tenantId, entityId);
|
relationService.deleteEntityRelations(tenantId, entityId);
|
||||||
|
notificationEntityService.notifyEntity(tenantId, entityId, null, customerId, ActionType.RELATIONS_DELETED, user, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
notificationEntityService.notifyEntity(tenantId, entityId, null, customerId, ActionType.RELATIONS_DELETED, user, e);
|
||||||
|
throw handleException(e);
|
||||||
}
|
}
|
||||||
notificationEntityService.notifyEntity(tenantId, entityId, null, customerId, ActionType.RELATIONS_DELETED, user, e);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,6 @@ public interface TbEntityRelationService {
|
|||||||
|
|
||||||
void delete (TenantId tenantId, CustomerId customerId, EntityRelation entity, SecurityUser user) throws ThingsboardException;
|
void delete (TenantId tenantId, CustomerId customerId, EntityRelation entity, SecurityUser user) throws ThingsboardException;
|
||||||
|
|
||||||
void deleteRelations (TenantId tenantId, CustomerId customerId, EntityId entityId, SecurityUser user, Exception e) throws ThingsboardException;
|
void deleteRelations (TenantId tenantId, CustomerId customerId, EntityId entityId, SecurityUser user) throws ThingsboardException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user