/** * Returns the current layout's {@link LayoutType}. * * @return the current layout's layout type */ @Override public LayoutType getLayoutType() { return _layout.getLayoutType(); }
public boolean isBrowsable() { LayoutType layoutType = _layout.getLayoutType(); return layoutType.isBrowsable(); }
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(); }
public static String addPortletId( Layout layout, String portletId, String columnId) throws Exception { LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet)layout.getLayoutType(); portletId = layoutTypePortlet.addPortletId( 0, portletId, columnId, -1, false); updateLayout(layout); addResourcePermissions(layout, portletId); return portletId; }
protected boolean isAccessGrantedByPortletOnPage( Layout layout, Portlet portlet) { String portletId = portlet.getPortletId(); if (layout.isTypePanel() && isPanelSelectedPortlet(layout, portletId)) { return true; } LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet)layout.getLayoutType(); if ((layoutTypePortlet != null) && layoutTypePortlet.hasPortletId(portletId)) { return true; } return false; }
/** * @deprecated As of Judson (7.1.x), replaced by {@link * LayoutPrototypeHelper#addLayoutPrototype} */ @Deprecated public static Layout addLayoutPrototype( long companyId, long defaultUserId, Map<Locale, String> nameMap, Map<Locale, String> descriptionMap, String layoutTemplateId, List<LayoutPrototype> layoutPrototypes) throws Exception { String name = nameMap.get(LocaleUtil.getDefault()); for (LayoutPrototype layoutPrototype : layoutPrototypes) { String curName = layoutPrototype.getName(LocaleUtil.getDefault()); if ((name == null) || name.equals(curName)) { return null; } } LayoutPrototype layoutPrototype = LayoutPrototypeLocalServiceUtil.addLayoutPrototype( defaultUserId, companyId, nameMap, descriptionMap, true, new ServiceContext()); Layout layout = layoutPrototype.getLayout(); LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet)layout.getLayoutType(); layoutTypePortlet.setLayoutTemplateId(0, layoutTemplateId, false); return layout; }
public static Layout addLayout( LayoutSet layoutSet, String nameKey, String friendlyURL, String layoutTemplateId) throws Exception { Group group = layoutSet.getGroup(); Map<Locale, String> nameMap = new HashMap<>(); for (Locale locale : LanguageUtil.getAvailableLocales()) { nameMap.put(locale, LanguageUtil.get(locale, nameKey)); } Map<Locale, String> friendlyURLMap = new HashMap<>(); friendlyURLMap.put(LocaleUtil.getDefault(), friendlyURL); ServiceContext serviceContext = new ServiceContext(); Layout layout = LayoutLocalServiceUtil.addLayout( group.getCreatorUserId(), group.getGroupId(), layoutSet.isPrivateLayout(), LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, nameMap, null, null, null, null, LayoutConstants.TYPE_PORTLET, StringPool.BLANK, false, friendlyURLMap, serviceContext); LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet)layout.getLayoutType(); layoutTypePortlet.setLayoutTemplateId(0, layoutTemplateId, false); return layout; }
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); }
LayoutType layoutType = layout.getLayoutType();
(LayoutTypePortlet)layout.getLayoutType();
protected void exportPortletPreferences( PortletDataContext portletDataContext, long ownerId, int ownerType, boolean defaultUser, Layout layout, long plid, String portletId, Element parentElement) throws Exception { PortletPreferences portletPreferences = null; try { portletPreferences = getPortletPreferences( ownerId, ownerType, plid, portletId); } catch (NoSuchPortletPreferencesException nsppe) { // LPS-52675 if (_log.isDebugEnabled()) { _log.debug(nsppe, nsppe); } return; } LayoutTypePortlet layoutTypePortlet = null; if (layout != null) { layoutTypePortlet = (LayoutTypePortlet)layout.getLayoutType(); } if ((layoutTypePortlet == null) || layoutTypePortlet.hasPortletId(portletId)) { exportPortletPreference( portletDataContext, ownerId, ownerType, defaultUser, portletPreferences, portletId, plid, parentElement); } }
(LayoutTypePortlet)layout.getLayoutType();