@Override
  public Set<GroupResponse> getGroups(Set<GroupRequest> requests)
      throws AmbariException {
    final Set<GroupResponse> responses = new HashSet<>();
    for (GroupRequest request: requests) {
      LOG.debug("Received a getGroups request, groupRequest={}", request);
      // get them all
      if (null == request.getGroupName()) {
        for (Group group: users.getAllGroups()) {
          final GroupResponse response = new GroupResponse(group.getGroupName(), group.isLdapGroup(), group.getGroupType());
          responses.add(response);
        }
      } else {
        final Group group = users.getGroup(request.getGroupName());
        if (null == group) {
          if (requests.size() == 1) {
            // only throw exception if there is a single request
            // if there are multiple requests, this indicates an OR predicate
            throw new ObjectNotFoundException("Cannot find group '"
                + request.getGroupName() + "'");
          }
        } else {
          final GroupResponse response = new GroupResponse(group.getGroupName(), group.isLdapGroup(), group.getGroupType());
          responses.add(response);
        }
      }
    }
    return responses;
  }
Get a request response for the given request ids.  Note that this method
fully populates a request resource including the set of task sub-resources
in the request response.
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java