use of com.google.gerrit.server.project.RefFilter in project gerrit by GerritCodeReview.
the class ListTags method apply.
@Override
public Response<ImmutableList<TagInfo>> apply(ProjectResource resource) throws IOException, ResourceNotFoundException, RestApiException, PermissionBackendException {
resource.getProjectState().checkStatePermitsRead();
List<TagInfo> tags = new ArrayList<>();
PermissionBackend.ForProject perm = permissionBackend.currentUser().project(resource.getNameKey());
try (Repository repo = getRepository(resource.getNameKey());
RevWalk rw = new RevWalk(repo)) {
Collection<Ref> all = visibleTags(resource.getNameKey(), repo, repo.getRefDatabase().getRefsByPrefix(Constants.R_TAGS));
for (Ref ref : all) {
tags.add(createTagInfo(perm.ref(ref.getName()), ref, rw, resource.getProjectState(), links));
}
}
tags.sort(comparing(t -> t.ref));
return Response.ok(new RefFilter<TagInfo>(Constants.R_TAGS).start(start).limit(limit).subString(matchSubstring).regex(matchRegex).filter(tags));
}
Aggregations