List of usage examples for com.liferay.portal.kernel.service LayoutLocalServiceUtil fetchLayout
public static com.liferay.portal.kernel.model.Layout fetchLayout(long plid)
From source file:com.liferay.asset.publisher.web.display.context.BaseItemSelectorViewDisplayContext.java
License:Open Source License
@Override public long[] getSelectedGroupIds() { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); String portletResource = ParamUtil.getString(request, "portletResource"); long plid = ParamUtil.getLong(request, "plid"); Layout layout = LayoutLocalServiceUtil.fetchLayout(plid); if (layout == null) { return new long[0]; }// w w w. j av a2s . c o m PortletPreferences portletPreferences = themeDisplay.getStrictLayoutPortletSetup(layout, portletResource); return AssetPublisherUtil.getGroupIds(portletPreferences, themeDisplay.getScopeGroupId(), themeDisplay.getLayout()); }
From source file:com.liferay.calendar.notification.impl.NotificationTemplateContextFactory.java
License:Open Source License
private static String _getCalendarBookingURL(User user, long calendarBookingId) throws PortalException { Group group = GroupLocalServiceUtil.getGroup(user.getCompanyId(), GroupConstants.GUEST); Layout layout = LayoutLocalServiceUtil.fetchLayout(group.getDefaultPublicPlid()); String portalURL = _getPortalURL(group.getCompanyId(), group.getGroupId()); String layoutActualURL = PortalUtil.getLayoutActualURL(layout); String url = portalURL + layoutActualURL; String namespace = PortalUtil.getPortletNamespace(CalendarPortletKeys.CALENDAR); url = HttpUtil.addParameter(url, namespace + "mvcPath", "/view_calendar_booking.jsp"); url = HttpUtil.addParameter(url, "p_p_id", CalendarPortletKeys.CALENDAR); url = HttpUtil.addParameter(url, "p_p_lifecycle", "0"); url = HttpUtil.addParameter(url, "p_p_state", WindowState.MAXIMIZED.toString()); url = HttpUtil.addParameter(url, namespace + "calendarBookingId", calendarBookingId); return url;//from w w w. j a va 2 s. c om }
From source file:com.liferay.exportimport.content.processor.base.BaseTextExportImportContentProcessor.java
License:Open Source License
protected String replaceImportLinksToLayouts(PortletDataContext portletDataContext, String content) throws Exception { List<String> oldLinksToLayout = new ArrayList<>(); List<String> newLinksToLayout = new ArrayList<>(); Matcher matcher = importLinksToLayoutPattern.matcher(content); Map<Long, Long> layoutPlids = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(Layout.class); String layoutsImportMode = MapUtil.getString(portletDataContext.getParameterMap(), PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE, PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE_MERGE_BY_LAYOUT_UUID); while (matcher.find()) { long oldPlid = GetterUtil.getLong(matcher.group(4)); Long newPlid = MapUtil.getLong(layoutPlids, oldPlid); long oldGroupId = GetterUtil.getLong(matcher.group(6)); long newGroupId = oldGroupId; long oldLayoutId = GetterUtil.getLong(matcher.group(1)); long newLayoutId = oldLayoutId; Layout layout = LayoutLocalServiceUtil.fetchLayout(newPlid); if (layout != null) { newGroupId = layout.getGroupId(); newLayoutId = layout.getLayoutId(); } else if (_log.isDebugEnabled()) { StringBundler sb = new StringBundler(5); sb.append("Unable to get layout with plid "); sb.append(oldPlid);/*from w w w. j a v a2s . com*/ sb.append(", using layout ID "); sb.append(newLayoutId); sb.append(" instead"); _log.debug(sb.toString()); } String oldLinkToLayout = matcher.group(0); String newLinkToLayout = StringUtil.replaceFirst(oldLinkToLayout, new String[] { StringPool.AT + oldPlid, String.valueOf(oldLayoutId) }, new String[] { StringPool.BLANK, String.valueOf(newLayoutId) }); if ((layout != null) && layout.isPublicLayout() && layoutsImportMode .equals(PortletDataHandlerKeys.LAYOUTS_IMPORT_MODE_CREATED_FROM_PROTOTYPE)) { newLinkToLayout = StringUtil.replace(newLinkToLayout, "private-group", "public"); } if ((oldGroupId != 0) && (oldGroupId != newGroupId)) { newLinkToLayout = StringUtil.replaceLast(newLinkToLayout, String.valueOf(oldGroupId), String.valueOf(newGroupId)); } oldLinksToLayout.add(oldLinkToLayout); newLinksToLayout.add(newLinkToLayout); } content = StringUtil.replace(content, ArrayUtil.toStringArray(oldLinksToLayout.toArray()), ArrayUtil.toStringArray(newLinksToLayout.toArray())); return content; }
From source file:com.liferay.layout.admin.web.internal.display.context.LayoutsAdminDisplayContext.java
License:Open Source License
public Layout getSelLayout() { if (_selLayout != null) { return _selLayout; }/*from w w w .j av a 2 s . co m*/ if (getSelPlid() != LayoutConstants.DEFAULT_PLID) { _selLayout = LayoutLocalServiceUtil.fetchLayout(getSelPlid()); } return _selLayout; }