Start factoring out PatchSet accesses into a PatchSetUtil class

Replaces the simplest get calls in most callers that didn't require
substantial refactoring. Doesn't actually read notedb yet because
there is no notedb support for patch sets yet.

Change-Id: I7ef198dd1257b833a3a4b21180f5012f6fdc56d4
This commit is contained in:
Dave Borowitz
2016-01-14 15:00:59 -05:00
parent 5d926ca2ba
commit 3ecfd76674
43 changed files with 365 additions and 183 deletions

View File

@@ -59,6 +59,7 @@ import com.google.gerrit.server.ChangeMessagesUtil;
import com.google.gerrit.server.ChangeUtil;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.PatchLineCommentsUtil;
import com.google.gerrit.server.PatchSetUtil;
import com.google.gerrit.server.account.AccountsCollection;
import com.google.gerrit.server.git.BatchUpdate;
import com.google.gerrit.server.git.BatchUpdate.ChangeContext;
@@ -102,6 +103,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
private final ApprovalsUtil approvalsUtil;
private final ChangeMessagesUtil cmUtil;
private final PatchLineCommentsUtil plcUtil;
private final PatchSetUtil psUtil;
private final PatchListCache patchListCache;
private final AccountsCollection accounts;
private final EmailReviewComments.Factory email;
@@ -115,6 +117,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
ApprovalsUtil approvalsUtil,
ChangeMessagesUtil cmUtil,
PatchLineCommentsUtil plcUtil,
PatchSetUtil psUtil,
PatchListCache patchListCache,
AccountsCollection accounts,
EmailReviewComments.Factory email,
@@ -124,6 +127,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
this.changes = changes;
this.changeDataFactory = changeDataFactory;
this.plcUtil = plcUtil;
this.psUtil = psUtil;
this.patchListCache = patchListCache;
this.approvalsUtil = approvalsUtil;
this.cmUtil = cmUtil;
@@ -354,7 +358,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
throws OrmException, ResourceConflictException {
user = ctx.getUser().asIdentifiedUser();
change = ctx.getChange();
ps = ctx.getDb().patchSets().get(psId);
ps = psUtil.get(ctx.getDb(), ctx.getNotes(), psId);
boolean dirty = false;
dirty |= insertComments(ctx);
dirty |= updateLabels(ctx);