Package com.google.gerrit.server
Interface ChangeDraftUpdateExecutor
- All Known Implementing Classes:
- ChangeDraftNotesUpdate.Executor
public interface ChangeDraftUpdateExecutor
An interface for executing updates of multiple 
ChangeDraftUpdate instances.
 Expected usage flow:
- Inject an instance of ChangeDraftUpdateExecutor.AbstractFactory.
- Create an instance of this interface using the factory.
- Call (queueAllDraftUpdates(com.google.common.collect.ListMultimap<java.lang.String, com.google.gerrit.server.ChangeDraftUpdate>)orqueueDeletionForChangeDrafts(com.google.gerrit.entities.Change.Id)for all expected updates. The changes are marked to be executed either synchronously or asynchronously, based oncanRunAsync(java.util.Collection<? extends com.google.gerrit.server.ChangeDraftUpdate>).
- Call both executeAllSyncUpdates(boolean, org.eclipse.jgit.lib.PersonIdent, java.lang.String)andexecuteAllAsyncUpdates(org.eclipse.jgit.lib.PersonIdent, java.lang.String, org.eclipse.jgit.transport.PushCertificate)methods. Running these methods with no pending updates is a no-op.
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interface
- 
Method SummaryModifier and TypeMethodDescriptiondefault booleancanRunAsync(Collection<? extends ChangeDraftUpdate> updates) Returns whether all provided updates can run asynchronously.voidexecuteAllAsyncUpdates(org.eclipse.jgit.lib.PersonIdent refLogIdent, String refLogMessage, org.eclipse.jgit.transport.PushCertificate pushCert) Execute all previously queued async updates.Optional<org.eclipse.jgit.lib.BatchRefUpdate>executeAllSyncUpdates(boolean dryRun, org.eclipse.jgit.lib.PersonIdent refLogIdent, String refLogMessage) Execute all previously queued sync updates.default <UpdateT extends ChangeDraftUpdate>
 com.google.common.collect.ListMultimap<String,UpdateT> filterTypedUpdates(com.google.common.collect.ListMultimap<String, ChangeDraftUpdate> updates, Class<UpdateT> updateType) Returns the given updates that match the provided type.booleanisEmpty()Returns whether any updates are queued.voidqueueAllDraftUpdates(com.google.common.collect.ListMultimap<String, ChangeDraftUpdate> updates) Queues all provided updates for later execution.voidExtracts all drafts (of all authors) for the given change and queue their deletion.
- 
Method Details- 
queueAllDraftUpdatesvoid queueAllDraftUpdates(com.google.common.collect.ListMultimap<String, ChangeDraftUpdate> updates) throws IOExceptionQueues all provided updates for later execution.The updates are queued to either run synchronously just after change repositories updates, or to run asynchronously afterwards, based on canRunAsync(java.util.Collection<? extends com.google.gerrit.server.ChangeDraftUpdate>).- Throws:
- IOException
 
- 
queueDeletionForChangeDraftsExtracts all drafts (of all authors) for the given change and queue their deletion.See canRunAsync(java.util.Collection<? extends com.google.gerrit.server.ChangeDraftUpdate>)for whether the deletions are scheduled as synchronous or asynchronous.- Throws:
- IOException
 
- 
executeAllSyncUpdatesOptional<org.eclipse.jgit.lib.BatchRefUpdate> executeAllSyncUpdates(boolean dryRun, org.eclipse.jgit.lib.PersonIdent refLogIdent, String refLogMessage) throws IOException Execute all previously queued sync updates.NOTE that BatchUpdateListener.beforeUpdateRefs(org.eclipse.jgit.lib.BatchRefUpdate)events are not fired by this method. post-update events can be fired by the caller only for implementations that return a validBatchRefUpdate.- Parameters:
- dryRun- whether this is a dry run - i.e. no updates should be made
- refLogIdent- user to log as the update creator
- refLogMessage- message to put in the updates log
- Returns:
- the executed update, if supported by the implementing class
- Throws:
- IOException- in case of an update failure.
 
- 
executeAllAsyncUpdatesvoid executeAllAsyncUpdates(org.eclipse.jgit.lib.PersonIdent refLogIdent, String refLogMessage, org.eclipse.jgit.transport.PushCertificate pushCert) Execute all previously queued async updates.- Parameters:
- refLogIdent- user to log as the update creator
- refLogMessage- message to put in the updates log
- pushCert- to use for the update
 
- 
isEmptyboolean isEmpty()Returns whether any updates are queued.
- 
filterTypedUpdatesdefault <UpdateT extends ChangeDraftUpdate> com.google.common.collect.ListMultimap<String,UpdateT> filterTypedUpdates(com.google.common.collect.ListMultimap<String, ChangeDraftUpdate> updates, Class<UpdateT> updateType) Returns the given updates that match the provided type.
- 
canRunAsyncReturns whether all provided updates can run asynchronously.
 
-