Search code examples
liferay-6

How can I get the IDs of all installed portlets in Liferay 6.2?


In Liferay 6.1 one could get the identifiers of installed portlets with Liferay.Portlet.runtimePortletIds or WebKeys.RUNTIME_PORTLET_IDS.

However in Liferay 6.2 this forms have disappeared.

Can anyone tell me a way to get the same results as with the methods discussed above in Liferay 6.2?


Solution

  • You can access nearly every model object in Liferay with a ...LocalServiceUtil. In your case the PortletLocalServiceUtil:

    List<Portlet> installedPortlets = PortletLocalServiceUtil.getPortlets();
    for (Portlet installedPortlet : installedPortlets) {
      String portletId = installedPortlet.getPortletId();
      ...
    }