Search in sources :

Example 1 with SetHashtagsOp

use of com.google.gerrit.server.change.SetHashtagsOp in project gerrit by GerritCodeReview.

the class PostHashtags method apply.

@Override
public Response<ImmutableSortedSet<String>> apply(ChangeResource req, HashtagsInput input) throws RestApiException, UpdateException, PermissionBackendException {
    req.permissions().check(ChangePermission.EDIT_HASHTAGS);
    try (BatchUpdate bu = updateFactory.create(req.getChange().getProject(), req.getUser(), TimeUtil.now())) {
        SetHashtagsOp op = hashtagsFactory.create(input);
        bu.addOp(req.getId(), op);
        bu.execute();
        return Response.ok(op.getUpdatedHashtags());
    }
}
Also used : SetHashtagsOp(com.google.gerrit.server.change.SetHashtagsOp) BatchUpdate(com.google.gerrit.server.update.BatchUpdate)

Aggregations

SetHashtagsOp (com.google.gerrit.server.change.SetHashtagsOp)1 BatchUpdate (com.google.gerrit.server.update.BatchUpdate)1