Fix Bug #19415, Enhance Join VRE portlet performance
This commit is contained in:
parent
3c29afc3dc
commit
45cbc0ca5c
|
@ -4,6 +4,9 @@
|
|||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="invites-common-library-1.5.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/invites-common-library/invites-common-library">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||
<property name="context-root" value="join-vre"/>
|
||||
</wb-module>
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
[v3.7.0] [r4.23.0] - 2020-06-03
|
||||
|
||||
Fixes
|
||||
|
||||
Bug #19415, Enhance Join VRE portlet performance when many VREs are present on a gateway and the user is logged in.
|
||||
|
||||
|
||||
## [361] - [2018-11-09]
|
||||
|
||||
Fixed minor glitch border 5px on the body
|
||||
|
||||
|
||||
|
||||
## [350] - [2018-03-13]
|
||||
|
||||
Feature #11434, Explore VREs use preloaders while loading VREs list
|
||||
|
||||
Ported to GWT 2.8.2
|
||||
|
||||
|
||||
|
||||
## [350] - [2017-11-08]
|
||||
|
||||
Added support for optional layout via TabPages and browsing VREs by Organisations and Category
|
||||
|
||||
|
||||
|
||||
## [340] - [2017-07-05]
|
||||
|
||||
Ported to GWT 2.8.1
|
||||
|
||||
Added support for Terms of Use Display
|
||||
|
||||
|
||||
|
||||
## [330] - [2017-05-15]
|
||||
|
||||
Ported to Java8
|
||||
|
||||
Added support for template emails
|
||||
|
||||
|
||||
|
||||
## [320] - [2016-11-17]
|
||||
|
||||
Removed ASL Session
|
||||
|
||||
Implemented Feature #4877 remove VRE association to single Category constraint
|
||||
|
||||
Info Button redircets to VRE Public page (if a public page exists for the VRE)
|
||||
|
||||
|
||||
|
||||
## [310] - [2016-10-03]
|
||||
|
||||
Added support for invite-only closed groups
|
||||
|
||||
Fix for Bug #4877 Email Notification sent multiple times sometimes
|
||||
|
||||
Logo VRE was not updated in the portlet due to liferay versioning of Document Library
|
||||
|
||||
|
||||
|
||||
## [300] - [2016-03-28]
|
||||
|
||||
Ported to Liferay 6.2
|
||||
|
||||
|
||||
|
||||
## [200] - [2015-10-22]
|
||||
|
||||
Refactored to support virtual groups and related descriptions through LR Custom Field
|
||||
|
||||
Refactored with GWT Bootstrap, new look and feel
|
||||
|
||||
Added support for showing external hosted VREso, see Feature #755
|
||||
|
||||
|
||||
|
||||
## [110] - [2015-04-28]
|
||||
|
||||
Redesigned and restyles the way vre description is shown to end users
|
||||
|
||||
|
||||
|
||||
## [100] - [2015-03-02]
|
||||
|
||||
First Release
|
4
pom.xml
4
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>join-vre</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>3.7.0-SNAPSHOT</version>
|
||||
<version>3.7.0</version>
|
||||
<name>gCube Join VRE Portlet</name>
|
||||
<description>Display the available VRE to Join</description>
|
||||
<scm>
|
||||
|
@ -93,7 +93,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope-maps</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
|
|
|
@ -47,9 +47,11 @@ import com.liferay.portal.kernel.exception.SystemException;
|
|||
import com.liferay.portal.kernel.log.Log;
|
||||
import com.liferay.portal.kernel.log.LogFactoryUtil;
|
||||
import com.liferay.portal.model.Group;
|
||||
import com.liferay.portal.model.MembershipRequest;
|
||||
import com.liferay.portal.model.VirtualHost;
|
||||
import com.liferay.portal.service.GroupLocalServiceUtil;
|
||||
import com.liferay.portal.service.LayoutSetLocalServiceUtil;
|
||||
import com.liferay.portal.service.MembershipRequestLocalServiceUtil;
|
||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||
import com.liferay.portal.service.VirtualHostLocalServiceUtil;
|
||||
import com.liferay.portal.util.PortalUtil;
|
||||
|
@ -393,12 +395,15 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
|
||||
List<GCubeGroup> currUserGroups = new ArrayList<GCubeGroup>();
|
||||
GCubeUser currUser = pContext.getCurrentUser(getThreadLocalRequest());
|
||||
_log.debug("before currUserGroups");
|
||||
if (currUser != null) {
|
||||
currUserGroups = groupsManager.listGroupsByUser(currUser.getUserId());
|
||||
_log.debug("currUserGroups size= "+currUserGroups.size());
|
||||
}
|
||||
|
||||
_log.debug("for each root sub organizations (VO): ");
|
||||
//for each root sub organizations (VO)
|
||||
for (GCubeGroup vOrg : rootGroupVO.getChildren()) {
|
||||
_log.debug("vOrg: "+vOrg.getGroupName());
|
||||
for (GCubeGroup vreSite : vOrg.getChildren()) {
|
||||
long vreID = vreSite.getGroupId();
|
||||
String vreName = vreSite.getGroupName();
|
||||
|
@ -408,6 +413,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
String vreLogoURL = groupsManager.getGroupLogoURL(logoId);
|
||||
String groupName = groupsManager.getInfrastructureScope(vreSite.getGroupId());
|
||||
String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+vreSite.getFriendlyURL();
|
||||
_log.debug("vreName: "+vreName);
|
||||
|
||||
List<VirtualGroup> vreGroups = groupsManager.getVirtualGroups(vreID);
|
||||
for (VirtualGroup vreGroup : vreGroups) {
|
||||
|
@ -422,10 +428,11 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
}
|
||||
if (currUser != null) {
|
||||
//check if the user belongs to it
|
||||
_log.debug("//check if the user belongs to = "+vreSite.getGroupName());
|
||||
if (currUserGroups.contains(vreSite)) {
|
||||
toAdd.setUserBelonging(UserBelonging.BELONGING);
|
||||
}
|
||||
else if (checkPending(currUser.getUsername(), vreSite.getGroupId()))
|
||||
else if (checkPending(currUser.getUserId(), vreSite.getGroupId()))
|
||||
toAdd.setUserBelonging(UserBelonging.PENDING);
|
||||
}
|
||||
toUpdate.add(toAdd);
|
||||
|
@ -529,7 +536,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
UserBelonging belongEnum = UserBelonging.NOT_BELONGING;
|
||||
if (gm.listGroupsByUser(currUser.getUserId()).contains(selectedVRE))
|
||||
belongEnum = UserBelonging.BELONGING;
|
||||
else if (checkPending(currUser.getUsername(), selectedVRE.getGroupId()))
|
||||
else if (checkPending(currUser.getUserId(), selectedVRE.getGroupId()))
|
||||
belongEnum = UserBelonging.PENDING;
|
||||
//return the selected VRE for this user
|
||||
toReturn = new VRE(groupId, vreName, vreDescription, vreLogoURL, infraScope, friendlyURL, belongEnum, getVREMembershipType(selectedVRE.getMembershipType()));
|
||||
|
@ -554,22 +561,13 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
return VreMembershipType.PRIVATE;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param screenName
|
||||
* @param groupId
|
||||
* @return
|
||||
* @throws UserRetrievalFault
|
||||
* @throws GroupRetrievalFault
|
||||
* @throws UserManagementSystemException
|
||||
*/
|
||||
private static boolean checkPending(String screenName, long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault {
|
||||
UserManager um = new LiferayUserManager();
|
||||
List<GCubeMembershipRequest> requests = um.listMembershipRequestsByGroup(groupId);
|
||||
for (GCubeMembershipRequest r : requests) {
|
||||
if ( r.getStatus() == MembershipRequestStatus.REQUEST && (r.getRequestingUser().getUsername().compareTo(screenName)==0))
|
||||
|
||||
private static boolean checkPending(long userId, long groupId) throws SystemException {
|
||||
_log.debug("checkPending of userId "+userId + " to groupId="+groupId);
|
||||
List<MembershipRequest> lRequests = MembershipRequestLocalServiceUtil.getMembershipRequests(userId, groupId, 0);
|
||||
if (lRequests != null && lRequests.size() > 0)
|
||||
return true;
|
||||
}
|
||||
_log.debug("checkPending did not find request" + userId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -583,7 +581,8 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
CacheRegistryUtil.clear();
|
||||
long groupId = theVRE.getId();
|
||||
_log.debug("Look if a request exists already");
|
||||
List<GCubeGroup> userGroups = new LiferayGroupManager().listGroupsByUser(new LiferayUserManager().getUserId(username));
|
||||
long userId = new LiferayUserManager().getUserId(username);
|
||||
List<GCubeGroup> userGroups = new LiferayGroupManager().listGroupsByUser(userId);
|
||||
for (GCubeGroup g : userGroups) {
|
||||
if (g.getGroupId() == groupId) {
|
||||
_log.warn("User already belongs to " + scope + " SKIP addMembershipRequest");
|
||||
|
@ -591,7 +590,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
}
|
||||
}
|
||||
CacheRegistryUtil.clear();
|
||||
if (checkPending(username, groupId)) {
|
||||
if (checkPending(userId, groupId)) {
|
||||
_log.warn("User already asked for " + scope + " REQUEST IS IN PENDING - SKIP addMembershipRequest");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue