From dffb0e61f817374048d610143bdc5158744fc5cc Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 16 Sep 2021 11:55:36 +0200 Subject: [PATCH] fixed notification confirm for SEB also for delete --- .../webservice/servicelayer/dao/ClientEventDAO.java | 3 +-- .../servicelayer/dao/impl/ClientEventDAOImpl.java | 4 +--- .../session/impl/SEBClientNotificationServiceImpl.java | 8 ++------ 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ClientEventDAO.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ClientEventDAO.java index 69360ea8..87a6f41b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ClientEventDAO.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ClientEventDAO.java @@ -59,9 +59,8 @@ public interface ClientEventDAO extends EntityDAO { /** Used to confirm a pending notification so that the notification is not pending anymore * * @param notificationId the notification identifier - * @param clientConnectionId the client connection identifier * @return Result refer to the confirmed notification or to en error when happened */ - Result confirmPendingNotification(Long notificationId, Long clientConnectionId); + Result confirmPendingNotification(Long notificationId); Result initPingEvent(Long connectionId); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java index ed2d7830..48b52537 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java @@ -277,9 +277,7 @@ public class ClientEventDAOImpl implements ClientEventDAO { @Override @Transactional - public Result confirmPendingNotification( - final Long notificationId, - final Long clientConnectionId) { + public Result confirmPendingNotification(final Long notificationId) { return Result.tryCatch(() -> { final Long pk = this.clientEventRecordMapper diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientNotificationServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientNotificationServiceImpl.java index 99bbc1f5..b69146fe 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientNotificationServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientNotificationServiceImpl.java @@ -86,9 +86,7 @@ public class SEBClientNotificationServiceImpl implements SEBClientNotificationSe final Long notificationId = (long) event.getValue(); this.clientEventDAO.getPendingNotificationByValue(clientConnection.id, notificationId) - .flatMap(notification -> this.clientEventDAO.confirmPendingNotification( - notificationId, - notification.connectionId)) + .flatMap(notification -> this.clientEventDAO.confirmPendingNotification(notification.id)) .map(this::removeFromCache) .onError(error -> log.error("Failed to confirm pending notification: {}", event, error)); @@ -107,9 +105,7 @@ public class SEBClientNotificationServiceImpl implements SEBClientNotificationSe return this.clientEventDAO.getPendingNotification(notificationId) .map(notification -> this.confirmClientSide(notification, examId, connectionToken)) - .flatMap(notification -> this.clientEventDAO.confirmPendingNotification( - notificationId, - notification.connectionId)) + .flatMap(notification -> this.clientEventDAO.confirmPendingNotification(notificationId)) .map(this::removeFromCache) .onError(error -> log.error("Failed to confirm pending notification: {}", notificationId, error)); }