added support to alert the users of a VRE when posting in to a VRE. Added new notification mothod to support this
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@92661 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c6bc5e1bef
commit
bd160b5396
|
@ -395,6 +395,31 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean notifyPost(String userIdToNotify, String feedid, String feedText) {
|
||||
|
||||
StringBuilder notificationText = new StringBuilder();
|
||||
notificationText.append("posted a news on <b>").append(aslSession.getGroupName()).append(":</b>") // has done something
|
||||
.append("<br /><br /> ").append(escapeHtml(feedText)).append(". ")
|
||||
.append("<br /><br />Follow the discussion and comment it. ");
|
||||
|
||||
Notification not = new Notification(
|
||||
UUID.randomUUID().toString(),
|
||||
NotificationType.POST_ALERT,
|
||||
userIdToNotify, //user no notify
|
||||
feedid, //the post
|
||||
new Date(),
|
||||
getApplicationUrl()+"?oid="+feedid,
|
||||
notificationText.toString(),
|
||||
false,
|
||||
aslSession.getUsername(),
|
||||
aslSession.getUserFullName(),
|
||||
aslSession.getUserAvatarId());
|
||||
return saveNotification(not);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean notifyOwnCommentReply(String userIdToNotify, String feedid, String feedText) {
|
||||
Notification not = new Notification(
|
||||
UUID.randomUUID().toString(),
|
||||
|
@ -727,5 +752,5 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
|||
aslSession.getUserAvatarId());
|
||||
|
||||
return saveNotification(not);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,6 +136,15 @@ public interface NotificationsManager {
|
|||
* @return true if the notification is correctly delivered, false otherwise
|
||||
*/
|
||||
boolean notifyDeletedCalendarEvent(String userIdToNotify, String eventTitle, String eventType, Date startDate, Date endingDate);
|
||||
/**
|
||||
* use to notify a user that someone created this post
|
||||
*
|
||||
* @param userIdToNotify the user you want to notify
|
||||
* @param feedid the liked feedid
|
||||
* @param feedText the liked feed text or a portion of it
|
||||
* @return true if the notification is correctly delivered, false otherwise
|
||||
*/
|
||||
boolean notifyPost(String userIdToNotify, String feedid, String feedText);
|
||||
/**
|
||||
* use to notify a user that someone commented on his post
|
||||
*
|
||||
|
|
|
@ -99,14 +99,13 @@ public class EmailPlugin {
|
|||
try {
|
||||
// EMAIL SENDER
|
||||
Address from = new InternetAddress("no-reply@d4science.org");
|
||||
mimeMessage.setHeader("Content-Type", "text/html; charset=UTF-8");
|
||||
mimeMessage.setFrom(from);
|
||||
|
||||
Address address = new InternetAddress(email);
|
||||
mimeMessage.addRecipient(Message.RecipientType.TO, address);
|
||||
|
||||
mimeMessage.setSubject(getSubjectByNotificationType(notification2Save, portalUrl, vreName));
|
||||
// mimeMessage.setText(body);
|
||||
mimeMessage.setContent(getHTMLEmail(notification2Save, user.getFirstName(), portalUrl, email), "text/html");
|
||||
mimeMessage.setContent(getHTMLEmail(notification2Save, user.getFirstName(), portalUrl, email), "text/html; charset=UTF-8");
|
||||
mimeMessage.setSentDate(new Date());
|
||||
Transport.send(mimeMessage);
|
||||
_log.trace("notification email sent successfully");
|
||||
|
@ -143,6 +142,8 @@ public class EmailPlugin {
|
|||
return portalHost + ": Reply on your post notification";
|
||||
case MENTION:
|
||||
return portalHost + ": Mention in a post notification";
|
||||
case POST_ALERT:
|
||||
return portalHost + ": Important post shared notification";
|
||||
case REQUEST_CONNECTION:
|
||||
return portalHost + ": Connection request notification";
|
||||
case JOB_COMPLETED_NOK:
|
||||
|
@ -219,6 +220,9 @@ public class EmailPlugin {
|
|||
case OWN_COMMENT:
|
||||
actionLink.append("\">.").append(" See the Post").append("</a>");
|
||||
break;
|
||||
case POST_ALERT:
|
||||
actionLink.append("\">").append("See this News").append("</a>");
|
||||
break;
|
||||
case REQUEST_CONNECTION:
|
||||
actionLink.append("\">.").append(" Go to Contacts Center").append("</a>");
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue