Added efficient method to retireve VRE logo URLs

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/my-vres@131971 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-09-28 12:38:56 +00:00
parent 04158ccd80
commit 1b96d6355b
1 changed files with 6 additions and 4 deletions

View File

@ -2,7 +2,6 @@ package org.gcube.portlet.user.my_vres.server;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -32,6 +31,7 @@ import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.Group; import com.liferay.portal.model.Group;
import com.liferay.portal.model.VirtualHost; import com.liferay.portal.model.VirtualHost;
import com.liferay.portal.security.auth.PrincipalThreadLocal; import com.liferay.portal.security.auth.PrincipalThreadLocal;
@ -42,6 +42,8 @@ import com.liferay.portal.service.GroupLocalServiceUtil;
import com.liferay.portal.service.LayoutSetLocalServiceUtil; import com.liferay.portal.service.LayoutSetLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.service.VirtualHostLocalServiceUtil; import com.liferay.portal.service.VirtualHostLocalServiceUtil;
import com.liferay.portal.util.PortalUtil;
import com.liferay.portal.webserver.WebServerServletTokenUtil;
/** /**
* The server side implementation of the RPC service. * The server side implementation of the RPC service.
@ -126,7 +128,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
_log.error("Cannot find root organziation, please check gcube-data.properties file in $CATALINA_HOME/conf folder, unless your installing the Bundle"); _log.error("Cannot find root organziation, please check gcube-data.properties file in $CATALINA_HOME/conf folder, unless your installing the Bundle");
return toReturn; return toReturn;
} }
long nowInMillis = new Date().getTime();
//for each root sub organizations (VO) //for each root sub organizations (VO)
for (GCubeGroup vOrg : rootGroupVO.getChildren()) { for (GCubeGroup vOrg : rootGroupVO.getChildren()) {
for (GCubeGroup vre : vOrg.getChildren()) { for (GCubeGroup vre : vOrg.getChildren()) {
@ -134,7 +136,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
vreToAdd.setName(vre.getGroupName()); vreToAdd.setName(vre.getGroupName());
vreToAdd.setGroupName(gm.getInfrastructureScope(vre.getGroupId())); vreToAdd.setGroupName(gm.getInfrastructureScope(vre.getGroupId()));
long logoId = vre.getLogoId(); long logoId = vre.getLogoId();
String logoURL = "/image/layout_set_logo?img_id="+ logoId+"&t="+nowInMillis; String logoURL = gm.getGroupLogoURL(logoId);
vreToAdd.setImageURL(logoURL); vreToAdd.setImageURL(logoURL);
String vreUrl = GCubePortalConstants.PREFIX_GROUP_URL+vre.getFriendlyURL(); String vreUrl = GCubePortalConstants.PREFIX_GROUP_URL+vre.getFriendlyURL();
vreToAdd.setFriendlyURL(vreUrl); vreToAdd.setFriendlyURL(vreUrl);
@ -168,7 +170,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
return null; return null;
} }
} }
/** /**
* *