Search in sources :

Example 1 with AbandonOp

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

the class Abandon method abandon.

public Change abandon(BatchUpdate.Factory updateFactory, ChangeNotes notes, CurrentUser user, String msgTxt, NotifyResolver.Result notify) throws RestApiException, UpdateException {
    AccountState accountState = user.isIdentifiedUser() ? user.asIdentifiedUser().state() : null;
    AbandonOp op = abandonOpFactory.create(accountState, msgTxt);
    ChangeData changeData = changeDataFactory.create(notes.getProjectName(), notes.getChangeId());
    try (BatchUpdate u = updateFactory.create(notes.getProjectName(), user, TimeUtil.now())) {
        u.setNotify(notify);
        u.addOp(notes.getChangeId(), op);
        u.addOp(notes.getChangeId(), storeSubmitRequirementsOpFactory.create(changeData.submitRequirements().values(), changeData));
        u.execute();
    }
    return op.getChange();
}
Also used : AccountState(com.google.gerrit.server.account.AccountState) AbandonOp(com.google.gerrit.server.change.AbandonOp) ChangeData(com.google.gerrit.server.query.change.ChangeData) BatchUpdate(com.google.gerrit.server.update.BatchUpdate)

Aggregations

AccountState (com.google.gerrit.server.account.AccountState)1 AbandonOp (com.google.gerrit.server.change.AbandonOp)1 ChangeData (com.google.gerrit.server.query.change.ChangeData)1 BatchUpdate (com.google.gerrit.server.update.BatchUpdate)1