From 92c634518fee78a0007542ae91295593d08551a5 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Fri, 27 May 2016 12:10:50 +0000 Subject: [PATCH] revised groups redirect URL git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@128878 82a268e6-3cf1-43bd-a215-b396298e98cf --- .settings/org.eclipse.wst.common.component | 3 +++ .../user/joinvre/client/ui/VreThumbnail.java | 4 +-- .../user/joinvre/server/JoinServiceImpl.java | 27 ++----------------- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 2ff775f..1b65ee8 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -4,6 +4,9 @@ + + uses + diff --git a/src/main/java/org/gcube/portlets/user/joinvre/client/ui/VreThumbnail.java b/src/main/java/org/gcube/portlets/user/joinvre/client/ui/VreThumbnail.java index 6bef41c..f8e6d85 100644 --- a/src/main/java/org/gcube/portlets/user/joinvre/client/ui/VreThumbnail.java +++ b/src/main/java/org/gcube/portlets/user/joinvre/client/ui/VreThumbnail.java @@ -80,8 +80,8 @@ public class VreThumbnail extends Composite { } @Override - public void onSuccess(String currentGroupName) { - Location.assign("/group/" +currentGroupName +"/explore?"+JoinVRE.GET_OID_PARAMETER+"="+myVre.getId()); + public void onSuccess(String siteLandingPagePath) { + Location.assign(siteLandingPagePath +"/explore?"+JoinVRE.GET_OID_PARAMETER+"="+myVre.getId()); } }); } 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 bcd56ad..b9c1e65 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 @@ -9,6 +9,7 @@ import java.util.List; import org.gcube.application.framework.core.session.ASLSession; import org.gcube.application.framework.core.session.SessionManager; import org.gcube.common.portal.GCubePortalConstants; +import org.gcube.common.portal.PortalContext; import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl; import org.gcube.portal.databook.server.DatabookStore; @@ -96,36 +97,12 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService @Override public String joinVRE(Long vreID) { try { - return getCurrGroupFromURL().getName(); + return PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest()); } catch (Exception e) { e.printStackTrace(); } return ""; } - /** - * - * @return the Liferay Group of the Site corresponding to the virtualhost being used to access the portal - * e.g. if i-marine.d4science.org it would return the Liferay Group i-marine, if services.d4science.org it would return the Liferay Group services - * it assums that you have a Site defined for each virtual host supported - * @throws Exception - */ - private Group getCurrGroupFromURL() throws Exception { - Group site = null; - String currentVirtualHost = this.getThreadLocalRequest().getServerName(); - _log.debug("currentHost is " + currentVirtualHost); - List vHosts = VirtualHostLocalServiceUtil.getVirtualHosts(0, VirtualHostLocalServiceUtil.getVirtualHostsCount()); - for (VirtualHost virtualHost : vHosts) { - _log.debug("Found " + virtualHost.getHostname()); - if (virtualHost.getHostname().compareTo("localhost") != 0 && - virtualHost.getLayoutSetId() != 0 && - virtualHost.getHostname().compareTo(currentVirtualHost) == 0) { - long layoutSetId = virtualHost.getLayoutSetId(); - site = LayoutSetLocalServiceUtil.getLayoutSet(layoutSetId).getGroup(); - return site; - } - } - return null; - } /** * * @param session the Asl Session