本文整理汇总了Java中com.liferay.portal.service.LayoutLocalServiceUtil.getLayouts方法的典型用法代码示例。如果您正苦于以下问题:Java LayoutLocalServiceUtil.getLayouts方法的具体用法?Java LayoutLocalServiceUtil.getLayouts怎么用?Java LayoutLocalServiceUtil.getLayouts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.service.LayoutLocalServiceUtil
的用法示例。
在下文中一共展示了LayoutLocalServiceUtil.getLayouts方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPortalPageLayout
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入方法依赖的package包/类
protected Layout getPortalPageLayout(long userId, long groupId, String portalPageName, boolean privateLayout)
throws Exception {
Layout portalPageLayout = null;
List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(groupId, privateLayout);
for (Layout layout : layouts) {
if (layout.getName(Locale.US).equals(portalPageName)) {
portalPageLayout = layout;
}
}
if (portalPageLayout == null) {
long parentLayoutId = LayoutConstants.DEFAULT_PARENT_LAYOUT_ID;
String type = LayoutConstants.TYPE_PORTLET;
boolean hidden = false;
String friendlyURL = "/" + portalPageName.toLowerCase();
portalPageLayout = ServiceUtil.addLayout(userId, groupId, privateLayout, parentLayoutId, portalPageName,
portalPageName, portalPageName, type, hidden, friendlyURL);
}
return portalPageLayout;
}
示例2: getLayouts
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入方法依赖的package包/类
public List<Layout> getLayouts(){
try {
return LayoutLocalServiceUtil.getLayouts(getGroupId(), false);
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
示例3: getLayout
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入方法依赖的package包/类
public static Layout getLayout(long groupId, String context) {
Layout result = null;
try {
result = LayoutLocalServiceUtil.getFriendlyURLLayout(groupId,
false, context);
m_objLog.debug("Found layout registered for group " + groupId
+ " and url " + context);
} catch (Throwable t) {
m_objLog.warn("No layout registered for group " + groupId
+ " with url " + context);
// retry searching manually
if (result == null) {
try {
List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(QueryUtil.ALL_POS, QueryUtil.ALL_POS);
for (Layout layout: layouts) {
if (layout.isPublicLayout() && layout.getFriendlyURL().equals(context)) {
result = layout;
m_objLog.debug("Found matching public layout "+context+" with group "+result.getGroupId()+", company "+result.getCompanyId());
break;
}
}
} catch (Throwable t2) {
t2.printStackTrace();
}
}
}
return result;
}
示例4: doView
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入方法依赖的package包/类
@Override
public void doView(RenderRequest renderRequest,
RenderResponse renderResponse) throws IOException, PortletException {
// Busca as páginas da comunidade "guest"
ThemeDisplay td = (ThemeDisplay) renderRequest
.getAttribute(WebKeys.THEME_DISPLAY);
LinkedHashMap<String, String> links = new LinkedHashMap<String, String>();
try {
Group grupo = GroupLocalServiceUtil.getGroup(td.getCompanyId(),
GroupConstants.GUEST);
LayoutSet paginas = grupo.getPublicLayoutSet();
if (paginas.getPageCount() > 0) {
List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(
grupo.getGroupId(), false, GroupConstants.DEFAULT_PARENT_GROUP_ID);
for (Layout layout : layouts) {
String url = PortalUtil.getLayoutFullURL(layout, td);
links.put(layout.getName(td.getLocale()), url);
}
}
} catch (Exception e) {
LOG.error("Erro ao recuperar páginas da comunidade guest", e);
}
renderRequest.setAttribute("links", links);
super.doView(renderRequest, renderResponse);
}
示例5: afterPropertiesSet
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入方法依赖的package包/类
public void afterPropertiesSet() throws Exception {
User user = UserLocalServiceUtil.getDefaultUser(companyId);
userId = user.getUserId();
Group group = null;
if (targetClassName.equals(LayoutSetPrototype.class.getName())) {
LayoutSetPrototype layoutSetPrototype = getLayoutSetPrototype(
companyId, targetValue);
if (layoutSetPrototype != null) {
existing = true;
}
else {
layoutSetPrototype =
LayoutSetPrototypeLocalServiceUtil.addLayoutSetPrototype(
userId, companyId, getTargetValueMap(),
StringPool.BLANK, true, true, new ServiceContext());
}
group = layoutSetPrototype.getGroup();
targetClassPK = layoutSetPrototype.getLayoutSetPrototypeId();
}
else if (targetClassName.equals(Group.class.getName())) {
if (targetValue.equals(GroupConstants.GUEST)) {
group = GroupLocalServiceUtil.getGroup(
companyId, GroupConstants.GUEST);
List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(
group.getGroupId(), false,
LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, false, 0, 1);
if (!layouts.isEmpty()) {
Layout layout = layouts.get(0);
LayoutTypePortlet layoutTypePortlet =
(LayoutTypePortlet)layout.getLayoutType();
List<String> portletIds = layoutTypePortlet.getPortletIds();
if (portletIds.size() != 2) {
existing = true;
}
for (String portletId : portletIds) {
if (!portletId.equals("47") &&
!portletId.equals("58")) {
existing = true;
}
}
}
}
else {
group = GroupLocalServiceUtil.fetchGroup(
companyId, targetValue);
if (group != null) {
existing = true;
}
else {
group = GroupLocalServiceUtil.addGroup(
userId, GroupConstants.DEFAULT_PARENT_GROUP_ID,
StringPool.BLANK,
GroupConstants.DEFAULT_PARENT_GROUP_ID,
GroupConstants.DEFAULT_LIVE_GROUP_ID, targetValue,
StringPool.BLANK, GroupConstants.TYPE_SITE_OPEN, true,
GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION, null,
true, true, new ServiceContext());
}
}
targetClassPK = group.getGroupId();
}
if (group != null) {
groupId = group.getGroupId();
}
}
示例6: _createList
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入方法依赖的package包/类
private void _createList(long parentLayoutId, int parentId, int depth)
throws PortalException, SystemException {
List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(
_groupId, _privateLayout, parentLayoutId);
for (int i = 0; i < layouts.size(); i++) {
Layout layout = layouts.get(i);
if (i == 0) {
depth++;
if (depth > _depth) {
_depth = depth;
}
}
StringBundler sb = new StringBundler(13);
sb.append(++_nodeId);
sb.append("|");
sb.append(parentId);
sb.append("|");
if ((i + 1) == layouts.size()) {
sb.append("1");
}
else {
sb.append("0");
}
sb.append("|");
sb.append(layout.getPlid());
sb.append("|");
sb.append(layout.getName(_locale));
sb.append("|");
//sb.append("9");
sb.append("11");
sb.append("|");
sb.append(depth);
_list.add(sb.toString());
_createList(layout.getLayoutId(), _nodeId, depth);
}
}