Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Shannon Scott
Determine the Portlets on a Page
December 12, 2011 11:24 AM
Answer

Shannon Scott

Rank: New Member

Posts: 7

Join Date: August 10, 2011

Recent Posts

Hello,
I am trying to create reports about the Portal.
I would like to report on the Portlets on a Page - I know the names aren't nice.
Which Class is responsible for determining what is displayed on the page?
How could I determine which class and query is used to show the portlets on a page?

Thank you.
Shannon
Jelmer Kuperus
RE: Determine the Portlets on a Page
December 12, 2011 12:08 PM
Answer

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

I haven't tried but it should be something like this

1List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(groupId, false);
2for (Layout layout : layouts) {
3  if (layout.isTypePortlet() {
4    LayoutTypePortlet layoutType = (LayoutTypePortlet) layout.getLayoutType();
5    List<Portlet> portletsOnPage = layoutType.getPortlets()
6  }
7}
David H Nebinger
RE: Determine the Portlets on a Page
December 12, 2011 12:15 PM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11511

Join Date: September 1, 2006

Recent Posts

Inherently the portal pages are completely dynamic, especially when you are considering the user's private pages.

All of the layout stuff is defined in the Liferay tables, although the data model is neither documented or really published in any way.

What you're looking for is probably going to be very difficult to pull together.