Skip to content

Instantly share code, notes, and snippets.

@xhawk
Created May 28, 2013 10:58
Show Gist options
  • Save xhawk/5661969 to your computer and use it in GitHub Desktop.
Save xhawk/5661969 to your computer and use it in GitHub Desktop.
List all the portlets in company 10180
import com.liferay.portal.model.*;
import com.liferay.portal.kernel.plugin.*;
import com.liferay.portal.service.*;
import com.liferay.portal.util.*;
List portlets = PortletLocalServiceUtil.getPortlets(10180, 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(10180, portlet.getPortletId(), Plugin.TYPE_PORTLET);
// Name and description
StringBuilder sb = new StringBuilder();
String displayName = portlet.getDisplayName();
//String title = PortalUtil.getPortletTitle(portlet, application, locale);
System.out.println(displayName + " | " + portlet.getPortletId());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment