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 ChangeSetContextGives access to the currently activeChangeSetContext.intgetId()static booleanisActive()booleanvoidMarks theChangeSetContextto be cancelled.voidregister(ChangeSetListener listener) Registers aChangeSetListeneron theChangeSetContext, to be notified once theChangeSetContextis closed successfully or cancelled.
-
Method Details
-
isActive
static boolean isActive()- Returns:
- true, if a
ChangeSetContextis currently active
-
getCurrent
Gives access to the currently activeChangeSetContext. If noChangeSetContextis currently opened this method will returnnull- Returns:
- the currently active
ChangeSetContextornull.
-
getId
int getId()- Returns:
- an numeric identifier of the
ChangeSetContext, used for logging
-
markForCancel
void markForCancel()Marks theChangeSetContextto 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 aChangeSetListeneron theChangeSetContext, to be notified once theChangeSetContextis closed successfully or cancelled.- Parameters:
listener- theChangeSetListener
-