From 207d05dec189276d39ca6df16fe34080f6b632e1 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Wed, 31 Jan 2024 18:40:21 +0100 Subject: [PATCH] Compatible with social model 2.0.0 --- CHANGELOG.md | 1 + pom.xml | 11 +++++-- .../user/joinvre/client/JoinService.java | 2 +- .../user/joinvre/client/JoinServiceAsync.java | 2 +- .../client/ui/AccessViaInviteDialog.java | 2 +- .../user/joinvre/server/JoinServiceImpl.java | 33 ++++++++++--------- .../user/joinvre/server/LoginServiceUtil.java | 2 +- .../portlets/user/joinvre/JoinVRE.gwt.xml | 2 +- 8 files changed, 33 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4046d32..5f04fae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [v3.7.3] - 2022-01-03 - Make the motivation mandatory when someone asks to join a VRE +- Removed social networking library dependency #26531 ## [v3.7.2] - 2021-04-30 diff --git a/pom.xml b/pom.xml index 92eab1b..6430d19 100644 --- a/pom.xml +++ b/pom.xml @@ -86,9 +86,16 @@ invites-common-library [1.4.0, 2.0.0-SNAPSHOT) + - 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/portlets/user/joinvre/client/JoinService.java b/src/main/java/org/gcube/portlets/user/joinvre/client/JoinService.java index 803f9b9..5ddcc9c 100644 --- a/src/main/java/org/gcube/portlets/user/joinvre/client/JoinService.java +++ b/src/main/java/org/gcube/portlets/user/joinvre/client/JoinService.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; -import org.gcube.portal.databook.shared.UserInfo; +import org.gcube.social_networking.socialnetworking.model.shared.UserInfo; import org.gcube.portlets.user.joinvre.shared.TabbedPage; import org.gcube.portlets.user.joinvre.shared.VRE; import org.gcube.portlets.user.joinvre.shared.VRECategory; diff --git a/src/main/java/org/gcube/portlets/user/joinvre/client/JoinServiceAsync.java b/src/main/java/org/gcube/portlets/user/joinvre/client/JoinServiceAsync.java index 12dba1c..02035b4 100644 --- a/src/main/java/org/gcube/portlets/user/joinvre/client/JoinServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/joinvre/client/JoinServiceAsync.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; -import org.gcube.portal.databook.shared.UserInfo; +import org.gcube.social_networking.socialnetworking.model.shared.UserInfo; import org.gcube.portlets.user.joinvre.shared.TabbedPage; import org.gcube.portlets.user.joinvre.shared.VRE; import org.gcube.portlets.user.joinvre.shared.VRECategory; diff --git a/src/main/java/org/gcube/portlets/user/joinvre/client/ui/AccessViaInviteDialog.java b/src/main/java/org/gcube/portlets/user/joinvre/client/ui/AccessViaInviteDialog.java index 820af63..51c4681 100644 --- a/src/main/java/org/gcube/portlets/user/joinvre/client/ui/AccessViaInviteDialog.java +++ b/src/main/java/org/gcube/portlets/user/joinvre/client/ui/AccessViaInviteDialog.java @@ -1,6 +1,6 @@ package org.gcube.portlets.user.joinvre.client.ui; -import org.gcube.portal.databook.shared.UserInfo; +import org.gcube.social_networking.socialnetworking.model.shared.UserInfo; import org.gcube.portlets.user.joinvre.client.JoinService; import org.gcube.portlets.user.joinvre.client.JoinServiceAsync; import org.gcube.portlets.user.joinvre.shared.VRE; diff --git a/src/main/java/org/gcube/portlets/user/joinvre/server/JoinServiceImpl.java b/src/main/java/org/gcube/portlets/user/joinvre/server/JoinServiceImpl.java index 1aaeaf1..4f3e904 100644 --- a/src/main/java/org/gcube/portlets/user/joinvre/server/JoinServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/joinvre/server/JoinServiceImpl.java @@ -11,11 +11,10 @@ import javax.servlet.http.HttpServletRequest; import org.gcube.common.portal.GCubePortalConstants; 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.InviteStatus; -import org.gcube.portal.databook.shared.UserInfo; +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.InviteStatus; +import org.gcube.social_networking.socialnetworking.model.shared.UserInfo; import org.gcube.portal.tou.TermsOfUse; import org.gcube.portal.tou.TermsOfUseImpl; import org.gcube.portal.tou.exceptions.ToUNotFoundException; @@ -59,7 +58,7 @@ import com.liferay.portal.util.PortalUtil; @SuppressWarnings("serial") public class JoinServiceImpl extends RemoteServiceServlet implements JoinService { private static Log _log = LogFactoryUtil.getLog(JoinServiceImpl.class); - private static DatabookStore store; + private static LibClient libClient; public static final String PREFIX_PUBLIC_URL = "/web"; //tell whether the public static final String TABBED_LAYOUT_ATTRIBUTE = "TabbedLayout"; @@ -100,7 +99,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService public UserInfo readInvite(final String inviteId, final long siteId) { initStore(); try { - Invite invite = store.readInvite(inviteId); + Invite invite = libClient.readInviteLib(inviteId); GCubeUser inviter = new LiferayUserManager().getUserByUsername(invite.getSenderUserId()); return new UserInfo( inviter.getUsername(), @@ -629,10 +628,10 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService _log.info("fakeRequest accepted"); if (isInvitation) { initStore(); - String inviteId = store.isExistingInvite(scope, currUser.getEmail()); + String inviteId = libClient.isExistingInviteLib(scope, currUser.getEmail()); if (inviteId != null) { - Invite invite = store.readInvite(inviteId); - store.setInviteStatus(scope, currUser.getEmail(), InviteStatus.ACCEPTED); + Invite invite = libClient.readInviteLib(inviteId); + libClient.setInviteStatusLib(scope, currUser.getEmail(), InviteStatus.ACCEPTED); LoginServiceUtil.notifyUserAcceptedInvite(currUser.getUsername(), scope, invite, getThreadLocalRequest()); } } @@ -657,11 +656,15 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService * * @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; } @Override @@ -679,7 +682,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService e.printStackTrace(); } _log.debug("checking if invite exists for " + email + " on " +infraScope); - return store.isExistingInvite(infraScope, email); + return libClient.isExistingInviteLib(infraScope, email); } diff --git a/src/main/java/org/gcube/portlets/user/joinvre/server/LoginServiceUtil.java b/src/main/java/org/gcube/portlets/user/joinvre/server/LoginServiceUtil.java index 30f4903..05620c5 100644 --- a/src/main/java/org/gcube/portlets/user/joinvre/server/LoginServiceUtil.java +++ b/src/main/java/org/gcube/portlets/user/joinvre/server/LoginServiceUtil.java @@ -8,7 +8,7 @@ import java.util.Set; import javax.servlet.http.HttpServletRequest; import org.gcube.common.portal.PortalContext; -import org.gcube.portal.databook.shared.Invite; +import org.gcube.social_networking.socialnetworking.model.shared.Invite; import org.gcube.portal.mailing.message.Recipient; import org.gcube.portal.mailing.service.EmailTemplateService; import org.gcube.portal.mailing.templates.TemplateUserAcceptedInvite; diff --git a/src/main/resources/org/gcube/portlets/user/joinvre/JoinVRE.gwt.xml b/src/main/resources/org/gcube/portlets/user/joinvre/JoinVRE.gwt.xml index 5a4ad67..3185b41 100644 --- a/src/main/resources/org/gcube/portlets/user/joinvre/JoinVRE.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/joinvre/JoinVRE.gwt.xml @@ -4,7 +4,7 @@ - +