@Test @Ignore("This test should be run manually.") public void testListPrivilegeObjectsPerf() { Set<String> privileges = generatePrivilegeStrings(1000, 10); SimpleFilteredPrivilegeCache cache = new SimpleFilteredPrivilegeCache(privileges, null); List<Authorizable[]> authorizables = generateAuthoriables(12000, 10); long start = System.currentTimeMillis(); for (Authorizable[] authorizableHierarchy : authorizables) { Set<Privilege> privilegeSet = cache.listPrivilegeObjects(null, null, null, authorizableHierarchy); for (Privilege currPri : privilegeSet) { currPri.getParts(); } } long end = System.currentTimeMillis(); System.out.println("SimpleFilteredPrivilegeCache - total time on list obj: " + (end - start) + " ms"); }
@Override public Set<Privilege> listPrivilegeObjects(Set<String> groups, Set<String> users, ActiveRoleSet roleSet, Authorizable... authorizationHierarchy) { Set<String> privilegeStrings = listPrivileges(groups, users, roleSet, authorizationHierarchy); return privilegeStrings.stream() .filter(priString -> priString != null) .map(priString -> getPrivilegeObject(priString)) .collect(Collectors.toSet()); }
SimpleFilteredPrivilegeCache implements FilteredPrivilegeCache { @Override public Set<Privilege> listPrivilegeObjects(Set<String> groups, Set<String> users, ActiveRoleSet roleSet, Authorizable... authorizationHierarchy) { Set<String> privilegeStrings = listPrivileges(groups, users, roleSet, authorizationHierarchy); return privilegeStrings.stream() .filter(priString -> priString != null) .map(priString -> getPrivilegeObject(priString)) .collect(Collectors.toSet()); } }
SimpleFilteredPrivilegeCache implements FilteredPrivilegeCache { @Override public Set<Privilege> listPrivilegeObjects(Set<String> groups, Set<String> users, ActiveRoleSet roleSet, Authorizable... authorizationHierarchy) { Set<String> privilegeStrings = listPrivileges(groups, users, roleSet, authorizationHierarchy); return privilegeStrings.stream() .filter(priString -> priString != null) .map(priString -> getPrivilegeObject(priString)) .collect(Collectors.toSet()); } SimpleFilteredPrivilegeCache(Set<String> cachedPrivileges, PrivilegeFactory inPrivilegeFactory); }
SimpleFilteredPrivilegeCache implements FilteredPrivilegeCache { @Override public Set<Privilege> listPrivilegeObjects(Set<String> groups, Set<String> users, ActiveRoleSet roleSet, Authorizable... authorizationHierarchy) { Set<String> privilegeStrings = listPrivileges(groups, users, roleSet, authorizationHierarchy); return privilegeStrings.stream() .filter(priString -> priString != null) .map(priString -> getPrivilegeObject(priString)) .collect(Collectors.toSet()); } SimpleFilteredPrivilegeCache(Set<String> cachedPrivileges, PrivilegeFactory inPrivilegeFactory); @Override Set<String> listPrivileges(Set<String> groups, ActiveRoleSet roleSet); @Override void close(); @Override Set<String> listPrivileges(Set<String> groups, Set<String> users, ActiveRoleSet roleSet); @Override Set<String> listPrivileges(Set<String> groups, Set<String> users, ActiveRoleSet roleSet,
    Authorizable... authorizationHierarchy); @Override Set<Privilege> listPrivilegeObjects(Set<String> groups, Set<String> users, ActiveRoleSet roleSet,
    Authorizable... authorizationHierarchy); }
SimpleFilteredPrivilegeCache implements FilteredPrivilegeCache { @Override public Set<Privilege> listPrivilegeObjects(Set<String> groups, Set<String> users, ActiveRoleSet roleSet, Authorizable... authorizationHierarchy) { Set<String> privilegeStrings = listPrivileges(groups, users, roleSet, authorizationHierarchy); return privilegeStrings.stream() .filter(priString -> priString != null) .map(priString -> getPrivilegeObject(priString)) .collect(Collectors.toSet()); } SimpleFilteredPrivilegeCache(Set<String> cachedPrivileges, PrivilegeFactory inPrivilegeFactory); @Override Set<String> listPrivileges(Set<String> groups, ActiveRoleSet roleSet); @Override void close(); @Override Set<String> listPrivileges(Set<String> groups, Set<String> users, ActiveRoleSet roleSet); @Override Set<String> listPrivileges(Set<String> groups, Set<String> users, ActiveRoleSet roleSet,
    Authorizable... authorizationHierarchy); @Override Set<Privilege> listPrivilegeObjects(Set<String> groups, Set<String> users, ActiveRoleSet roleSet,
    Authorizable... authorizationHierarchy);  }