Skip to content
Snippets Groups Projects
Commit 5c193ced authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Avoid recreating stuff in a loop

parent e8597cea
No related branches found
No related tags found
No related merge requests found
...@@ -642,20 +642,20 @@ public class UserBean { ...@@ -642,20 +642,20 @@ public class UserBean {
*/ */
public void informAdminOfConfirmedEmail(VipsLogicUser confirmUser, ResourceBundle i18nBundle, String serverName ) { public void informAdminOfConfirmedEmail(VipsLogicUser confirmUser, ResourceBundle i18nBundle, String serverName ) {
List<VipsLogicUser> organizationAdmins = this.findOrganizationUsersByRole(confirmUser.getOrganizationId(), Globals.ROLE_ORGANIZATION_ADMINISTRATOR); List<VipsLogicUser> organizationAdmins = this.findOrganizationUsersByRole(confirmUser.getOrganizationId(), Globals.ROLE_ORGANIZATION_ADMINISTRATOR);
String subject = i18nBundle.getString("informAdminOfConfirmedEmailSubject");
String body = MessageFormat.format(i18nBundle.getString("informAdminOfConfirmedEmailBody"),
confirmUser.getLastName(),
confirmUser.getApprovalApplication(),
Globals.PROTOCOL + "://" + serverName + "/user?action=viewUser&userId=" + confirmUser.getUserId(),
Globals.PROTOCOL + "://" + serverName + "/user?action=approveUser&userId=" + confirmUser.getUserId()
);
//System.out.println(body);
// Send email
String smtpServer = System.getProperty("no.nibio.vips.logic.SMTP_SERVER");
SimpleMailSender mailSender = new SimpleMailSender(smtpServer);
for(VipsLogicUser organizationAdmin: organizationAdmins) for(VipsLogicUser organizationAdmin: organizationAdmins)
{ {
String subject = i18nBundle.getString("informAdminOfConfirmedEmailSubject");
String body = MessageFormat.format(i18nBundle.getString("informAdminOfConfirmedEmailBody"),
confirmUser.getLastName(),
confirmUser.getApprovalApplication(),
Globals.PROTOCOL + "://" + serverName + "/user?action=viewUser&userId=" + confirmUser.getUserId(),
Globals.PROTOCOL + "://" + serverName + "/user?action=approveUser&userId=" + confirmUser.getUserId()
);
//System.out.println(body);
// Send email
String smtpServer = System.getProperty("no.nibio.vips.logic.SMTP_SERVER");
SimpleMailSender mailSender = new SimpleMailSender(smtpServer);
mailSender.sendMail("noreply@" + serverName, organizationAdmin.getEmail(), subject, body); mailSender.sendMail("noreply@" + serverName, organizationAdmin.getEmail(), subject, body);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment