public static List<LayoutTypePortlet> getLayoutTypePortlets(Layout layout) throws PortletContainerException { if (_PORTLET_EVENT_DISTRIBUTION_LAYOUT_SET) { List<Layout> layouts = null; try { layouts = LayoutLocalServiceUtil.getLayouts( layout.getGroupId(), layout.isPrivateLayout(), LayoutConstants.TYPE_PORTLET); } catch (PortalException pe) { throw new PortletContainerException(pe); } List<LayoutTypePortlet> layoutTypePortlets = new ArrayList<>( layouts.size()); for (Layout curLayout : layouts) { LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet)curLayout.getLayoutType(); layoutTypePortlets.add(layoutTypePortlet); } return layoutTypePortlets; } if (layout.isTypePortlet()) { List<LayoutTypePortlet> layoutTypePortlets = new ArrayList<>(1); LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet)layout.getLayoutType(); layoutTypePortlets.add(layoutTypePortlet); return layoutTypePortlets; } return Collections.emptyList(); }
private ObjectValuePair<Long, String> _getPlidPortletIdObjectValuePair( long groupId, long scopeGroupId, String portletId) throws PortalException { for (boolean privateLayout : Arrays.asList(false, true)) { List<Layout> layouts = LayoutLocalServiceUtil.getLayouts( groupId, privateLayout, LayoutConstants.TYPE_PORTLET); for (Layout layout : layouts) { LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet)layout.getLayoutType(); String candidatePortletId = getPortletId( layoutTypePortlet, portletId); if (Validator.isNotNull(candidatePortletId) && (_getScopeGroupId(layout, candidatePortletId) == scopeGroupId)) { return new ObjectValuePair<>( layout.getPlid(), candidatePortletId); } } } return new ObjectValuePair<>( LayoutConstants.DEFAULT_PLID, StringPool.BLANK); }