|
|
|
@ -17,6 +17,7 @@ package org.thingsboard.server.dao.notification; |
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.context.ApplicationEventPublisher; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.thingsboard.server.common.data.EntityType; |
|
|
|
import org.thingsboard.server.common.data.id.EntityId; |
|
|
|
@ -31,6 +32,7 @@ import org.thingsboard.server.common.data.notification.NotificationRequestStatus |
|
|
|
import org.thingsboard.server.common.data.page.PageData; |
|
|
|
import org.thingsboard.server.common.data.page.PageLink; |
|
|
|
import org.thingsboard.server.dao.entity.EntityDaoService; |
|
|
|
import org.thingsboard.server.dao.eventsourcing.DeleteEntityEvent; |
|
|
|
import org.thingsboard.server.dao.service.DataValidator; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
@ -43,6 +45,8 @@ public class DefaultNotificationRequestService implements NotificationRequestSer |
|
|
|
|
|
|
|
private final NotificationRequestDao notificationRequestDao; |
|
|
|
|
|
|
|
private final ApplicationEventPublisher eventPublisher; |
|
|
|
|
|
|
|
private final NotificationRequestValidator notificationRequestValidator = new NotificationRequestValidator(); |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -83,8 +87,9 @@ public class DefaultNotificationRequestService implements NotificationRequestSer |
|
|
|
|
|
|
|
// ON DELETE CASCADE is used: notifications for request are deleted as well
|
|
|
|
@Override |
|
|
|
public void deleteNotificationRequest(TenantId tenantId, NotificationRequestId requestId) { |
|
|
|
notificationRequestDao.removeById(tenantId, requestId.getId()); |
|
|
|
public void deleteNotificationRequest(TenantId tenantId, NotificationRequest request) { |
|
|
|
notificationRequestDao.removeById(tenantId, request.getUuidId()); |
|
|
|
eventPublisher.publishEvent(DeleteEntityEvent.builder().tenantId(tenantId).entity(request).entityId(request.getId()).build()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|