掲示板

Public GroupID

thumbnail
12年前 に Rob Chan によって更新されました。

Public GroupID

Junior Member 投稿: 82 参加年月日: 11/03/23 最新の投稿
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
12年前 に Ali Shahrami によって更新されました。

RE: Public GroupID

Junior Member 投稿: 52 参加年月日: 09/08/01 最新の投稿
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
12年前 に Rob Chan によって更新されました。

RE: Public GroupID

Junior Member 投稿: 82 参加年月日: 11/03/23 最新の投稿
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.