Package com.sap.cds.services.changeset
Interface ChangeSetContext
- All Known Subinterfaces:
ChangeSetContextSPI
public interface ChangeSetContext
A
In addition it provides the ability to perform actions at the end of a ChangeSet by registering a
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).
In addition it provides the ability to perform actions at the end of a ChangeSet by registering a
ChangeSetListener
-
Method Summary
Modifier and TypeMethodDescriptionstatic ChangeSetContext
Gives access to the currently activeChangeSetContext
.int
getId()
static boolean
isActive()
boolean
void
Marks theChangeSetContext
to be cancelled.void
register
(ChangeSetListener listener) Registers aChangeSetListener
on theChangeSetContext
, to be notified once theChangeSetContext
is closed successfully or cancelled.
-
Method Details
-
isActive
static boolean isActive()- Returns:
- true, if a
ChangeSetContext
is currently active
-
getCurrent
Gives access to the currently activeChangeSetContext
. If noChangeSetContext
is currently opened this method will returnnull
- Returns:
- the currently active
ChangeSetContext
ornull
.
-
getId
int getId()- Returns:
- an numeric identifier of the
ChangeSetContext
, used for logging
-
markForCancel
void markForCancel()Marks theChangeSetContext
to be cancelled. When the ChangeSet is finished, transactions will be rolled back. -
isMarkedForCancel
boolean isMarkedForCancel()- Returns:
- true, if
markForCancel()
was called at least once, false otherwise
-
register
Registers aChangeSetListener
on theChangeSetContext
, to be notified once theChangeSetContext
is closed successfully or cancelled.- Parameters:
listener
- theChangeSetListener
-