diff --git a/.classpath b/.classpath
index dda1718..4013f6e 100644
--- a/.classpath
+++ b/.classpath
@@ -1,12 +1,12 @@
-
+
-
+
@@ -33,5 +33,5 @@
-
+
diff --git a/pom.xml b/pom.xml
index 2b105f9..5a83021 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,8 +23,6 @@
2.7.0
-
-
1.7
1.7
@@ -81,6 +79,15 @@
invites-common-library
[0.1.0-SNAPSHOT,)
+
+ org.gcube.portal
+ social-networking-library
+ provided
+
+
+ com.google
+ gwt-jsonmaker
+
com.github.gwtbootstrap
gwt-bootstrap
@@ -159,7 +166,7 @@
compile
-
+
diff --git a/src/main/java/org/gcube/portlets/user/invitefriends/client/InviteService.java b/src/main/java/org/gcube/portlets/user/invitefriends/client/InviteService.java
index 5331df0..fc45c03 100644
--- a/src/main/java/org/gcube/portlets/user/invitefriends/client/InviteService.java
+++ b/src/main/java/org/gcube/portlets/user/invitefriends/client/InviteService.java
@@ -1,5 +1,7 @@
package org.gcube.portlets.user.invitefriends.client;
+import org.gcube.portal.databook.shared.InviteOperationResult;
+
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@@ -8,5 +10,5 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
*/
@RemoteServiceRelativePath("greet")
public interface InviteService extends RemoteService {
- Boolean sendInviteEmail(String name, String lastName, String email) throws IllegalArgumentException;
+ InviteOperationResult sendInvite(String name, String lastName, String email) throws IllegalArgumentException;
}
diff --git a/src/main/java/org/gcube/portlets/user/invitefriends/client/InviteServiceAsync.java b/src/main/java/org/gcube/portlets/user/invitefriends/client/InviteServiceAsync.java
index a8a4dcb..7427fbb 100644
--- a/src/main/java/org/gcube/portlets/user/invitefriends/client/InviteServiceAsync.java
+++ b/src/main/java/org/gcube/portlets/user/invitefriends/client/InviteServiceAsync.java
@@ -1,9 +1,12 @@
package org.gcube.portlets.user.invitefriends.client;
+import org.gcube.portal.databook.shared.InviteOperationResult;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface InviteServiceAsync {
- void sendInviteEmail(String name, String lastName, String email, AsyncCallback callback);
+ void sendInvite(String name, String lastName, String email,
+ AsyncCallback callback);
}
diff --git a/src/main/java/org/gcube/portlets/user/invitefriends/client/ui/FormViewImpl.java b/src/main/java/org/gcube/portlets/user/invitefriends/client/ui/FormViewImpl.java
index 44e0165..6f8de33 100644
--- a/src/main/java/org/gcube/portlets/user/invitefriends/client/ui/FormViewImpl.java
+++ b/src/main/java/org/gcube/portlets/user/invitefriends/client/ui/FormViewImpl.java
@@ -3,6 +3,7 @@
*/
package org.gcube.portlets.user.invitefriends.client.ui;
+import org.gcube.portal.databook.shared.InviteOperationResult;
import org.gcube.portlets.user.invitefriends.client.InviteService;
import org.gcube.portlets.user.invitefriends.client.InviteServiceAsync;
import org.gcube.portlets.user.invitefriends.client.validation.FormView;
@@ -115,12 +116,24 @@ public class FormViewImpl extends Composite implements FormView, Editor() {
+ service.sendInvite(name.getText(), "", email.getText(), new AsyncCallback() {
@Override
- public void onSuccess(Boolean result) {
- feedback.setText("Thanks for inviting, we sent the email correctly.");
- feedbackGroup.setType(ControlGroupType.SUCCESS);
+ public void onSuccess(InviteOperationResult result) {
+ switch (result) {
+ case SUCCESS:
+ feedback.setText("Thanks for inviting, we sent the email correctly.");
+ feedbackGroup.setType(ControlGroupType.SUCCESS);
+ break;
+ case ALREADY_INVITED:
+ feedback.setText("Thanks for inviting, however the user was already invited.");
+ feedbackGroup.setType(ControlGroupType.WARNING);
+ break;
+ case FAILED:
+ feedback.setText("Sorry, an error occurred in the server and we could not send the invite, please try again later.");
+ feedbackGroup.setType(ControlGroupType.ERROR);
+ break;
+ }
sendInvite.setEnabled(false);
cancelInvite.setText("Close");
email.setText("");
@@ -130,7 +143,7 @@ public class FormViewImpl extends Composite implements FormView, Editor
-
+
-
+
+