String role = (String) it.next();
// recover groups
Enumeration groups = r.getGroupsAssignedTo(new Role(role));
Set<Group> groupsToRole = new HashSet<Group>();
for(;groups.hasMoreElements(); ){
Group gp = (Group) groups.nextElement();
groupsToRole.add(new Group(gp.getName()));
addRoleToPrincipal(gp,role);
}
this.roleToGroup.put(role,groupsToRole);
// recover principles
Enumeration users = r.getUsersAssignedTo(new Role(role));
Set<Principal> usersToRole = new HashSet<Principal>();
for(;users.hasMoreElements(); ){
PrincipalImpl gp = (PrincipalImpl) users.nextElement();
usersToRole.add(new PrincipalImpl(gp.getName()));
addRoleToPrincipal(gp,role);
}
this.roleToPrincipal.put(role,usersToRole);
}
}