protected List<User> getUsersHavingHandlerRole() {
    String roleKey = getHandlerRoleKey();
    if (StringUtil.isEmpty(roleKey)) {
      return null;
    }

    IWApplicationContext iwac = IWMainApplication.getDefaultIWApplicationContext();
    AccessController accessControler =
        IWMainApplication.getDefaultIWMainApplication().getAccessController();
    Collection<Group> groupsWithRole = accessControler.getAllGroupsForRoleKey(roleKey, iwac);
    if (ListUtil.isEmpty(groupsWithRole)) {
      return null;
    }

    UserBusiness userBusiness = getUserBusiness();
    if (userBusiness == null) {
      return null;
    }

    List<User> users = new ArrayList<User>();
    for (Group group : groupsWithRole) {
      if (group instanceof User) {
        User user = (User) group;
        if (!users.contains(user)) {
          users.add(user);
        }
      } else {
        Collection<User> usersInGroup = null;
        try {
          usersInGroup = userBusiness.getUsersInGroup(group);
        } catch (Exception e) {
          LOGGER.log(Level.WARNING, "Error getting users in group: " + group, e);
        }
        if (!ListUtil.isEmpty(usersInGroup)) {
          for (User user : usersInGroup) {
            if (!users.contains(user)) {
              users.add(user);
            }
          }
        }
      }
    }

    return users;
  }
  protected String getUserMail(Integer userId) {
    if (userId == null) {
      return null;
    }

    UserBusiness userBusiness = getUserBusiness();
    if (userBusiness == null) {
      return null;
    }

    User user = null;
    try {
      user = userBusiness.getUser(userId);
    } catch (Exception e) {
      LOGGER.log(Level.WARNING, "Error getting user by id: " + userId, e);
    }
    if (user == null) {
      return null;
    }

    Email email = getEmail(user);
    return email == null ? null : email.getEmailAddress();
  }