Package com.google.gerrit.server.change
Class PatchSetInserter
- java.lang.Object
-
- com.google.gerrit.server.change.PatchSetInserter
-
- All Implemented Interfaces:
BatchUpdateOp
,RepoOnlyOp
public class PatchSetInserter extends Object implements BatchUpdateOp
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PatchSetInserter.Factory
-
Constructor Summary
Constructors Constructor Description PatchSetInserter(PermissionBackend permissionBackend, ApprovalsUtil approvalsUtil, ChangeMessagesUtil cmUtil, PatchSetInfoFactory patchSetInfoFactory, ChangeKindCache changeKindCache, CommitValidators.Factory commitValidatorsFactory, EmailNewPatchSet.Factory emailNewPatchSetFactory, PatchSetUtil psUtil, RevisionCreated revisionCreated, ProjectCache projectCache, WorkInProgressStateChanged wipStateChanged, AutoMerger autoMerger, ChangeNotes notes, PatchSet.Id psId, org.eclipse.jgit.lib.ObjectId commitId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Change
getChange()
PatchSet
getPatchSet()
PatchSet.Id
getPatchSetId()
void
postUpdate(PostUpdateContext ctx)
Override this method to do something after the update e.g.PatchSetInserter
setAllowClosed(boolean allowClosed)
PatchSetInserter
setCheckAddPatchSetPermission(boolean checkAddPatchSetPermission)
PatchSetInserter
setDescription(String description)
PatchSetInserter
setFireRevisionCreated(boolean fireRevisionCreated)
PatchSetInserter
setGroups(List<String> groups)
PatchSetInserter
setMessage(String message)
PatchSetInserter
setSendEmail(boolean sendEmail)
PatchSetInserter
setStoreCopiedVotes(boolean storeCopiedVotes)
We always want to store copied votes except when the change is getting submitted and a new patch-set is created on submit (using submit strategies such as "REBASE_ALWAYS").PatchSetInserter
setTopic(String topic)
PatchSetInserter
setValidate(boolean validate)
PatchSetInserter
setValidationOptions(com.google.common.collect.ImmutableListMultimap<String,String> validationOptions)
PatchSetInserter
setWorkInProgress(boolean workInProgress)
boolean
updateChange(ChangeContext ctx)
Override this method to modify a change.void
updateRepo(RepoContext ctx)
Override this method to update the repo.
-
-
-
Constructor Detail
-
PatchSetInserter
@Inject public PatchSetInserter(PermissionBackend permissionBackend, ApprovalsUtil approvalsUtil, ChangeMessagesUtil cmUtil, PatchSetInfoFactory patchSetInfoFactory, ChangeKindCache changeKindCache, CommitValidators.Factory commitValidatorsFactory, EmailNewPatchSet.Factory emailNewPatchSetFactory, PatchSetUtil psUtil, RevisionCreated revisionCreated, ProjectCache projectCache, WorkInProgressStateChanged wipStateChanged, AutoMerger autoMerger, ChangeNotes notes, PatchSet.Id psId, org.eclipse.jgit.lib.ObjectId commitId)
-
-
Method Detail
-
getPatchSetId
public PatchSet.Id getPatchSetId()
-
setMessage
public PatchSetInserter setMessage(String message)
-
setDescription
public PatchSetInserter setDescription(String description)
-
setWorkInProgress
public PatchSetInserter setWorkInProgress(boolean workInProgress)
-
setValidate
public PatchSetInserter setValidate(boolean validate)
-
setCheckAddPatchSetPermission
public PatchSetInserter setCheckAddPatchSetPermission(boolean checkAddPatchSetPermission)
-
setGroups
public PatchSetInserter setGroups(List<String> groups)
-
setValidationOptions
public PatchSetInserter setValidationOptions(com.google.common.collect.ImmutableListMultimap<String,String> validationOptions)
-
setFireRevisionCreated
public PatchSetInserter setFireRevisionCreated(boolean fireRevisionCreated)
-
setAllowClosed
public PatchSetInserter setAllowClosed(boolean allowClosed)
-
setSendEmail
public PatchSetInserter setSendEmail(boolean sendEmail)
-
setTopic
public PatchSetInserter setTopic(String topic)
-
setStoreCopiedVotes
public PatchSetInserter setStoreCopiedVotes(boolean storeCopiedVotes)
We always want to store copied votes except when the change is getting submitted and a new patch-set is created on submit (using submit strategies such as "REBASE_ALWAYS"). In such cases, we already store the votes of the new patch-sets in SubmitStrategyOp#saveApprovals. We should not also store the copied votes.
-
getChange
public Change getChange()
-
getPatchSet
public PatchSet getPatchSet()
-
updateRepo
public void updateRepo(RepoContext ctx) throws AuthException, ResourceConflictException, IOException, PermissionBackendException
Description copied from interface:RepoOnlyOp
Override this method to update the repo.- Specified by:
updateRepo
in interfaceRepoOnlyOp
- Parameters:
ctx
- context- Throws:
AuthException
ResourceConflictException
IOException
PermissionBackendException
-
updateChange
public boolean updateChange(ChangeContext ctx) throws ResourceConflictException, IOException, BadRequestException
Description copied from interface:BatchUpdateOp
Override this method to modify a change.- Specified by:
updateChange
in interfaceBatchUpdateOp
- Parameters:
ctx
- context- Returns:
- whether anything was changed that might require a write to the metadata storage.
- Throws:
ResourceConflictException
IOException
BadRequestException
-
postUpdate
public void postUpdate(PostUpdateContext ctx)
Description copied from interface:RepoOnlyOp
Override this method to do something after the update e.g. send email or run hooks- Specified by:
postUpdate
in interfaceRepoOnlyOp
- Parameters:
ctx
- context
-
-