From bf44c985b746f4297aadd84a8cedb1517df0f98c Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Tue, 3 May 2022 11:02:17 +0200 Subject: [PATCH] added some debug logs --- .../networking/ws/methods/v2/Notifications.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Notifications.java b/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Notifications.java index 5a1bb41..0424ad9 100644 --- a/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Notifications.java +++ b/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Notifications.java @@ -186,20 +186,25 @@ public class Notifications { Caller caller = AuthorizationProvider.instance.get(); String context = ScopeProvider.instance.get(); String username = caller.getClient().getId(); + + logger.debug("workspace notifications from user = " + username); if (!message.getType().getNotificationClass().isInstance(message)) { //invalid call return Response.status(Status.BAD_REQUEST).build(); } - + logger.debug("workspace notifications request is correct, handling it"); ResponseBean responseBean = new ResponseBean(); Status status = Status.OK; - try{ + try { + logger.debug("workspace notifications type is " + message.getType()); SocialNetworkingSite site = SocialNetworkingSiteFinder.getSocialNetworkingSiteFromScope(context); GCubeUser senderUser = UserManagerWSBuilder.getInstance().getUserManager().getUserByUsername(username); SocialNetworkingUser user = new SocialNetworkingUser(senderUser.getUsername(), senderUser.getEmail(), senderUser.getFullname(), senderUser.getUserAvatarURL()); - NotificationsManager nm = new ApplicationNotificationsManager(UserManagerWSBuilder.getInstance().getUserManager(), site, context, user); + NotificationsManager nm = new ApplicationNotificationsManager(UserManagerWSBuilder.getInstance().getUserManager(), site, context, user); + + switch (message.getType()) { case ITEM_NEW: { WorkspaceNotificationAddedItem itemBean = (WorkspaceNotificationAddedItem) message; @@ -230,7 +235,9 @@ public class Notifications { responseBean.setMessage(e.getMessage()); status = Status.INTERNAL_SERVER_ERROR; } - + logger.debug("workspace notifications should have been sent"); + responseBean.setSuccess(true); + responseBean.setMessage("Workspace notification delivered correctly"); return Response.status(status).entity(responseBean).build(); }