T - the RepositoryHookRequest typepublic abstract class AbstractGitWorkTreeRepositoryHookInvoker<T extends com.atlassian.bitbucket.hook.repository.RepositoryHookRequest> extends Object implements GitWorkTreeRepositoryHookInvoker
GitWorkTreeRepositoryHookInvoker| Modifier and Type | Field and Description |
|---|---|
protected com.atlassian.event.api.EventPublisher |
eventPublisher |
| Constructor and Description |
|---|
AbstractGitWorkTreeRepositoryHookInvoker(com.atlassian.event.api.EventPublisher eventPublisher,
com.atlassian.bitbucket.hook.repository.RepositoryHookService repositoryHookService) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
createHookRequest(GitWorkTree workTree,
List<com.atlassian.bitbucket.repository.RefChange> refChanges) |
protected abstract com.atlassian.bitbucket.event.ApplicationEvent |
createPostUpdateEvent(T hookRequest) |
protected void |
onAccepted(T hookRequest,
com.atlassian.bitbucket.hook.repository.RepositoryHookResult result)
Called from
preUpdate(GitWorkTree, List) after the repository hooks have been called and the
change has been accepted (but not applied yet). |
protected void |
onRejected(T hookRequest,
com.atlassian.bitbucket.hook.repository.RepositoryHookResult result)
Called from
preUpdate(GitWorkTree, List) after the repository hooks have been called and the
change has been rejected. |
void |
postUpdate(GitWorkTree workTree,
List<com.atlassian.bitbucket.repository.RefChange> refChanges)
Called by
GitWorkTree.publish(PublishGitWorkTreeParameters) after the work tree ref has been published. |
boolean |
preUpdate(GitWorkTree workTree,
List<com.atlassian.bitbucket.repository.RefChange> refChanges)
Called by
GitWorkTree.publish(PublishGitWorkTreeParameters) before the work tree ref is
published. |
public boolean preUpdate(@Nonnull GitWorkTree workTree, @Nonnull List<com.atlassian.bitbucket.repository.RefChange> refChanges)
GitWorkTreeRepositoryHookInvokerGitWorkTree.publish(PublishGitWorkTreeParameters) before the work tree ref is
published. Implementors should call RepositoryHookService.preUpdate(RepositoryHookRequest) with an
appropriate RepositoryHookRequest.preUpdate in interface GitWorkTreeRepositoryHookInvokerworkTree - the work tree for which a refChange are about to be publishedrefChanges - the ref changes about to be publishedtrue if the pre-update hooks accepted the change, otherwise falseRepositoryHookService.preUpdate(RepositoryHookRequest)public void postUpdate(@Nonnull GitWorkTree workTree, @Nonnull List<com.atlassian.bitbucket.repository.RefChange> refChanges)
GitWorkTreeRepositoryHookInvokerGitWorkTree.publish(PublishGitWorkTreeParameters) after the work tree ref has been published.
Implementors should call RepositoryHookService.postUpdate(RepositoryHookRequest) with an appropriate
RepositoryHookRequest.postUpdate in interface GitWorkTreeRepositoryHookInvokerworkTree - the work tree for which a refChange has been publishedrefChanges - the ref changes that have been publishedRepositoryHookService.postUpdate(RepositoryHookRequest)@Nonnull protected abstract T createHookRequest(@Nonnull GitWorkTree workTree, @Nonnull List<com.atlassian.bitbucket.repository.RefChange> refChanges)
@Nonnull protected abstract com.atlassian.bitbucket.event.ApplicationEvent createPostUpdateEvent(@Nonnull T hookRequest)
protected void onAccepted(@Nonnull T hookRequest, @Nonnull com.atlassian.bitbucket.hook.repository.RepositoryHookResult result)
preUpdate(GitWorkTree, List) after the repository hooks have been called and the
change has been accepted (but not applied yet). Most implementations won't need to do anything here, but the
callback exists just in case.hookRequest - the hook request that was approved by the repository hooksresult - the repository hook resultprotected void onRejected(@Nonnull T hookRequest, @Nonnull com.atlassian.bitbucket.hook.repository.RepositoryHookResult result)
preUpdate(GitWorkTree, List) after the repository hooks have been called and the
change has been rejected. Most implementations will want to throw an exception here. If an event should be
raised notifying other parts of the system that the operation has been rejected, this is the place to do it.hookRequest - the hook request that was rejected by the repository hooksresult - the repository hook result, which includes all vetoesCopyright © 2021 Atlassian. All rights reserved.