diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java index 0db596a..bd7b92e 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java @@ -94,7 +94,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen } return result; } - + /** * return the url of the application if exists in the profile * @return . @@ -201,7 +201,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen return saveNotification(not); } - + /** * {@inheritDoc} * @throws InternalErrorException @@ -310,22 +310,22 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen public boolean notifyAddedItem(String userIdToNotify, WorkspaceItem item, WorkspaceSharedFolder sharedFolder) throws InternalErrorException { String notifyText = sharedFolder.isVreFolder() ? "added "+ item.getName() +" to the workspace group folder " + sharedFolder.getDisplayName() : - "added "+ item.getName() +" to your workspace shared folder "+ item.getPath().substring(0,item.getPath().lastIndexOf('/')); - - Notification not = new Notification( - UUID.randomUUID().toString(), - NotificationType.WP_ITEM_NEW, - userIdToNotify, //user no notify - item.getId(), //the - new Date(), - getApplicationUrl()+"?itemid="+item.getParent().getId(), - notifyText, - false, - aslSession.getUsername(), - aslSession.getUserFullName(), - aslSession.getUserAvatarId()); + "added "+ item.getName() +" to your workspace shared folder "+ item.getPath().substring(0,item.getPath().lastIndexOf('/')); - return saveNotification(not); + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.WP_ITEM_NEW, + userIdToNotify, //user no notify + item.getId(), //the + new Date(), + getApplicationUrl()+"?itemid="+item.getParent().getId(), + notifyText, + false, + aslSession.getUsername(), + aslSession.getUserFullName(), + aslSession.getUserAvatarId()); + + return saveNotification(not); } /** * {@inheritDoc} @@ -335,7 +335,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen public boolean notifyMovedItem(String userIdToNotify, WorkspaceItem item, WorkspaceSharedFolder sharedFolder) throws InternalErrorException { String notifyText = sharedFolder.isVreFolder() ? "removed item "+ item.getName() +" from the workspace group folder " + sharedFolder.getDisplayName(): "removed item "+ item.getName() +" from your workspace shared folder \""+ sharedFolder.getName()+"\""; - + Notification not = new Notification( UUID.randomUUID().toString(), NotificationType.WP_ITEM_DELETE, @@ -480,11 +480,13 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen feedid, //the post new Date(), "/group/data-e-infrastructure-gateway?oid="+feedid, - "commented on your post: " + escapeHtml(feedText), - false, - aslSession.getUsername(), - aslSession.getUserFullName(), - aslSession.getUserAvatarId()); + "commented on your post: " + + "
\"" + + escapeHtml(feedText) +"\"
", + false, + aslSession.getUsername(), + aslSession.getUserFullName(), + aslSession.getUserAvatarId()); return saveNotification(not); } /** @@ -493,22 +495,26 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen @Override public boolean notifyCommentReply(String userIdToNotify, String feedid, String commentText, String feedOwnerFullName, String feedOwnerId) { String notificationText = (aslSession.getUsername().compareTo(feedOwnerId) == 0) ? - "also commented on his post: " + escapeHtml(commentText) + "also commented on his post: " + + "
\"" + + escapeHtml(commentText) +"\"
" : - "also commented on " + feedOwnerFullName + "'s post: " + escapeHtml(commentText); - Notification not = new Notification( - UUID.randomUUID().toString(), - NotificationType.COMMENT, - userIdToNotify, //user no notify - feedid, //the post - new Date(), - "/group/data-e-infrastructure-gateway?oid="+feedid, - notificationText, - false, - aslSession.getUsername(), - aslSession.getUserFullName(), - aslSession.getUserAvatarId()); - return saveNotification(not); + "also commented on " + feedOwnerFullName + "'s post: " + + "
\"" + + escapeHtml(commentText) +"\"
"; + Notification not = new Notification( + UUID.randomUUID().toString(), + NotificationType.COMMENT, + userIdToNotify, //user no notify + feedid, //the post + new Date(), + "/group/data-e-infrastructure-gateway?oid="+feedid, + notificationText, + false, + aslSession.getUsername(), + aslSession.getUserFullName(), + aslSession.getUserAvatarId()); + return saveNotification(not); } /** * {@inheritDoc} @@ -522,11 +528,13 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen feedid, //the post new Date(), "/group/data-e-infrastructure-gateway?oid="+feedid, - "commented on one of your favorite posts: " + escapeHtml(commentText), - false, - aslSession.getUsername(), - aslSession.getUserFullName(), - aslSession.getUserAvatarId()); + "commented on one of your favorite posts: " + + "
\"" + + escapeHtml(commentText) +"\"
", + false, + aslSession.getUsername(), + aslSession.getUserFullName(), + aslSession.getUserAvatarId()); return saveNotification(not); } /** @@ -831,15 +839,15 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen public boolean notifyTDMObjectSharing(String userIdToNotify, NotificationType type, String tdmObjectName, String encodedTabularResourceParams) throws Exception { if (! (type == NotificationType.TDM_RULE_SHARE || type == NotificationType.TDM_TEMPLATE_SHARE)) throw new IllegalArgumentException("Type must be either TDM_RULE_SHARE or TDM_TEMPLATE_SHARE"); - + String notificationText = "shared the Tabular Data Manager"; notificationText += (type == NotificationType.TDM_RULE_SHARE) ? " Rule " : " Template "; notificationText += "\"" + tdmObjectName + "\" with you"; - + String url = getApplicationUrl(); if (encodedTabularResourceParams != null && encodedTabularResourceParams.compareTo("") != 0) url += "?"+encodedTabularResourceParams; - + Notification not = new Notification( UUID.randomUUID().toString(), type, @@ -852,7 +860,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen aslSession.getUsername(), aslSession.getUserFullName(), aslSession.getUserAvatarId()); - + return saveNotification(not); } }