Compatible with social model 2.0.0
This commit is contained in:
parent
24207fd25a
commit
7db32a5748
|
@ -6,9 +6,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
## [v1.5.1] - 2020-07-21
|
||||
|
||||
Ported to git
|
||||
|
||||
Feature #19708 send a temporary password in the invite email if the account does not exists
|
||||
- Ported to git
|
||||
- Feature #19708 send a temporary password in the invite email if the account does not exists
|
||||
- Feature #26539 removed social networking library dependency
|
||||
|
||||
## [v1.5.0] - 2017-11-29
|
||||
|
||||
|
|
11
pom.xml
11
pom.xml
|
@ -71,9 +71,16 @@
|
|||
<artifactId>jsoup</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
<!--needs to be provided -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>social-networking-library</artifactId>
|
||||
<groupId>org.gcube.social-networking</groupId>
|
||||
<artifactId>social-service-model</artifactId>
|
||||
<version>[1.2.0-SNAPSHOT, 2.0.0)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.social-networking</groupId>
|
||||
<artifactId>social-service-client</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -13,13 +13,12 @@ import javax.servlet.http.HttpServletRequest;
|
|||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
|
||||
import org.gcube.portal.databook.server.DatabookStore;
|
||||
import org.gcube.portal.databook.shared.Invite;
|
||||
import org.gcube.portal.databook.shared.InviteOperationResult;
|
||||
import org.gcube.portal.databook.shared.InviteStatus;
|
||||
import org.gcube.portal.databook.shared.ex.InviteIDNotFoundException;
|
||||
import org.gcube.portal.databook.shared.ex.InviteStatusNotFoundException;
|
||||
import org.gcube.social_networking.social_networking_client_library.LibClient;
|
||||
import org.gcube.social_networking.socialnetworking.model.shared.Invite;
|
||||
import org.gcube.social_networking.socialnetworking.model.shared.InviteOperationResult;
|
||||
import org.gcube.social_networking.socialnetworking.model.shared.InviteStatus;
|
||||
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.InviteIDNotFoundException;
|
||||
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.InviteStatusNotFoundException;
|
||||
import org.gcube.portal.mailing.message.EmailAddress;
|
||||
import org.gcube.portal.mailing.message.Recipient;
|
||||
import org.gcube.portal.mailing.message.RecipientType;
|
||||
|
@ -52,7 +51,7 @@ public class InvitesManager {
|
|||
|
||||
|
||||
private static InvitesManager instance;
|
||||
private static DatabookStore store;
|
||||
private static LibClient libClient;
|
||||
|
||||
private InvitesManager() { }
|
||||
|
||||
|
@ -65,11 +64,15 @@ public class InvitesManager {
|
|||
*
|
||||
* @return the unique instance of the store
|
||||
*/
|
||||
public static synchronized DatabookStore initStore() {
|
||||
if (store == null) {
|
||||
store = new DBCassandraAstyanaxImpl();
|
||||
public static synchronized LibClient initStore() {
|
||||
if (libClient == null) {
|
||||
try {
|
||||
libClient = new LibClient();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return store;
|
||||
return libClient;
|
||||
}
|
||||
|
||||
public InviteOperationResult sendInvite(
|
||||
|
@ -101,22 +104,18 @@ public class InvitesManager {
|
|||
boolean emailResult = false;
|
||||
try {
|
||||
String vreName = PortalContext.getConfiguration().getCurrentGroupName(request);
|
||||
result = store.saveInvite(invite);
|
||||
result = libClient.saveInviteLib(invite);
|
||||
if (result == InviteOperationResult.ALREADY_INVITED) {
|
||||
//if the invite existed already the id and temp passwd has to be the same of the original invite (in the persistence)
|
||||
String inviteid = store.isExistingInvite(currScope, email);
|
||||
String inviteid = libClient.isExistingInviteLib(currScope, email);
|
||||
invite.setKey(inviteid);
|
||||
String tempPwd = store.readInvite(inviteid).getControlCode();
|
||||
String tempPwd = libClient.readInviteLib(inviteid).getControlCode();
|
||||
invite.setControlCode(tempPwd);;
|
||||
}
|
||||
|
||||
emailResult = sendInviteEmail(request, invite, currUser, vreName, name, email, vreDescription, accountExists);
|
||||
notifyInviteSent(request, currUser, currScope, invite, vreName);
|
||||
|
||||
} catch (AddressException e) {
|
||||
_log.error("Email not valid " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return InviteOperationResult.FAILED;
|
||||
} catch (Exception e) {
|
||||
_log.error("Something wrong happened retrieving the invite which seemd to be existing already " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue