List of usage examples for com.liferay.portal.kernel.model LayoutTypePortlet getAllPortlets
public List<Portlet> getAllPortlets(String columnId);
From source file:com.liferay.layout.admin.web.internal.exportimport.data.handler.LayoutStagedModelDataHandler.java
License:Open Source License
protected Map<String, Object[]> getPortletids(PortletDataContext portletDataContext, Layout layout) throws Exception { if (!LayoutStagingUtil.prepareLayoutStagingHandler(portletDataContext, layout) || !layout.isSupportsEmbeddedPortlets()) { // Only portlet type layouts support page scoping return Collections.emptyMap(); }//from w ww . jav a 2 s .com Map<String, Object[]> portletIds = new HashMap<>(); LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout.getLayoutType(); // The getAllPortlets method returns all effective nonsystem portlets // for any layout type, including embedded portlets, or in the case of // panel type layout, selected portlets for (Portlet portlet : layoutTypePortlet.getAllPortlets(false)) { String portletId = portlet.getPortletId(); Settings portletInstanceSettings = SettingsFactoryUtil .getSettings(new PortletInstanceSettingsLocator(layout, portletId)); String scopeType = portletInstanceSettings.getValue("lfrScopeType", null); String scopeLayoutUuid = portletInstanceSettings.getValue("lfrScopeLayoutUuid", null); long scopeGroupId = portletDataContext.getScopeGroupId(); if (Validator.isNotNull(scopeType)) { Group scopeGroup = null; if (scopeType.equals("company")) { scopeGroup = _groupLocalService.getCompanyGroup(layout.getCompanyId()); } else if (scopeType.equals("layout")) { Layout scopeLayout = null; scopeLayout = _layoutLocalService.fetchLayoutByUuidAndGroupId(scopeLayoutUuid, portletDataContext.getGroupId(), portletDataContext.isPrivateLayout()); if (scopeLayout == null) { continue; } scopeGroup = scopeLayout.getScopeGroup(); } else { throw new IllegalArgumentException("Scope type " + scopeType + " is invalid"); } if (scopeGroup != null) { scopeGroupId = scopeGroup.getGroupId(); } } String key = PortletPermissionUtil.getPrimaryKey(layout.getPlid(), portletId); portletIds.put(key, new Object[] { portletId, scopeGroupId, scopeType, scopeLayoutUuid }); } return portletIds; }