Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get current group id (or community id) in liferay (java)?

I'm developing portlet with Vaadin in Liferay 6 and I need to get the ID of the community where the portlet is located. How is it done?

like image 695
Pat Guy Avatar asked Mar 24 '11 14:03

Pat Guy


1 Answers

There is no Community entity in Liferay, it's just another kind of group (see GroupConstants)

If you have access to a ThemeDisplay object I think this will give you the Id of the community

long id = themeDisplay.getLayout().getGroupId();

In a struts action you can get ThemeDisplay like this:

ThemeDisplay themeDisplay = 
     (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);

where request can be a RenderRequest or an ActionRequest.

like image 149
blank Avatar answered Sep 27 '22 00:09

blank