@TransactionAware(value=IMMEDIATE) public class AttachmentSaveRequestedEvent extends AttachmentEvent implements CancelableEvent
attachment
is added
. This event is
synchronous, allowing listeners to perform operations in the same database transaction where the attachment will be
deleted.
This event is cancelable
. A listener may prevent the attachment from being added by
canceling
this event. Throwing an exception will not prevent the attachment
from being added; the exception will be logged and ignored.
source
Constructor and Description |
---|
AttachmentSaveRequestedEvent(Object source,
Repository repository,
Attachment attachment,
CancelState cancelState)
Construct a new
AttachmentEvent . |
Modifier and Type | Method and Description |
---|---|
void |
cancel(KeyedMessage message)
Cancels attachment addition, providing a message explaining why.
|
boolean |
isCanceled()
Retrieves a flag indicating whether attachment addition has already been canceled by another listener.
|
getAttachment, getRepository
getDate, getUser
getSource, toString
public AttachmentSaveRequestedEvent(@Nonnull Object source, @Nonnull Repository repository, @Nonnull Attachment attachment, @Nonnull CancelState cancelState)
AttachmentEvent
.source
- the component raising the eventrepository
- the repositoryattachment
- the attachmentpublic void cancel(@Nonnull KeyedMessage message)
cancel
in interface CancelState
message
- a descriptive message explaining why the operation has been canceledpublic boolean isCanceled()
isCanceled
in interface CancelState
true
if another listener has already canceled attachment addition; otherwise false
Copyright © 2022 Atlassian. All rights reserved.