added notifications-common-library

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/register-vre-users@119795 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-10-15 10:35:40 +00:00
parent 84b853c772
commit e9fd62542c
1 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.workspace.Workspace;
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portal.notifications.bean.GenericItemBean;
import org.gcube.portal.notifications.thread.MessageNotificationsThread;
import org.gcube.portlets.admin.manageusers.client.ManageUsersService;
import org.gcube.portlets.admin.manageusers.shared.PortalUserDTO;
@ -172,13 +173,16 @@ public class ManageUsersServiceImpl extends RemoteServiceServlet implements Man
List<String> recipientIds = new ArrayList<String>();
recipientIds.add(addressee.getId());
List<GenericItemBean> recipients = new ArrayList<GenericItemBean>();
recipients.add(new GenericItemBean(addressee.getId(), addressee.getId(), addressee.getName() + " " + addressee.getLastName(), ""));
String subject = "Registration to Group Notification";
String body = "Dear "+addressee.getName()+", \n\n" + session.getUserFullName() + " has registered you to the group " + getASLSession().getGroupName()+".";
String messageId = workspace.getWorkspaceMessageManager().sendMessageToPortalLogins(subject, body, new ArrayList<String>(), recipientIds);
_log.debug("Sending message notification to: " + recipientIds.toString());
NotificationsManager nm = new ApplicationNotificationsManager(getASLSession());
Thread thread = new Thread(new MessageNotificationsThread(recipientIds, messageId, subject, body, nm));
Thread thread = new Thread(new MessageNotificationsThread(recipients, messageId, subject, body, nm));
thread.start();
return (messageId != null);