use of com.google.gerrit.extensions.common.GroupBaseInfo in project gerrit by GerritCodeReview.
the class ReviewersUtil method suggestAccountGroups.
private List<SuggestedReviewerInfo> suggestAccountGroups(SuggestReviewers suggestReviewers, ProjectControl projectControl, VisibilityControl visibilityControl, int limit) throws OrmException, IOException {
try (Timer0.Context ctx = metrics.queryGroupsLatency.start()) {
List<SuggestedReviewerInfo> groups = new ArrayList<>();
for (GroupReference g : suggestAccountGroups(suggestReviewers, projectControl)) {
GroupAsReviewer result = suggestGroupAsReviewer(suggestReviewers, projectControl.getProject(), g, visibilityControl);
if (result.allowed || result.allowedWithConfirmation) {
GroupBaseInfo info = new GroupBaseInfo();
info.id = Url.encode(g.getUUID().get());
info.name = g.getName();
SuggestedReviewerInfo suggestedReviewerInfo = new SuggestedReviewerInfo();
suggestedReviewerInfo.group = info;
suggestedReviewerInfo.count = result.size;
if (result.allowedWithConfirmation) {
suggestedReviewerInfo.confirm = true;
}
groups.add(suggestedReviewerInfo);
if (groups.size() >= limit) {
break;
}
}
}
return groups;
}
}
use of com.google.gerrit.extensions.common.GroupBaseInfo in project gerrit by GerritCodeReview.
the class ReviewersUtil method suggestAccountGroups.
private List<SuggestedReviewerInfo> suggestAccountGroups(SuggestReviewers suggestReviewers, ProjectState projectState, VisibilityControl visibilityControl, int limit) throws IOException {
try (Timer0.Context ctx = metrics.queryGroupsLatency.start()) {
List<SuggestedReviewerInfo> groups = new ArrayList<>();
for (GroupReference g : suggestAccountGroups(suggestReviewers, projectState)) {
GroupAsReviewer result = suggestGroupAsReviewer(suggestReviewers, projectState.getProject(), g, visibilityControl);
if (result.allowed || result.allowedWithConfirmation) {
GroupBaseInfo info = new GroupBaseInfo();
info.id = Url.encode(g.getUUID().get());
info.name = g.getName();
SuggestedReviewerInfo suggestedReviewerInfo = new SuggestedReviewerInfo();
suggestedReviewerInfo.group = info;
suggestedReviewerInfo.count = result.size;
if (result.allowedWithConfirmation) {
suggestedReviewerInfo.confirm = true;
}
groups.add(suggestedReviewerInfo);
if (groups.size() >= limit) {
break;
}
}
}
return groups;
}
}
Aggregations