public PageList<Resource> fetchDataForPage(PageControl pc) {
      Subject subject = EnterpriseFacesContextUtility.getSubject();
      ResourceManagerLocal manager = LookupUtil.getResourceManager();
      int repoId = Integer.parseInt(FacesContextUtility.getRequiredRequestParameter("id"));
      String search =
          FacesContextUtility.getOptionalRequestParameter(
              "repoUnsubscriptionsListForm:searchStringFilter");
      String category =
          FacesContextUtility.getOptionalRequestParameter(
              "repoUnsubscriptionsListForm:searchCategoryFilter");
      ResourceCategory categoryEnum = ResourceCategory.PLATFORM;

      if (search != null && search.trim().equals("")) {
        search = null;
      }

      if (category != null) {
        categoryEnum = ResourceCategory.valueOf(category);
      }

      PageList<Resource> results =
          manager.findAvailableResourcesForRepo(subject, repoId, search, categoryEnum, pc);

      // PageList<ResourceComposite> results = manager.findResourceComposites(subject, categoryEnum,
      // null, null, search, pc);

      return results;
    }
  private void loadTree() {
    int searchId;
    Resource currentResource = EnterpriseFacesContextUtility.getResourceIfExists();
    if (currentResource == null) {
      searchId = Integer.parseInt(FacesContextUtility.getOptionalRequestParameter("parent"));
    } else {
      searchId = currentResource.getId();
    }

    Subject user = EnterpriseFacesContextUtility.getSubject();

    long start = System.currentTimeMillis();
    long monitorId = HibernatePerformanceMonitor.get().start();
    Resource rootResource = resourceManager.getRootResourceForResource(searchId);
    long end = System.currentTimeMillis();
    HibernatePerformanceMonitor.get().stop(monitorId, "ResourceTree root resource");
    log.debug("Found root resource in " + (end - start));

    Agent agent =
        agentManager.getAgentByResourceId(
            LookupUtil.getSubjectManager().getOverlord(), rootResource.getId());

    start = System.currentTimeMillis();
    monitorId = HibernatePerformanceMonitor.get().start();
    List<ResourceFlyweight> resources =
        resourceManager.findResourcesByAgent(
            user, agent.getId(), PageControl.getUnlimitedInstance());
    end = System.currentTimeMillis();
    HibernatePerformanceMonitor.get().stop(monitorId, "ResourceTree agent resource");
    log.debug("Loaded " + resources.size() + " raw resources in " + (end - start));

    start = System.currentTimeMillis();
    monitorId = HibernatePerformanceMonitor.get().start();
    rootNode = load(rootResource.getId(), resources);
    end = System.currentTimeMillis();
    HibernatePerformanceMonitor.get().stop(monitorId, "ResourceTree tree construction");
    log.debug("Constructed tree in " + (end - start));
  }