Package com.sap.cds.services.runtime
Interface CdsRuntime
public interface CdsRuntime
Interface for Protocol Adapters to get access to
Service
instances and CdsModel
.
It can be used to define Request and ChangeSet boundaries.-
Method Summary
Modifier and TypeMethodDescriptionStarts a newChangeSetContext
which defines the transactional boundariescom.sap.cds.reflect.CdsModel
com.sap.cds.reflect.CdsModel
getCdsModel
(UserInfo userInfo, FeatureTogglesInfo featureTogglesInfo) default com.sap.cds.reflect.CdsModel
getCdsModel
(String tenant) getFeatureTogglesInfo
(UserInfo userInfo, ParameterInfo parameterInfo) getLocalizedMessage
(String code, Object[] args, Locale locale) Returns the localized message for the given code, arguments and locale if existing,null
otherwise.Starts a newRequestContext
which defines the context of parameters (reflecting the user, request parameters etc.)
-
Method Details
-
getEnvironment
CdsEnvironment getEnvironment()- Returns:
- The
CdsEnvironment
built from the environment providers
-
getServiceCatalog
ServiceCatalog getServiceCatalog()- Returns:
- The
ServiceCatalog
containing all registeredService
instances
-
getCdsModel
com.sap.cds.reflect.CdsModel getCdsModel()- Returns:
- The common
CdsModel
as read from CSN file
-
getCdsModel
- Parameters:
tenant
- the tenant- Returns:
- the CDS model for a specific tenant or the default model if
tenant
isnull
-
getCdsModel
- Parameters:
userInfo
- theUserInfo
featureTogglesInfo
- theFeatureTogglesInfo
- Returns:
- The CDS model for a specific tenant and
FeatureTogglesInfo
or the default model if the tenant isnull
-
getProvidedParameterInfo
ParameterInfo getProvidedParameterInfo()- Returns:
- The
ParameterInfo
retrieved from the registeredParameterInfoProvider
or an emptyParameterInfo
.
-
getProvidedUserInfo
UserInfo getProvidedUserInfo()- Returns:
- The
UserInfo
retrieved from the registeredUserInfoProvider
or an anonymousUserInfo
.
-
getProvidedAuthenticationInfo
AuthenticationInfo getProvidedAuthenticationInfo()- Returns:
- The
AuthenticationInfo
retrieved from the registeredAuthenticationInfoProvider
ornull
if no authentication was provided.
-
getFeatureTogglesInfo
- Parameters:
userInfo
- theUserInfo
objectparameterInfo
- theParameterInfo
- Returns:
- The
FeatureTogglesInfo
retrieved from the registeredFeatureTogglesInfoProvider
-
getLocalizedMessage
Returns the localized message for the given code, arguments and locale if existing,null
otherwise. The method does not throw and returnscode
in case of any errors.- Parameters:
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.- Returns:
- The localized message or
null
if the code is not resolvable.
-
requestContext
RequestContextRunner requestContext()Starts a newRequestContext
which defines the context of parameters (reflecting the user, request parameters etc.)- Returns:
- the
RequestContextRunner
used to open the context.
-
changeSetContext
ChangeSetContextRunner changeSetContext()Starts a newChangeSetContext
which defines the transactional boundaries- Returns:
- the
ChangeSetContextRunner
used to open the context.
-