Add direct members and directly included groups to GroupInfo

When listing groups it is now possible to request that the direct group
members and the directly included groups are included into the returned
GroupInfos. This is done by setting the options 'o=MEMBERS' and
'o=INCLUDES'.

In addition there is a new REST endpoint '/groups/<group-id>/detail' by
which a group with its direct members and directly included groups can
be retrieved.

This new endpoint is used to retrieve the group for populating the
AccountGroupMembersScreen. By this 2 requests are saved which would
otherwise be needed to fetch the direct group members and the directly
included groups.

Change-Id: Ib94e5c01cc0880aa508f703f4156ac7fe627d742
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2013-02-11 15:30:19 +01:00
parent 963dfd07d0
commit abaab54633
18 changed files with 331 additions and 55 deletions

View File

@@ -16,7 +16,7 @@ package com.google.gerrit.sshd.commands;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.gerrit.common.errors.NoSuchGroupException;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
import com.google.gerrit.extensions.restapi.Url;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.server.IdentifiedUser;
@@ -29,6 +29,7 @@ import com.google.gerrit.server.group.ListGroups;
import com.google.gerrit.server.ioutil.ColumnFormatter;
import com.google.gerrit.sshd.BaseCommand;
import com.google.gerrit.sshd.CommandMetaData;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -80,7 +81,7 @@ public class ListGroupsCommand extends BaseCommand {
identifiedUser, userFactory, accountGetGroups, json);
}
void display(final PrintWriter out) throws NoSuchGroupException {
void display(final PrintWriter out) throws ResourceNotFoundException, OrmException {
final ColumnFormatter formatter = new ColumnFormatter(out, '\t');
for (final GroupInfo info : get()) {
formatter.addColumn(Objects.firstNonNull(info.name, "n/a"));