本文整理汇总了Java中com.liferay.portal.model.Layout.getParentLayoutId方法的典型用法代码示例。如果您正苦于以下问题:Java Layout.getParentLayoutId方法的具体用法?Java Layout.getParentLayoutId怎么用?Java Layout.getParentLayoutId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.model.Layout
的用法示例。
在下文中一共展示了Layout.getParentLayoutId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParentLayoutId
import com.liferay.portal.model.Layout; //导入方法依赖的package包/类
@Override
public long getParentLayoutId() {
long parentLayoutId = super.getParentLayoutId();
if (parentLayoutId == LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) {
Layout junctionPointLayout = JunctionPointUtil.getConfiguredJunctionPointLayout(getWrappedModel());
if (junctionPointLayout != null && junctionPointLayout.getParentLayoutId() != LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) {
// HACK! Das Breadcrumb-Portlet fragt erst die ParentLayoutId ab und ruft danach getParentLayout, falls die ID != 0 ist.
// andere Klassen machen dies aber leider ganz anders.
StackTraceElement stackTraceElement = new Exception().getStackTrace()[1];
if ("com.liferay.taglib.ui.BreadcrumbTag".equals(stackTraceElement.getClassName())) {
return -1;
}
}
}
return parentLayoutId;
}
示例2: getConfiguredJunctionPointLayout
import com.liferay.portal.model.Layout; //导入方法依赖的package包/类
/**
* Lookup the configured junction point to be used instead of the given layout or null, if no
* junction point is configured at all.
*
* @param layout The layout that may have configured a junction point to be used
* @return The connected Layout or null
*/
@Override
public Layout getConfiguredJunctionPointLayout(Layout layout) {
// only top level layouts may use a junction point
if (layout.getParentLayoutId() != LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) {
return null;
}
Layout junctionPointLayout = null;
// lookup the junction point configuration value
String configValue = (String) layout.getExpandoBridge().getAttribute(JUNCTION_POINT_CONNECTION, false);
if (Validator.isNotNull(configValue)) {
// the configuration consists of the group uuid and the layout id.
String[] configParts = configValue.split("/");
if (configParts.length == 2) {
Group group;
try {
group = GroupLocalServiceUtil.fetchGroupByUuidAndCompanyId(configParts[0], layout.getCompanyId());
long layoutId = GetterUtil.getLong(configParts[1]);
if (group != null && layoutId != GetterUtil.DEFAULT_LONG) {
junctionPointLayout = LayoutLocalServiceUtil.fetchLayout(group.getGroupId(), layout.getPrivateLayout(), layoutId);
}
}
catch (SystemException e) {
; // ignore (the config is outdated)
}
}
}
return junctionPointLayout;
}