Exemplo n.º 1
0
  public Map<String, NodeBean> getGroupNodes() throws Exception {

    Map<String, NodeBean> navNodes = new HashMap<String, NodeBean>();

    PortalRequest portalRequest = PortalRequest.getInstance();

    SiteQuery.Builder siteQueryBulder = new SiteQuery.Builder();
    SiteQuery siteQuery =
        siteQueryBulder.withSiteTypes(SiteType.SPACE).includeEmptySites(false).build();
    List<Site> groupSites = PortalRequest.getInstance().getPortal().findSites(siteQuery);

    for (Site site : groupSites) {
      // check permissions and handle the special 'guest' site
      if (portalRequest
              .getPortal()
              .hasPermission(portalRequest.getUser(), site.getAccessPermission())
          && !site.getName().equals("/platform/guests")) {
        Navigation siteNavigation = portalRequest.getPortal().getNavigation(site.getId());
        Node node = siteNavigation.getRootNode(Nodes.visitNodes(this.nodeLevel));
        if (node.isVisible()) {
          String groupLabel =
              OrganizationUtils.getGroupLabel(siteNavigation.getSiteId().getName().toString());
          NodeBean nodeBean = new NodeBean(node, site.getId(), true);
          navNodes.put(groupLabel, nodeBean);
        }
      }
    }

    return navNodes;
  }
Exemplo n.º 2
0
  public String generateGroupPagesLink() {
    Navigation navigation = PortalRequest.getInstance().getNavigation();
    Node navigationNode = navigation.getNode(GROUP_NAVIGATION_NODE);

    if (navigationNode != null) {
      return navigationNode.getURI().toString();
    } else {
      return null;
    }
  }