Forums de discussion

Public GroupID

thumbnail
Rob Chan, modifié il y a 12 années.

Public GroupID

Junior Member Publications: 82 Date d'inscription: 23/03/11 Publications récentes
Is there a preset constant for the default GroupID? I'm creating a page that doesn't require you to log in to view, but the portlets on the page require a groupID to function.

I've tried using:

	ServiceContext sC = new ServiceContext();
		ThemeDisplay themeDisplay= (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
               long portletGroupId= themeDisplay.getScopeGroupId();
		sC.setScopeGroupId(portletGroupId);

Which doesn't seem to work. This is a modified version of a proposed deprecated solution from the forums:

	ServiceContext sC = new ServiceContext();
		ThemeDisplay themeDisplay= (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
		long portletGroupId= themeDisplay.getPortletGroupId();
		sC.setScopeGroupId(portletGroupId);


Does anyone have any suggestions?
thumbnail
Ali Shahrami, modifié il y a 12 années.

RE: Public GroupID

Junior Member Publications: 52 Date d'inscription: 01/08/09 Publications récentes
Rob Chan:


	ServiceContext sC = new ServiceContext();
		ThemeDisplay themeDisplay= (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
		long portletGroupId= themeDisplay.getPortletGroupId();
		sC.setScopeGroupId(portletGroupId);




Hi Rob,

The default value for _scopeGroupId is 0 and themeDisplay.getPortletGroupId() calls getScopeGroupId(). So in the above code, you are simply setting the same value that you get.

I'm not sure what portlet you are using but have tried to get "guest" groupId?

Ali
thumbnail
Rob Chan, modifié il y a 12 années.

RE: Public GroupID

Junior Member Publications: 82 Date d'inscription: 23/03/11 Publications récentes
Ali Shahrami:


Hi Rob,

The default value for _scopeGroupId is 0 and themeDisplay.getPortletGroupId() calls getScopeGroupId(). So in the above code, you are simply setting the same value that you get.

I'm not sure what portlet you are using but have tried to get "guest" groupId?

Ali


Ah, the reason I did that was because I was creating a new service context for use with portlets and I was trying to create an instance of the existing service context with only the groupID intact.

I'm curious, what is the "guest" groupID? Is that a pre-established constant?

After some extensive testing yesterday, I have found out that my first code snippet did work, and my second code snippet did not. So for future reference if you need to create a service context with the purpose stated above, this is a valid solution.