private static void toLongestPath()

in src/main/java/org/apache/sling/starter/access/models/AceUtils.java [42:54]


    private static void toLongestPath(String prefix, Privilege parentPrivilege, Map<Privilege, String> privilegeToLongestPath) {
        Privilege[] declaredAggregatePrivileges = parentPrivilege.getDeclaredAggregatePrivileges();
        for (Privilege privilege : declaredAggregatePrivileges) {
            String candidatePath = String.format("%s/%s", prefix, privilege.getName());
            String oldValue = privilegeToLongestPath.get(privilege);
            if (oldValue == null || oldValue.length() < candidatePath.length()) {
                privilegeToLongestPath.put(privilege, candidatePath);

                // continue drilling down to the leaf privileges
                toLongestPath(candidatePath, privilege, privilegeToLongestPath);
            }
        }
    }