Package com.google.gerrit.server.change
Class PatchSetInserter
java.lang.Object
com.google.gerrit.server.change.PatchSetInserter
- All Implemented Interfaces:
BatchUpdateOp
,RepoOnlyOp
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionPatchSetInserter
(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, TopicValidator topicValidator, DiffOperationsForCommitValidation.Factory diffOperationsForCommitValidationFactory, PluginSetContext<ValidationOptionsListener> validationOptionsListeners, PluginSetContext<CommitValidationInfoListener> commitValidationInfoListeners, ChangeNotes notes, PatchSet.Id psId, org.eclipse.jgit.lib.ObjectId commitId) -
Method Summary
Modifier and TypeMethodDescriptionDisables the commit validation because validation is not needed.disableValidation
(com.google.common.collect.ImmutableMap<String, CommitValidationInfo> validationInfos) Disables the commit validation because the validation has already been done.void
Override this method to do something after the update e.g.setAllowClosed
(boolean allowClosed) setCheckAddPatchSetPermission
(boolean checkAddPatchSetPermission) setConflicts
(PatchSet.Conflicts conflicts) setDescription
(String description) setFireRevisionCreated
(boolean fireRevisionCreated) setMessage
(String message) setSendEmail
(boolean sendEmail) 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").setValidationOptions
(com.google.common.collect.ImmutableListMultimap<String, String> validationOptions) setWorkInProgress
(boolean workInProgress) boolean
Override this method to modify a change.void
updateRepo
(RepoContext ctx) Override this method to update the repo.
-
Constructor Details
-
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, TopicValidator topicValidator, DiffOperationsForCommitValidation.Factory diffOperationsForCommitValidationFactory, PluginSetContext<ValidationOptionsListener> validationOptionsListeners, PluginSetContext<CommitValidationInfoListener> commitValidationInfoListeners, ChangeNotes notes, PatchSet.Id psId, org.eclipse.jgit.lib.ObjectId commitId)
-
-
Method Details
-
getPatchSetId
-
setMessage
-
setDescription
-
setWorkInProgress
-
disableValidation
Disables the commit validation because validation is not needed.- Returns:
- the
PatchSetInserter
instance to allow chaining calls
-
disableValidation
@CanIgnoreReturnValue public PatchSetInserter disableValidation(com.google.common.collect.ImmutableMap<String, CommitValidationInfo> validationInfos) Disables the commit validation because the validation has already been done.The result from the validation that has already been done needs to be provided to this method and is being used to invoke the
CommitValidationInfoListener
's.- Parameters:
validationInfos
- result of validatingcommitId
- Returns:
- the
PatchSetInserter
instance to allow chaining calls
-
setCheckAddPatchSetPermission
@CanIgnoreReturnValue public PatchSetInserter setCheckAddPatchSetPermission(boolean checkAddPatchSetPermission) -
setGroups
-
setValidationOptions
@CanIgnoreReturnValue public PatchSetInserter setValidationOptions(com.google.common.collect.ImmutableListMultimap<String, String> validationOptions) -
setFireRevisionCreated
-
setAllowClosed
-
setSendEmail
-
setTopic
-
setConflicts
-
setStoreCopiedVotes
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
-
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
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
-