Compatible with social model 2.0.0

This commit is contained in:
Ahmed Salah Tawfik Ibrahim 2024-01-31 18:40:21 +01:00
parent 1f80c0ee15
commit 207d05dec1
8 changed files with 33 additions and 22 deletions

View File

@ -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

11
pom.xml
View File

@ -86,9 +86,16 @@
<artifactId>invites-common-library</artifactId>
<version>[1.4.0, 2.0.0-SNAPSHOT)</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>

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -4,7 +4,7 @@
<inherits name='com.google.gwt.activity.Activity' />
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
<inherits name='org.gcube.social_networking.socialnetworking.model.GCubeSocialNetworking' />
<!-- only build for Chrome -->
<!-- <set-property name="user.agent" value="safari" /> -->
<!-- Specify the app entry point class. -->