use of com.google.gerrit.server.group.ListGroups in project gerrit by GerritCodeReview.
the class GroupsImpl method list.
private SortedMap<String, GroupInfo> list(ListRequest req) throws RestApiException {
TopLevelResource tlr = TopLevelResource.INSTANCE;
ListGroups list = listGroups.get();
list.setOptions(req.getOptions());
for (String project : req.getProjects()) {
try {
list.addProject(projects.parse(tlr, IdString.fromDecoded(project)).getControl());
} catch (Exception e) {
throw asRestApiException("Error looking up project " + project, e);
}
}
for (String group : req.getGroups()) {
list.addGroup(groups.parse(group).getGroupUUID());
}
list.setVisibleToAll(req.getVisibleToAll());
if (req.getUser() != null) {
try {
list.setUser(accounts.parse(req.getUser()).getAccountId());
} catch (Exception e) {
throw asRestApiException("Error looking up user " + req.getUser(), e);
}
}
list.setOwned(req.getOwned());
list.setLimit(req.getLimit());
list.setStart(req.getStart());
list.setMatchSubstring(req.getSubstring());
list.setSuggest(req.getSuggest());
try {
return list.apply(tlr);
} catch (Exception e) {
throw asRestApiException("Cannot list groups", e);
}
}
Aggregations