removed Email Notification, refactored the email subject

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portal/invites-common-library@126252 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-03-24 15:00:36 +00:00
parent 3eef63bd0c
commit 217f5fd371
1 changed files with 4 additions and 5 deletions

View File

@ -88,9 +88,10 @@ public class InvitesManager {
InviteOperationResult result = null; InviteOperationResult result = null;
boolean emailResult = false; boolean emailResult = false;
try { try {
String vreName = aslSession.getGroupName();
result = store.saveInvite(invite); result = store.saveInvite(invite);
emailResult = sendInviteEmail(request, aslSession, portalSenderEmail, portalURL, name, lastName, email, vreDescription); emailResult = sendInviteEmail(request, aslSession, portalSenderEmail, portalURL, name, lastName, email, vreDescription);
notifyInviteSent(username, aslSession.getScopeName(), portalURL, PortalContext.getConfiguration().getGatewayName(), invite); notifyInviteSent(username, aslSession.getScopeName(), portalURL, PortalContext.getConfiguration().getGatewayName(), invite, vreName);
} catch (AddressException e) { } catch (AddressException e) {
_log.error("Email not valid " + e.getMessage()); _log.error("Email not valid " + e.getMessage());
@ -292,10 +293,9 @@ public class InvitesManager {
* @param scope . * @param scope .
* @param optionalMessage . * @param optionalMessage .
*/ */
public static void notifyInviteSent(String username, String scope, String portalbasicurl, String gatewayName, Invite invite) { public static void notifyInviteSent(String username, String scope, String portalbasicurl, String gatewayName, Invite invite, String vreName) {
ArrayList<String> adminEmails = getAdministratorsEmails(scope); ArrayList<String> adminEmails = getAdministratorsEmails(scope);
StringBuffer body = new StringBuffer(); StringBuffer body = new StringBuffer();
body.append("<p>Dear manager of "+ scope +",<br />this email message was automatically generated by " + portalbasicurl +" to inform you that "); body.append("<p>Dear manager of "+ scope +",<br />this email message was automatically generated by " + portalbasicurl +" to inform you that ");
body.append("</p>"); body.append("</p>");
@ -307,8 +307,7 @@ public class InvitesManager {
String[] allMails = new String[adminEmails.size()]; String[] allMails = new String[adminEmails.size()];
adminEmails.toArray(allMails); adminEmails.toArray(allMails);
EmailNotification mailToAdmin = new EmailNotification(allMails , "[" + gatewayName + "] - Sent Invitation", body.toString()); EmailNotification mailToAdmin = new EmailNotification(allMails , "An invite was sent on " + vreName + " by " + invite.getSenderFullName(), body.toString());
mailToAdmin.sendEmail(); mailToAdmin.sendEmail();
} }