public class RepositoryCreationRequestedEvent extends RepositoryEvent implements CancelableEvent
repository
is created. This event is synchronous, allowing listeners to
perform operations in the same database transaction where the repository will be created.
This event is cancelable
. A listener may prevent the repository from being created by
canceling
this event. Throwing an exception will not prevent the repository
from being created; the exception will be logged and ignored.
Note: The repository attached to the event will not have an ID
, as it has not
been created yet. Any listener which would like to create associations based on that ID must listen for the
RepositoryCreatedEvent
instead, which will include it (but will not run in the same transaction).
This event is internally audited with CoverageLevel.BASE
level.
source
Constructor and Description |
---|
RepositoryCreationRequestedEvent(Object source,
Repository repository,
CancelState cancelState)
Deprecated.
in 7.5 for removal in 8.0. Use
RepositoryCreationRequestedEvent(Object, Repository, String, CancelState) instead. |
RepositoryCreationRequestedEvent(Object source,
Repository repository,
String defaultBranch,
CancelState cancelState) |
Modifier and Type | Method and Description |
---|---|
void |
cancel(KeyedMessage message)
Cancels repository creation, providing a message explaining why.
|
String |
getDefaultBranch()
Retrieves the default branch the repository will use, if one was specified.
|
boolean |
isCanceled()
Retrieves a flag indicating whether repository creation has already been canceled by another listener.
|
getRepository
getDate, getUser
getSource, toString
@Deprecated public RepositoryCreationRequestedEvent(@Nonnull Object source, @Nonnull Repository repository, @Nonnull CancelState cancelState)
RepositoryCreationRequestedEvent(Object, Repository, String, CancelState)
instead.source
- the source of the eventrepository
- the repository to be createdcancelState
- tracks vetoes for the eventpublic RepositoryCreationRequestedEvent(@Nonnull Object source, @Nonnull Repository repository, @Nullable String defaultBranch, @Nonnull CancelState cancelState)
source
- the source of the eventrepository
- the repository to be createddefaultBranch
- the default branch for the repository, or null
if the SCM's default will be usedcancelState
- tracks vetoes for the eventpublic void cancel(@Nonnull KeyedMessage message)
cancel
in interface CancelState
message
- a descriptive message explaining why the operation has been canceled@Nullable public String getDefaultBranch()
null
if the SCM's default branch will be usedpublic boolean isCanceled()
isCanceled
in interface CancelState
true
if another listener has already canceled repository creation; otherwise, false
Copyright © 2022 Atlassian. All rights reserved.