本文整理汇总了Java中com.liferay.portal.kernel.service.LayoutLocalServiceUtil类的典型用法代码示例。如果您正苦于以下问题:Java LayoutLocalServiceUtil类的具体用法?Java LayoutLocalServiceUtil怎么用?Java LayoutLocalServiceUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LayoutLocalServiceUtil类属于com.liferay.portal.kernel.service包,在下文中一共展示了LayoutLocalServiceUtil类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLayoutByFriendlyURL
import com.liferay.portal.kernel.service.LayoutLocalServiceUtil; //导入依赖的package包/类
/**
* Get layout by friendlyurl.
*
* @param resourceRequest
* @return layout
* @throws PortalException if layout is not found
*/
public static Layout getLayoutByFriendlyURL(
PortletRequest portletRequest, String layoutFriendlyURL)
throws PortalException {
ThemeDisplay themeDisplay =
(ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
if (layoutFriendlyURL != null) {
return LayoutLocalServiceUtil.getFriendlyURLLayout(
themeDisplay.getScopeGroupId(),
themeDisplay.getLayout().isPrivateLayout(), layoutFriendlyURL);
}
throw new PortalException(
"Couldn't find asset publisher layout for " + layoutFriendlyURL +
". Please check configuration.");
}
示例2: addEntry
import com.liferay.portal.kernel.service.LayoutLocalServiceUtil; //导入依赖的package包/类
@Override
public Object addEntry(RequestContext requestContext) throws Exception {
Layout layout = (Layout)super.addEntry(requestContext);
String layoutPrototypeId = (String) requestContext.get(
LAYOUT_TEMPLATE_SELECT_LIST);
if ((layoutPrototypeId != null) && (!layoutPrototypeId.equals(""))) {
LayoutPrototype layoutPrototype =
LayoutPrototypeLocalServiceUtil.getLayoutPrototype(
Long.valueOf(layoutPrototypeId));
if (layoutPrototype != null) {
layout.setLayoutPrototypeUuid(layoutPrototype.getUuid());
layout.setLayoutPrototypeLinkEnabled(true);
layout = LayoutLocalServiceUtil.updateLayout(layout);
}
}
return layout;
}
示例3: _getLayoutNameIdPairs
import com.liferay.portal.kernel.service.LayoutLocalServiceUtil; //导入依赖的package包/类
private List<KeyValuePair> _getLayoutNameIdPairs(
long groupId, boolean privateLayout) throws SystemException {
List<KeyValuePair> layoutNameIdPairs = new ArrayList<KeyValuePair>();
List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(
groupId, privateLayout);
for (Layout layout : layouts) {
if (layout.isHidden() || !layout.isRootLayout() ||
layout.isTypeControlPanel()|| layout.isTypeControlPanel() ||
layout.isTypeURL()) {
continue;
}
String layoutId = String.valueOf(layout.getLayoutId());
String layoutName = layout.getNameCurrentValue(); //getName();
layoutNameIdPairs.add(
new KeyValuePair(layoutName, layoutId));
}
return layoutNameIdPairs;
}
示例4: getCurrentLayoutFriendlyURL
import com.liferay.portal.kernel.service.LayoutLocalServiceUtil; //导入依赖的package包/类
/**
* Get current layout friendly URL
*
* @return String friendly URL for the current layout
* @throws PortalException
*/
public static String getCurrentLayoutFriendlyURL(PortletRequest portletRequest)
throws PortalException {
ThemeDisplay themeDisplay =
(ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
Layout selectedLayout =
LayoutLocalServiceUtil.getLayout(themeDisplay.getPlid());
return PortalUtil.getLayoutFriendlyURL(selectedLayout, themeDisplay);
}
示例5: getAddClass
import com.liferay.portal.kernel.service.LayoutLocalServiceUtil; //导入依赖的package包/类
@Override
protected Class<?> getAddClass() throws ClassNotFoundException {
return LayoutLocalServiceUtil.class;
}
示例6: lookupPageIdWithFriendlyUrl
import com.liferay.portal.kernel.service.LayoutLocalServiceUtil; //导入依赖的package包/类
public static String lookupPageIdWithFriendlyUrl(final String content,
final String locationHint, final long groupId, final long company,
final boolean isPrivate, final IdMode mode) {
String contentCopy = content;
String lookUp = PAGE_ID_BY_FRIENDLY_URL;
if (isPrivate) {
lookUp = lookUp.replace("%%PTYPE%%", "PRIV");
} else {
lookUp = lookUp.replace("%%PTYPE%%", "PUB");
}
switch (mode) {
case ID:
lookUp = lookUp.replace("%%LAYOUTID%%", "PLID");
break;
case PLID:
lookUp = lookUp.replace("%%LAYOUTID%%", "ID");
break;
case UUID:
lookUp = lookUp.replace("%%LAYOUTID%%", "UUID");
break;
}
int pos = contentCopy.indexOf(lookUp);
while (pos > -1) {
int pos2 = contentCopy.indexOf(CLOSING_TAG, pos);
if (pos2 < 0) {
LOG.error("No closing Tag, pos " + pos + " for " + locationHint);
break;
} else {
// by default the referred file is looked up in current site.
long siteGroupId = groupId;
String fUrl = contentCopy.substring(pos + lookUp.length(), pos2).trim();
// check for the reference to another site
String[] refSegs = ResolverUtil.separateSiteRef(fUrl);
if (!refSegs[0].equals("")) {
siteGroupId = ResolverUtil.getSiteGroupIdByName(refSegs[0], company,
locationHint);
fUrl = refSegs[1];
}
String pageId = "NOT FOUND";
Layout l = null;
try {
l = LayoutLocalServiceUtil.getFriendlyURLLayout(siteGroupId, isPrivate, fUrl);
} catch (PortalException | SystemException e) {
e.printStackTrace();
}
if (l == null) {
LOG.error("Referred page " + fUrl + " is not found .");
contentCopy = contentCopy.substring(0, pos) + " PAGE NOT FOUND!! " + contentCopy
.substring(pos2 + CLOSING_TAG.length(), contentCopy.length());
} else {
switch (mode) {
case ID:
pageId = Long.toString(l.getLayoutId());
break;
case PLID:
pageId = Long.toString(l.getPlid());
break;
case UUID:
pageId = l.getUuid();
break;
}
contentCopy = contentCopy.substring(0, pos) + pageId + contentCopy
.substring(pos2 + CLOSING_TAG.length(), contentCopy.length());
}
}
pos = contentCopy.indexOf(lookUp, pos + 1);
}
//
return contentCopy;
}