Search

Monday, September 14, 2009

How to get list of portlets in Liferay

List portlets = PortletLocalServiceUtil.getPortlets(company.getCompanyId(), false, false);
//portlets = ListUtil.sort(portlets, new PortletTitleComparator(application, locale));
int total = portlets.size();
for (int i = 0; i < total; i++) {
Portlet portlet = portlets.get(i);

PluginPackage pluginPackage = portlet.getPluginPackage();
PluginSetting pluginSetting = PluginSettingLocalServiceUtil.getPluginSetting(company.getCompanyId(), portlet.getPortletId(), Plugin.TYPE_PORTLET);

// Name and description

StringBuilder sb = new StringBuilder();

String displayName = portlet.getDisplayName();
String title = PortalUtil.getPortletTitle(portlet, application, locale);

}

2 comments:

  1. How you instantiate the "company" object? Where it came from?

    ReplyDelete
    Replies
    1. renata, you can iterate over `CompanyLocalServiceUtil.getCompanies()`

      or get it using `PortalUtil.getCompany(request)`

      Delete