public interface CdsRuntime
Service
instances and CdsModel
.
It can be used to define Request and ChangeSet boundaries.Modifier and Type | Method and Description |
---|---|
com.sap.cds.reflect.CdsModel |
getCdsModel() |
com.sap.cds.reflect.CdsModel |
getCdsModel(String tenant) |
ServiceCatalog |
getServiceCatalog() |
default void |
runInChangeSetContext(Consumer<ChangeSetContext> changeSetHandler)
Opens a
ChangeSetContext and runs the given handler within its scope. |
<T> T |
runInChangeSetContext(Function<ChangeSetContext,T> changeSetHandler)
Opens a
ChangeSetContext and runs the given handler within its scope. |
default void |
runInRequestContext(Request request,
Consumer<RequestContext> requestHandler)
Opens a
RequestContext and runs the given handler within its scope. |
<T> T |
runInRequestContext(Request request,
Function<RequestContext,T> requestHandler)
Opens a
RequestContext and runs the given handler within its scope. |
ServiceCatalog getServiceCatalog()
ServiceCatalog
containing all registered Service
instancescom.sap.cds.reflect.CdsModel getCdsModel()
CdsModel
as read from CSN filecom.sap.cds.reflect.CdsModel getCdsModel(String tenant)
tenant
- the tenanttenant
is null
<T> T runInRequestContext(Request request, Function<RequestContext,T> requestHandler)
RequestContext
and runs the given handler within its scope.
The RequestContext
will be propagated to all
EventContext
instances in the service call
hierarchy.T
- The type of the responserequest
- A Request
object describing the context of the request like parameters, user etc.requestHandler
- The handler for processing the request within the contextdefault void runInRequestContext(Request request, Consumer<RequestContext> requestHandler)
RequestContext
and runs the given handler within its scope.
The RequestContext
will be propagated to all
EventContext
instances in the service call
hierarchy.request
- A Request
object describing the context of the request like parameters, user etc.requestHandler
- The handler for processing the request within the context<T> T runInChangeSetContext(Function<ChangeSetContext,T> changeSetHandler)
ChangeSetContext
and runs the given handler within its scope.
The ChangeSetContext
marks a scope in which all opened transactions
etc. are committed cancelled together. Note that single transactions may fail
during commit but others might be successful.
The ChangeSetContext
will be propagated to all
EventContext
instances in the service call
hierarchy.
T
- The type of the responsechangeSetHandler
- The handler for processing the request within the contextdefault void runInChangeSetContext(Consumer<ChangeSetContext> changeSetHandler)
ChangeSetContext
and runs the given handler within its scope.
The ChangeSetContext
marks a scope in which all opened transactions
etc. are committed cancelled together. Note that single transactions may fail
during commit but others might be successful.
The ChangeSetContext
will be propagated to all
EventContext
instances in the service call
hierarchy.
changeSetHandler
- The handler for processing the request within the contextCopyright © 2020. All rights reserved.