Map<String, String> parentMappings =
getRoleService(roleServiceName).getParentMappings();
if (role != null && StringUtils.hasLength(role.getAuthority())) {
//filter out roles already used as parents
RoleHierarchyHelper helper = new RoleHierarchyHelper(parentMappings);
Set<String> parents = new HashSet<String>(parentMappings.keySet());
parents.removeAll(helper.getDescendants(role.getAuthority()));
parents.remove(role.getAuthority());
return new ArrayList(parents);
} else {
// no rolename given, we are creating a new one