- protected long max(String attr) {
- long max;
- try {
- List<DirectoryUser> users = doGetRoles(FrameworkUtil
- .createFilter("(" + attr + "=*)"));
- max = 1000;
- for (DirectoryUser user : users) {
- long uid = Long.parseLong(user.getAttributes().get(attr).get()
- .toString());
- if (uid > max)
- max = uid;
- }
- } catch (Exception e) {
- throw new UserDirectoryException("Cannot get max of " + attr, e);
- }
- return max;
- }
-
- /**
- * Creates depth from a string (typically a username) by adding levels based
- * on its first characters: "aBcD",2 => a/aB
- */
- public static String firstCharsToPath(String str, Integer nbrOfChars) {
- if (str.length() < nbrOfChars)
- throw new ArgeoException("String " + str
- + " length must be greater or equal than " + nbrOfChars);
- StringBuffer path = new StringBuffer("");
- StringBuffer curr = new StringBuffer("");
- for (int i = 0; i < nbrOfChars; i++) {
- curr.append(str.charAt(i));
- path.append(curr);
- if (i < nbrOfChars - 1)
- path.append('/');
- }
- return path.toString();
- }
+ // /**
+ // * Creates depth from a string (typically a username) by adding levels
+ // based
+ // * on its first characters: "aBcD",2 => a/aB
+ // */
+ // public static String firstCharsToPath(String str, Integer nbrOfChars) {
+ // if (str.length() < nbrOfChars)
+ // throw new ArgeoException("String " + str + " length must be greater or
+ // equal than " + nbrOfChars);
+ // StringBuffer path = new StringBuffer("");
+ // StringBuffer curr = new StringBuffer("");
+ // for (int i = 0; i < nbrOfChars; i++) {
+ // curr.append(str.charAt(i));
+ // path.append(curr);
+ // if (i < nbrOfChars - 1)
+ // path.append('/');
+ // }
+ // return path.toString();
+ // }