enhanced to read portal sender email from portal property file, removed periods at the end of notification emails.

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@117206 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-07-13 17:37:32 +00:00
parent 86fa0951cc
commit aa32741422
1 changed files with 55 additions and 47 deletions

View File

@ -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: "
+ "<div style=\"margin-top: 10px; margin-bottom: 10px; margin-left: 50px; padding-left: 15px; border-left: 3px solid #ccc; font-style: italic;\">\""
+ escapeHtml(feedText) +"\"</div>",
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: "
+ "<div style=\"margin-top: 10px; margin-bottom: 10px; margin-left: 50px; padding-left: 15px; border-left: 3px solid #ccc; font-style: italic;\">\""
+ escapeHtml(commentText) +"\"</div>"
:
"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: "
+ "<div style=\"margin-top: 10px; margin-bottom: 10px; margin-left: 50px; padding-left: 15px; border-left: 3px solid #ccc; font-style: italic;\">\""
+ escapeHtml(commentText) +"\"</div>";
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: "
+ "<div style=\"margin-top: 10px; margin-bottom: 10px; margin-left: 50px; padding-left: 15px; border-left: 3px solid #ccc; font-style: italic;\">\""
+ escapeHtml(commentText) +"\"</div>",
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);
}
}