public interface ChangeSetContext
ChangeSetContext
defines the transactional boundaries around one or multiple Service.emit(com.sap.cds.services.EventContext)
calls.
It can be used by Handler
or other participants to ensure that changes, which were done as part of a ChangeSetContext are canceled (rolled back).
ChangeSetListener
Modifier and Type | Method and Description |
---|---|
static ChangeSetContext |
getCurrent()
Gives access to the currently active
ChangeSetContext . |
int |
getId() |
static boolean |
isActive() |
boolean |
isMarkedForCancel() |
void |
markForCancel()
Marks the
ChangeSetContext to be cancelled. |
void |
register(ChangeSetListener listener)
Registers a
ChangeSetListener on the ChangeSetContext , to be notified once the ChangeSetContext is closed successfully or cancelled. |
static boolean isActive()
ChangeSetContext
is currently activestatic ChangeSetContext getCurrent()
ChangeSetContext
.
If no ChangeSetContext
is currently opened this method will return null
ChangeSetContext
or null
.int getId()
ChangeSetContext
, used for loggingvoid markForCancel()
ChangeSetContext
to be cancelled. When the ChangeSet is finished, transactions will be rolled back.boolean isMarkedForCancel()
markForCancel()
was called at least once, false otherwisevoid register(ChangeSetListener listener)
ChangeSetListener
on the ChangeSetContext
, to be notified once the ChangeSetContext
is closed successfully or cancelled.listener
- the ChangeSetListener
Copyright © 2023. All rights reserved.