updated table already creates users
This commit is contained in:
parent
085fe4e5c7
commit
b80a767da0
|
@ -4,9 +4,6 @@
|
|||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="email-templates-library-1.4.2.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/email-templates-library/email-templates-library">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="/create-users/target/subscribe-users-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<property name="context-root" value="create-users-portlet"/>
|
||||
</wb-module>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -84,7 +84,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.portal.mailing</groupId>
|
||||
<artifactId>email-templates-library</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,)</version>
|
||||
<version>[1.4.3-SNAPSHOT,)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
|
|
|
@ -40,6 +40,6 @@ public interface HandleUsersService extends RemoteService {
|
|||
* Send the registration email to this user
|
||||
* @param email
|
||||
*/
|
||||
public void sendEmailToUser(String email);
|
||||
public void sendEmailToUser(String email, String name);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,5 +19,5 @@ public interface HandleUsersServiceAsync {
|
|||
|
||||
void deleteInvitedUser(String email, AsyncCallback<Boolean> callback);
|
||||
|
||||
void sendEmailToUser(String email, AsyncCallback<Void> callback);
|
||||
void sendEmailToUser(String email, String name, AsyncCallback<Void> callback);
|
||||
}
|
||||
|
|
|
@ -120,50 +120,6 @@ public class RegisteredUsersTable extends Composite {
|
|||
surnameCol.setDefaultSortAscending(false);
|
||||
table.addColumnSortHandler(surnameColHandler);
|
||||
|
||||
// institution/organization and handler for sorting
|
||||
Column<VreUserBean, String> institutionCol = getColumn(new TextCell(), new GetValue<String>() {
|
||||
@Override
|
||||
public String getValue(VreUserBean user) {
|
||||
return user.getInstitution();
|
||||
}
|
||||
});
|
||||
|
||||
ListHandler<VreUserBean> institutionColHandler = new ListHandler<VreUserBean>(dataProvider.getList());
|
||||
institutionColHandler.setComparator(institutionCol, new Comparator<VreUserBean>() {
|
||||
@Override
|
||||
public int compare(VreUserBean o1, VreUserBean o2) {
|
||||
|
||||
return o1.getInstitution().compareTo(o2.getInstitution());
|
||||
|
||||
}
|
||||
});
|
||||
institutionCol.setSortable(true);
|
||||
institutionCol.setDefaultSortAscending(false);
|
||||
table.addColumnSortHandler(institutionColHandler);
|
||||
|
||||
// password and handler for sorting
|
||||
Column<VreUserBean, String> passwordChanged = getColumn(new TextCell(), new GetValue<String>() {
|
||||
@Override
|
||||
public String getValue(VreUserBean user) {
|
||||
return (user.isPasswordChanged() ? "True" : "False");
|
||||
}
|
||||
});
|
||||
|
||||
ListHandler<VreUserBean> passwordChangedColHandler = new ListHandler<VreUserBean>(dataProvider.getList());
|
||||
passwordChangedColHandler.setComparator(passwordChanged, new Comparator<VreUserBean>() {
|
||||
@Override
|
||||
public int compare(VreUserBean o1, VreUserBean o2) {
|
||||
|
||||
String o1PasswordChangedString = o1.isPasswordChanged() ? "True" : "False";
|
||||
String o2PasswordChangedString = o2.isPasswordChanged() ? "True" : "False";
|
||||
return o1PasswordChangedString.compareTo(o2PasswordChangedString);
|
||||
|
||||
}
|
||||
});
|
||||
passwordChanged.setSortable(true);
|
||||
passwordChanged.setDefaultSortAscending(false);
|
||||
table.addColumnSortHandler(passwordChangedColHandler);
|
||||
|
||||
// registration column plus handler for sorting
|
||||
Column<VreUserBean, String> registrationDate = getColumn(new TextCell(), new GetValue<String>() {
|
||||
@Override
|
||||
|
@ -292,7 +248,7 @@ public class RegisteredUsersTable extends Composite {
|
|||
// get the button and disable it
|
||||
parent.getFirstChildElement().setPropertyBoolean("disabled", true);
|
||||
|
||||
userServices.sendEmailToUser(user.getEmail(), new AsyncCallback<Void>() {
|
||||
userServices.sendEmailToUser(user.getEmail(), user.getName() + " " + user.getSurname(), new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
|
@ -336,27 +292,12 @@ public class RegisteredUsersTable extends Composite {
|
|||
builder.appendHtmlConstant("</span>");
|
||||
table.addColumn(surnameCol, builder.toSafeHtml());
|
||||
builder = new SafeHtmlBuilder();
|
||||
builder.appendHtmlConstant("<span title=\"" + "Registered user's institution/organization"+ "\">");
|
||||
builder.appendEscaped("Institution / Organisation");
|
||||
builder.appendHtmlConstant("</span>");
|
||||
table.addColumn(institutionCol, builder.toSafeHtml());
|
||||
builder = new SafeHtmlBuilder();
|
||||
builder.appendHtmlConstant("<span title=\"" + "Did he/she change the default password?"+ "\">");
|
||||
builder.appendEscaped("Password Changed");
|
||||
builder.appendHtmlConstant("</span>");
|
||||
table.addColumn(passwordChanged, builder.toSafeHtml());
|
||||
builder = new SafeHtmlBuilder();
|
||||
builder.appendHtmlConstant("<span title=\"" + "Registration date"+ "\">");
|
||||
builder.appendEscaped("Registration date");
|
||||
builder.appendHtmlConstant("</span>");
|
||||
table.addColumn(registrationDate, builder.toSafeHtml());
|
||||
builder = new SafeHtmlBuilder();
|
||||
builder.appendHtmlConstant("<span title=\"" + "Delete User"+ "\">");
|
||||
builder.appendEscaped("Delete");
|
||||
builder.appendHtmlConstant("</span>");
|
||||
table.addColumn(deleteUser, builder.toSafeHtml());
|
||||
builder = new SafeHtmlBuilder();
|
||||
builder.appendHtmlConstant("<span title=\"" + "Send Welcome Message" + "\">");
|
||||
builder.appendHtmlConstant("<span title=\"" + "(Re) Send Welcome Message" + "\">");
|
||||
builder.appendEscaped("Send Welcome");
|
||||
builder.appendHtmlConstant("</span>");
|
||||
table.addColumn(sendWelcomeMessage, builder.toSafeHtml());
|
||||
|
|
|
@ -163,7 +163,7 @@ public class CreateUsersImpl extends RemoteServiceServlet implements HandleUsers
|
|||
}
|
||||
|
||||
@Override
|
||||
public void sendEmailToUser(String email) {
|
||||
public void sendEmailToUser(String email, String nameCreatedUser) {
|
||||
if(isWithinPortal()){
|
||||
try{
|
||||
logger.debug("Sending welcome message to user with email " + email);
|
||||
|
@ -172,14 +172,18 @@ public class CreateUsersImpl extends RemoteServiceServlet implements HandleUsers
|
|||
String gatewayURL = context.getGatewayURL(getThreadLocalRequest());
|
||||
long groupId = context.getCurrentGroupId(getThreadLocalRequest());
|
||||
GCubeGroup currVRE = new LiferayGroupManager().getGroup(groupId);
|
||||
UserManager um = new LiferayUserManager();
|
||||
GCubeUser theCreatedAccountUser = um.getUserByEmail(email);
|
||||
|
||||
GCubeUser theManagerUser =context.getCurrentUser(getThreadLocalRequest());
|
||||
|
||||
String subject = "Your user account for " + currVRE.getGroupName() + " VRE has been created";
|
||||
EmailTemplateService.send(
|
||||
subject,
|
||||
new TemplateWelcomeCreatedAccount(gatewayName, gatewayURL, theCreatedAccountUser, theManagerUser, currVRE), getThreadLocalRequest(), new Recipient(email));
|
||||
new TemplateWelcomeCreatedAccount(
|
||||
gatewayName,
|
||||
gatewayURL,
|
||||
email,
|
||||
nameCreatedUser,
|
||||
theManagerUser, currVRE), getThreadLocalRequest(), new Recipient(email));
|
||||
|
||||
}catch(Exception e){
|
||||
logger.error("Error while sending email to user " + email, e);
|
||||
|
@ -244,7 +248,7 @@ public class CreateUsersImpl extends RemoteServiceServlet implements HandleUsers
|
|||
new CreateUserAddToVrePublisher().publish(
|
||||
CreateUserAddToVre.newEvent(name, surname, email, INITIAL_PWD, theVRE));
|
||||
if (sendEmail)
|
||||
sendEmailToUser(email);
|
||||
sendEmailToUser(email, name + " " + surname);
|
||||
}catch(Exception e){
|
||||
|
||||
// unable to create.. we need to delete it from the list of users
|
||||
|
|
Loading…
Reference in New Issue