Added efficient method to retireve VRE logo URLs

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@131975 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-09-28 12:42:36 +00:00
parent 2f132cd0f0
commit 6764557280
1 changed files with 7 additions and 4 deletions

View File

@ -44,6 +44,7 @@ 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.log.Log; import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.log.LogFactoryUtil;
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;
@ -55,6 +56,7 @@ 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.util.PortalUtil;
import com.liferay.portal.webserver.WebServerServletTokenUtil;
/** /**
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it * @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
@ -157,6 +159,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
_log.trace("RETURNING VRECustomAttributes:\n" + toReturn.toString()); _log.trace("RETURNING VRECustomAttributes:\n" + toReturn.toString());
return toReturn; return toReturn;
} }
/** /**
* *
* @return the Virtual groups with their VREs in the order estabilished in the LR Control Panel * @return the Virtual groups with their VREs in the order estabilished in the LR Control Panel
@ -191,7 +194,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
GCubeUser currUser = new LiferayUserManager().getUserByUsername(session.getUsername()); GCubeUser currUser = new LiferayUserManager().getUserByUsername(session.getUsername());
currUserGroups = gm.listGroupsByUser(currUser.getUserId()); currUserGroups = gm.listGroupsByUser(currUser.getUserId());
} }
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 vreOrganization : vOrg.getChildren()) { for (GCubeGroup vreOrganization : vOrg.getChildren()) {
@ -200,7 +203,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
String vreDescription = vreOrganization.getDescription(); String vreDescription = vreOrganization.getDescription();
long logoId = vreOrganization.getLogoId(); long logoId = vreOrganization.getLogoId();
String vreLogoURL = "/image/layout_set_logo?img_id="+ logoId+"&t="+nowInMillis;; String vreLogoURL = gm.getGroupLogoURL(logoId);
String groupName = gm.getInfrastructureScope(vreOrganization.getGroupId()); String groupName = gm.getInfrastructureScope(vreOrganization.getGroupId());
String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+vreOrganization.getFriendlyURL(); String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+vreOrganization.getFriendlyURL();
@ -318,9 +321,9 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
String vreName = selectedVRE.getGroupName(); String vreName = selectedVRE.getGroupName();
String vreDescription = selectedVRE.getDescription(); String vreDescription = selectedVRE.getDescription();
long nowInMillis = new Date().getTime();
long logoId = selectedVRE.getLogoId(); long logoId = selectedVRE.getLogoId();
String vreLogoURL = "/image/layout_set_logo?img_id="+ logoId+"&t="+nowInMillis;; String vreLogoURL = gm.getGroupLogoURL(logoId);
String infraScope = gm.getInfrastructureScope(selectedVRE.getGroupId()); String infraScope = gm.getInfrastructureScope(selectedVRE.getGroupId());
String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+selectedVRE.getFriendlyURL(); String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+selectedVRE.getFriendlyURL();
VRECustomAttributes attrs = getVRECustomAttr(selectedVRE); VRECustomAttributes attrs = getVRECustomAttr(selectedVRE);