private void _buildParentGroupsBreadcrumb( LayoutSet layoutSet, PortletURL portletURL, ThemeDisplay themeDisplay, StringBundler sb) throws Exception { Group group = layoutSet.getGroup(); if (group.isOrganization()) { Organization organization = OrganizationLocalServiceUtil.getOrganization(group.getOrganizationId()); Organization parentOrganization = organization.getParentOrganization(); if (parentOrganization != null) { Group parentGroup = parentOrganization.getGroup(); LayoutSet parentLayoutSet = LayoutSetLocalServiceUtil.getLayoutSet( parentGroup.getGroupId(), layoutSet.isPrivateLayout()); _buildParentGroupsBreadcrumb(parentLayoutSet, portletURL, themeDisplay, sb); } } else if (group.isUser()) { User groupUser = UserLocalServiceUtil.getUser(group.getClassPK()); List<Organization> organizations = OrganizationLocalServiceUtil.getUserOrganizations(groupUser.getUserId(), true); if (!organizations.isEmpty()) { Organization organization = organizations.get(0); Group parentGroup = organization.getGroup(); LayoutSet parentLayoutSet = LayoutSetLocalServiceUtil.getLayoutSet( parentGroup.getGroupId(), layoutSet.isPrivateLayout()); _buildParentGroupsBreadcrumb(parentLayoutSet, portletURL, themeDisplay, sb); } } int layoutsPageCount = 0; if (layoutSet.isPrivateLayout()) { layoutsPageCount = group.getPrivateLayoutsPageCount(); } else { layoutsPageCount = group.getPublicLayoutsPageCount(); } if ((layoutsPageCount > 0) && !group.getName().equals(GroupConstants.GUEST)) { String layoutSetFriendlyURL = PortalUtil.getLayoutSetFriendlyURL(layoutSet, themeDisplay); sb.append("<li><span><a href=\""); sb.append(layoutSetFriendlyURL); sb.append("\">"); sb.append(HtmlUtil.escape(group.getDescriptiveName())); sb.append("</a></span></li>"); } }
private void _buildGuestGroupBreadcrumb(ThemeDisplay themeDisplay, StringBundler sb) throws Exception { Group group = GroupLocalServiceUtil.getGroup(themeDisplay.getCompanyId(), GroupConstants.GUEST); if (group.getPublicLayoutsPageCount() > 0) { LayoutSet layoutSet = LayoutSetLocalServiceUtil.getLayoutSet(group.getGroupId(), false); String layoutSetFriendlyURL = PortalUtil.getLayoutSetFriendlyURL(layoutSet, themeDisplay); sb.append("<li><span><a href=\""); sb.append(layoutSetFriendlyURL); sb.append("\">"); sb.append(HtmlUtil.escape(themeDisplay.getAccount().getName())); sb.append("</a></span></li>"); } }