留言板

Programatically retrieve the list of available portlets

Ratheesh Vijayakumaran Nair,修改在11 年前。

Programatically retrieve the list of available portlets

New Member 帖子: 19 加入日期: 12-5-31 最近的帖子
I have a requirement to allow the user to pick the portlets that he wants to see in a page. The idea is to create an application for the user and allow them to select a layout and the available portlets to be dragged into the layout area and make that as his custom page. So if the user accesses that custom page, I should display the portlet application that he chose in the layout he chose. I was able to get the list of available layout by using the List<LayoutTemplate> layoutTemplates = LayoutTemplateLocalServiceUtil.getLayoutTemplates(); I would like to know if there is a similar way to retrieve the list of available portlets so that can be shown as a list for the user to select to be added to his custom page. Is there a way to programmatically retrieve it?

Thanks
Ratheesh
thumbnail
Christianto Sahat,修改在11 年前。

RE: Programatically retrieve the list of available portlets

Regular Member 帖子: 179 加入日期: 07-9-25 最近的帖子
You can use PortletLocalServiceUtil.getPortlets() to display all the portlets inside the portal.

But I believe you don't want to display system portlet into the users. In that case you can use


    PortletLocalServiceUtil.getPortlets(long companyId, boolean showSystem, boolean showPortal) 
   

set showSystem and showPortal to false
Ratheesh Vijayakumaran Nair,修改在11 年前。

RE: Programatically retrieve the list of available portlets

New Member 帖子: 19 加入日期: 12-5-31 最近的帖子
Thanks a lot, I'll try that.