diff --git a/CHANGELOG.md b/CHANGELOG.md index 10831f3..5c74ad4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/pom.xml b/pom.xml index 2c22c68..f3eff36 100644 --- a/pom.xml +++ b/pom.xml @@ -71,9 +71,16 @@ jsoup 1.6.2 + - org.gcube.portal - social-networking-library + org.gcube.social-networking + social-service-model + [1.2.0-SNAPSHOT, 2.0.0) + + + org.gcube.social-networking + social-service-client + [2.0.0-SNAPSHOT, 3.0.0) provided diff --git a/src/main/java/org/gcube/portal/invites/InvitesManager.java b/src/main/java/org/gcube/portal/invites/InvitesManager.java index b663fbc..d8c79d6 100644 --- a/src/main/java/org/gcube/portal/invites/InvitesManager.java +++ b/src/main/java/org/gcube/portal/invites/InvitesManager.java @@ -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();