예제 #1
0
 public static String roleName(Long roleId) {
   Role role = getRoleService().findOne(roleId);
   if (role == null) {
     return "";
   }
   return role.getDescription();
 }
예제 #2
0
  public static String roleNames(Collection<Long> roleIds) {
    if (CollectionUtils.isEmpty(roleIds)) {
      return "";
    }

    StringBuilder s = new StringBuilder();
    for (Long roleId : roleIds) {
      Role role = getRoleService().findOne(roleId);
      if (role == null) {
        return "";
      }
      s.append(role.getDescription());
      s.append(",");
    }

    if (s.length() > 0) {
      s.deleteCharAt(s.length() - 1);
    }

    return s.toString();
  }