Package com.google.gerrit.server.change
Class ChangeInserter
java.lang.Object
com.google.gerrit.server.change.ChangeInserter
- All Implemented Interfaces:
BatchUpdateOp
,InsertChangeOp
,RepoOnlyOp
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncreateChange
(Context ctx) Disables 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.org.eclipse.jgit.transport.ReceiveCommand
org.eclipse.jgit.lib.ObjectId
void
Override this method to do something after the update e.g.setApprovals
(Map<String, Short> approvals) setCherryPickOf
(PatchSet.Id cherryPickOf) setConflicts
(PatchSet.Conflicts conflicts) setCustomKeyedValues
(com.google.common.collect.ImmutableMap<String, String> customKeyedValues) setFireRevisionCreated
(boolean fireRevisionCreated) setMessage
(String message) setPatchSetDescription
(String patchSetDescription) setPrivate
(boolean isPrivate) void
setPushCertificate
(String cert) setRevertOf
(Change.Id revertOf) setReviewersAndCcs
(Iterable<Account.Id> reviewers, Iterable<Account.Id> ccs) setReviewersAndCcsAsStrings
(Iterable<String> reviewers, Iterable<String> ccs) setReviewersAndCcsIgnoreVisibility
(Iterable<Account.Id> reviewers, Iterable<Account.Id> ccs) setSendMail
(boolean sendMail) setStatus
(Change.Status status) setUpdateRef
(boolean updateRef) Deprecated.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.
-
Method Details
-
createChange
- Specified by:
createChange
in interfaceInsertChangeOp
- Throws:
IOException
-
getPatchSetId
-
getCommitId
public org.eclipse.jgit.lib.ObjectId getCommitId() -
getChange
-
setTopic
-
setConflicts
-
setCherryPickOf
-
setMessage
-
setPatchSetDescription
-
disableValidation
Disables the commit validation because validation is not needed.- Returns:
- the
ChangeInserter
instance to allow chaining calls
-
disableValidation
@CanIgnoreReturnValue public ChangeInserter 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
ChangeInserter
instance to allow chaining calls
-
setReviewersAndCcs
@CanIgnoreReturnValue public ChangeInserter setReviewersAndCcs(Iterable<Account.Id> reviewers, Iterable<Account.Id> ccs) -
setReviewersAndCcsIgnoreVisibility
@CanIgnoreReturnValue public ChangeInserter setReviewersAndCcsIgnoreVisibility(Iterable<Account.Id> reviewers, Iterable<Account.Id> ccs) -
setReviewersAndCcsAsStrings
@CanIgnoreReturnValue public ChangeInserter setReviewersAndCcsAsStrings(Iterable<String> reviewers, Iterable<String> ccs) -
setPrivate
-
setWorkInProgress
-
setStatus
-
setGroups
-
setCustomKeyedValues
@CanIgnoreReturnValue public ChangeInserter setCustomKeyedValues(com.google.common.collect.ImmutableMap<String, String> customKeyedValues) -
setValidationOptions
@CanIgnoreReturnValue public ChangeInserter setValidationOptions(com.google.common.collect.ImmutableListMultimap<String, String> validationOptions) -
setFireRevisionCreated
-
setSendMail
-
setRequestScopePropagator
-
setRevertOf
-
setPushCertificate
-
getPatchSet
-
setApprovals
-
setUpdateRef
Deprecated.Set whether to include the new patch set ref update in this update.If false, the caller is responsible for creating the patch set ref before executing the containing
BatchUpdate
.Should not be used in new code, as it doesn't result in a single atomic batch ref update for code and NoteDb meta refs.
- Parameters:
updateRef
- whether to update the ref duringupdateRepo(RepoContext)
.
-
getChangeMessage
-
getCommand
public org.eclipse.jgit.transport.ReceiveCommand getCommand() -
updateRepo
Description copied from interface:RepoOnlyOp
Override this method to update the repo.- Specified by:
updateRepo
in interfaceRepoOnlyOp
- Parameters:
ctx
- context- Throws:
ResourceConflictException
IOException
-
updateChange
public boolean updateChange(ChangeContext ctx) throws RestApiException, IOException, PermissionBackendException, org.eclipse.jgit.errors.ConfigInvalidException 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:
RestApiException
IOException
PermissionBackendException
org.eclipse.jgit.errors.ConfigInvalidException
-
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- Throws:
Exception
-