Search in sources :

Example 1 with Input

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

the class PutTopic method applyImpl.

@Override
protected Response<String> applyImpl(BatchUpdate.Factory updateFactory, ChangeResource req, Input input) throws UpdateException, RestApiException, PermissionBackendException {
    req.permissions().check(ChangePermission.EDIT_TOPIC_NAME);
    Op op = new Op(input != null ? input : new Input());
    try (BatchUpdate u = updateFactory.create(dbProvider.get(), req.getChange().getProject(), req.getUser(), TimeUtil.nowTs())) {
        u.addOp(req.getId(), op);
        u.execute();
    }
    return Strings.isNullOrEmpty(op.newTopicName) ? Response.none() : Response.ok(op.newTopicName);
}
Also used : BatchUpdateOp(com.google.gerrit.server.update.BatchUpdateOp) Input(com.google.gerrit.server.change.PutTopic.Input) DefaultInput(com.google.gerrit.extensions.restapi.DefaultInput) BatchUpdate(com.google.gerrit.server.update.BatchUpdate)

Aggregations

DefaultInput (com.google.gerrit.extensions.restapi.DefaultInput)1 Input (com.google.gerrit.server.change.PutTopic.Input)1 BatchUpdate (com.google.gerrit.server.update.BatchUpdate)1 BatchUpdateOp (com.google.gerrit.server.update.BatchUpdateOp)1