Beispiel #1
0
  private List<Application> filterApps(ApplicationCategory applicationCategory) {
    List<Application> applications = new ArrayList<Application>();

    if (applicationCategory.getApplications() == null) {
      return applications;
    }
    for (Application app : applicationCategory.getApplications()) {
      if (hasPermission(app.getAccessPermissions())) {
        applications.add(app);
      }
    }
    applicationCategory.setApplications(applications);
    return applications;
  }
Beispiel #2
0
  private Application getApplication(String id) throws Exception {

    List<ApplicationCategory> pCategories = getApplicationCategories();

    for (ApplicationCategory pCategory : pCategories) {
      List<Application> applications = pCategory.getApplications();
      for (Application application : applications) {
        if (application.getId().equals(id)) {
          return application;
        }
      }
    }

    return null;
  }
Beispiel #3
0
  private void initApplicationCategories() throws Exception {
    ApplicationRegistryService prService =
        getApplicationComponent(ApplicationRegistryService.class);
    String remoteUser = WebuiRequestContext.getCurrentInstance().getRemoteUser();
    if (remoteUser == null || remoteUser.equals("")) return;

    List<ApplicationCategory> appCategories =
        prService.getApplicationCategories(new ApplicationCategoryComparator());

    Iterator<ApplicationCategory> cateItr = appCategories.iterator();
    while (cateItr.hasNext()) {
      ApplicationCategory cate = cateItr.next();

      if (!hasPermission(cate.getAccessPermissions()) || filterApps(cate).size() < 1) {
        cateItr.remove();
      } else {
        Collections.sort(cate.getApplications(), new ApplicationComparator());
      }
    }

    listAppCategories = appCategories;
  }