diff --git a/.classpath b/.classpath index eb59e96..3c4e941 100644 --- a/.classpath +++ b/.classpath @@ -1,12 +1,12 @@ - + - + @@ -34,10 +34,10 @@ - + - + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 443e085..b257af7 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,6 +1,6 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 15d5bf4..99496cf 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -4,7 +4,10 @@ - + + uses + + uses diff --git a/distro/changelog.xml b/distro/changelog.xml index 06e11d4..a5f7268 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,4 +1,9 @@ + + Ported to Java8 + Added support for template emails + Removed ASL Session dependency @@ -9,7 +14,8 @@ - Added possibility for VRE Manager to edit VRE Abstract text + Added possibility for VRE Manager to edit VRE Abstract text + Restyled and ported to Liferay 6.2 Added show more option when VRE Description is too long Added client scope handler for preventing back button cache - problems + problems + diff --git a/pom.xml b/pom.xml index 510d171..218be2c 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ org.gcube.portlets.user gcube-loggedin war - 3.2.0-SNAPSHOT + 3.3.0-SNAPSHOT gCube Environment Home Portlet @@ -28,9 +28,8 @@ 2.7.0 distro - 1.7 - 1.7 + 1.8 ${project.build.directory}/${project.build.finalName} 6.2.5 UTF-8 @@ -76,7 +75,7 @@ com.github.gwtbootstrap gwt-bootstrap - + org.gcube.common.portal portal-manager @@ -87,6 +86,11 @@ gcube-widgets compile + + org.gcube.portal.mailing + email-templates-library + [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) + org.gcube.dvos usermanagement-core @@ -189,8 +193,8 @@ maven-compiler-plugin 2.3.2 - 1.7 - 1.7 + ${maven.compiler.source} + ${maven.compiler.target} diff --git a/src/main/java/org/gcube/portlets/user/gcubeloggedin/server/LoggedinServiceImpl.java b/src/main/java/org/gcube/portlets/user/gcubeloggedin/server/LoggedinServiceImpl.java index 0efa406..b667bd8 100644 --- a/src/main/java/org/gcube/portlets/user/gcubeloggedin/server/LoggedinServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/gcubeloggedin/server/LoggedinServiceImpl.java @@ -7,6 +7,9 @@ import java.util.Set; import org.gcube.common.portal.PortalContext; import org.gcube.common.portal.mailing.EmailNotification; +import org.gcube.portal.mailing.message.Recipient; +import org.gcube.portal.mailing.service.EmailTemplateService; +import org.gcube.portal.mailing.templates.TemplateUserHasLeftVRE; import org.gcube.portlets.user.gcubeloggedin.client.LoggedinService; import org.gcube.portlets.user.gcubeloggedin.shared.VObject; import org.gcube.portlets.user.gcubeloggedin.shared.VObject.UserBelongingClient; @@ -220,41 +223,31 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi } /** * - * @param scope . - * @param optionalMessage . + * @param username + * @param scope + * @param portalbasicurl + * @param gatewayName */ public void sendUserUnregisteredNotification(String username, String scope, String portalbasicurl, String gatewayName) { ArrayList adminEmails = getAdministratorsEmails(scope); + ArrayList recipients = new ArrayList<>(); + for (String email : adminEmails) { + recipients.add(new Recipient(email)); + } UserManager um = new LiferayUserManager(); GCubeUser currUser = null; try { currUser = um.getUserByUsername(username); } catch (Exception e) { - + _log.trace("Error getUserByUsername", e); } - String name = currUser.getFirstName(); - String lastname = currUser.getLastName(); - StringBuffer body = new StringBuffer(); - body.append("

Dear manager of "+ scope +",
this email message was automatically generated by " + portalbasicurl +" to inform you that "); - body.append("

"); - body.append("

"); - body.append(""+name + " " + lastname +" has left the following environment: "); - body.append("

"); - body.append("" + scope+""); - body.append("
"); - body.append("
"); - body.append("Username: " + username); - body.append("
"); - body.append("e-mail: " + currUser.getEmail()); - body.append("

"); + String selectedVRE = scope.substring(scope.lastIndexOf("/")+1, scope.length()); + + EmailTemplateService.send("Unregistration from VRE", + new TemplateUserHasLeftVRE(currUser, selectedVRE, gatewayName, portalbasicurl), + getThreadLocalRequest(), + recipients.toArray(new Recipient[recipients.size()])); - String[] allMails = new String[adminEmails.size()]; - - adminEmails.toArray(allMails); - - EmailNotification mailToAdmin = new EmailNotification(allMails , "Unregistration from VRE", body.toString(), getThreadLocalRequest()); - - mailToAdmin.sendEmail(); } }