diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java index 41f52a7..d094eb4 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java @@ -47,6 +47,20 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen public ApplicationNotificationsManager(ASLSession session, String portletClassName) { super(session, portletClassName); } + /** + * actually save the notification to the store + * @param notification2Save the notification instance to save + * @return true if the notification was sent ok + */ + private boolean saveNotification(Notification notification2Save) { + _log.trace("Trying to send notification to: " + notification2Save.getUserid() + " Type: " + notification2Save.getType()); + boolean result = getStoreInstance().saveNotification(notification2Save); + if (result) + _log.trace("Notification Saved Successfully! "); + else + _log.error("While trying to save Notification"); + return result; + } /** * {@inheritDoc} * @throws InternalErrorException @@ -66,7 +80,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + return saveNotification(not); } /** * {@inheritDoc} @@ -91,7 +105,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + return saveNotification(not); } /** * {@inheritDoc} @@ -113,7 +127,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + return saveNotification(not); } /** * {@inheritDoc} @@ -134,7 +148,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + return saveNotification(not); } /** * {@inheritDoc} @@ -155,7 +169,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + return saveNotification(not); } /** * {@inheritDoc} @@ -176,7 +190,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + return saveNotification(not); } /** * {@inheritDoc} @@ -196,7 +210,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + return saveNotification(not); } /** * {@inheritDoc} @@ -215,7 +229,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUsername(), aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + return saveNotification(not); } /** * {@inheritDoc} @@ -242,7 +256,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUsername(), aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + return saveNotification(not); } /** * {@inheritDoc} @@ -269,7 +283,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUsername(), aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + return saveNotification(not); } /** * {@inheritDoc} @@ -288,8 +302,11 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUsername(), aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + return saveNotification(not); } + /** + * {@inheritDoc} + */ @Override public boolean notifyDocumentWorkflowTaskRequest(String userIdToNotify, String documentWorkflowId, String documentName, String assignedRoleName) { Notification not = new Notification( @@ -299,16 +316,18 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen documentWorkflowId, //the workflowid new Date(), "?oid="+documentWorkflowId, - "has involved you on the document workflow with name: " + escapeHtml(documentName) + " " + - "and has assigned you the following role: " + assignedRoleName +". The VRE used was " + aslSession.getGroupName(), + "has involved you in a Document Workflow (" + escapeHtml(documentName) + ") " + + "and has assigned you the role: " + assignedRoleName +". The VRE used was " + aslSession.getGroupName(), false, aslSession.getUsername(), aslSession.getUserFullName(), aslSession.getUserAvatarId()); - return getStoreInstance().saveNotification(not); + + return saveNotification(not); + } + - }