public String checkCyclicRoleReference(Role role, String refID) {
   String result = null;
   List<String> hierarchy = new ArrayList<String>();
   hierarchy.add(role.getName());
   Role owner = getRole(refID);
   String refName = owner.getName(); // name of role attempting to add to
   while (owner != null) {
     hierarchy.add(owner.getName());
     if (owner.equals(role)) {
       result = constructCyclicAttributeErrorMessage(hierarchy, "role", refName);
       break;
     }
     owner = owner.getOwnerRole();
   }
   return result;
 }
 public Map<String, String> getRoleIdentifiers() {
   Map<String, String> idMap = new Hashtable<String, String>();
   for (Role r : getRoles()) {
     idMap.put(r.getID(), r.getName());
   }
   return idMap;
 }
 // @return a csv listing of the full name of each role
 public String getRoleNames() {
   StringBuilder csvList = new StringBuilder();
   for (Role r : roleMap.values()) {
     if (csvList.length() > 0) csvList.append(",");
     csvList.append(r.getName());
   }
   return csvList.toString();
 }
 public Role getRoleByName(String roleName) {
   for (Role r : roleMap.values()) {
     if (r.getName().equalsIgnoreCase(roleName)) return r;
   }
   return null; // no match
 }