use of com.google.gerrit.server.account.PutStatus.Input in project gerrit by GerritCodeReview.
the class PutStatus method apply.
public Response<String> apply(IdentifiedUser user, Input input) throws ResourceNotFoundException, OrmException, IOException {
if (input == null) {
input = new Input();
}
String newStatus = input.status;
Account a = dbProvider.get().accounts().atomicUpdate(user.getAccountId(), new AtomicUpdate<Account>() {
@Override
public Account update(Account a) {
a.setStatus(Strings.nullToEmpty(newStatus));
return a;
}
});
if (a == null) {
throw new ResourceNotFoundException("account not found");
}
byIdCache.evict(a.getId());
return Strings.isNullOrEmpty(a.getStatus()) ? Response.none() : Response.ok(a.getStatus());
}
Aggregations