public interface CdsRuntime
Service
instances and CdsModel
.
It can be used to define Request and ChangeSet boundaries.Modifier and Type | Method and Description |
---|---|
ChangeSetContextRunner |
changeSetContext()
Starts a new
ChangeSetContext which defines the transactional boundaries |
com.sap.cds.reflect.CdsModel |
getCdsModel() |
default com.sap.cds.reflect.CdsModel |
getCdsModel(String tenant) |
com.sap.cds.reflect.CdsModel |
getCdsModel(UserInfo userInfo,
FeatureTogglesInfo featureTogglesInfo) |
CdsEnvironment |
getEnvironment() |
FeatureTogglesInfo |
getFeatureTogglesInfo(UserInfo userInfo,
ParameterInfo parameterInfo) |
String |
getLocalizedMessage(String code,
Object[] args,
Locale locale)
Returns the localized message for the given code, arguments and locale if existing,
null otherwise. |
AuthenticationInfo |
getProvidedAuthenticationInfo() |
ParameterInfo |
getProvidedParameterInfo() |
UserInfo |
getProvidedUserInfo() |
ServiceCatalog |
getServiceCatalog() |
RequestContextRunner |
requestContext()
Starts a new
RequestContext which defines the context of parameters (reflecting the user, request parameters etc.) |
default void |
runInChangeSetContext(Consumer<ChangeSetContext> changeSetHandler)
Deprecated.
|
<T> T |
runInChangeSetContext(Function<ChangeSetContext,T> changeSetHandler)
Deprecated.
|
default void |
runInRequestContext(Request request,
Consumer<RequestContext> requestHandler)
Deprecated.
|
<T> T |
runInRequestContext(Request request,
Function<RequestContext,T> requestHandler)
Deprecated.
|
CdsEnvironment getEnvironment()
CdsEnvironment
built from the environment providersServiceCatalog getServiceCatalog()
ServiceCatalog
containing all registered Service
instancescom.sap.cds.reflect.CdsModel getCdsModel()
CdsModel
as read from CSN filedefault com.sap.cds.reflect.CdsModel getCdsModel(String tenant)
tenant
- the tenanttenant
is null
com.sap.cds.reflect.CdsModel getCdsModel(UserInfo userInfo, FeatureTogglesInfo featureTogglesInfo)
userInfo
- the UserInfo
featureTogglesInfo
- the FeatureTogglesInfo
FeatureTogglesInfo
or the default model if the tenant is null
ParameterInfo getProvidedParameterInfo()
ParameterInfo
retrieved from the registered ParameterInfoProvider
or an empty ParameterInfo
.UserInfo getProvidedUserInfo()
UserInfo
retrieved from the registered UserInfoProvider
or an anonymous UserInfo
.AuthenticationInfo getProvidedAuthenticationInfo()
AuthenticationInfo
retrieved from the registered AuthenticationInfoProvider
or null
if no authentication was provided.FeatureTogglesInfo getFeatureTogglesInfo(UserInfo userInfo, ParameterInfo parameterInfo)
userInfo
- the UserInfo
objectparameterInfo
- the ParameterInfo
FeatureTogglesInfo
retrieved from the registered FeatureTogglesInfoProvider
String getLocalizedMessage(String code, Object[] args, Locale locale)
null
otherwise.
The method does not throw and returns code
in case of any errors.code
- The code which is used as key for the format string in the defined bundles.args
- The argument objects for the format stringlocale
- The locale to be used. If no locale is set the default locale is taken.null
if the code is not resolvable.@Deprecated <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 context@Deprecated default 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 contextRequestContextRunner requestContext()
RequestContext
which defines the context of parameters (reflecting the user, request parameters etc.)RequestContextRunner
used to open the context.@Deprecated <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 context@Deprecated default 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 contextChangeSetContextRunner changeSetContext()
ChangeSetContext
which defines the transactional boundariesChangeSetContextRunner
used to open the context.Copyright © 2023. All rights reserved.