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 newChangeSetContextwhich defines the transactional boundariescom.sap.cds.reflect.CdsModelcom.sap.cds.reflect.CdsModelgetCdsModel(UserInfo userInfo, FeatureTogglesInfo featureTogglesInfo) default com.sap.cds.reflect.CdsModelgetCdsModel(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,nullotherwise.<T extends CdsProvider<T>>
TgetProvider(Class<T> clazz) Returns theCdsProviderof typeTStarts a newRequestContextwhich defines the context of parameters (reflecting the user, request parameters etc.)
-
Method Details
-
getEnvironment
CdsEnvironment getEnvironment()- Returns:
- The
CdsEnvironmentbuilt from the environment providers
-
getServiceCatalog
ServiceCatalog getServiceCatalog()- Returns:
- The
ServiceCatalogcontaining all registeredServiceinstances
-
getCdsModel
com.sap.cds.reflect.CdsModel getCdsModel()- Returns:
- The common
CdsModelas read from CSN file
-
getCdsModel
- Parameters:
tenant- the tenant- Returns:
- the CDS model for a specific tenant or the default model if
tenantisnull
-
getCdsModel
- Parameters:
userInfo- theUserInfofeatureTogglesInfo- theFeatureTogglesInfo- Returns:
- The CDS model for a specific tenant and
FeatureTogglesInfoor the default model if the tenant isnull
-
getProvidedParameterInfo
ParameterInfo getProvidedParameterInfo()- Returns:
- The
ParameterInforetrieved from the registeredParameterInfoProvideror an emptyParameterInfo.
-
getProvidedUserInfo
UserInfo getProvidedUserInfo()- Returns:
- The
UserInforetrieved from the registeredUserInfoProvideror an anonymousUserInfo.
-
getProvidedAuthenticationInfo
AuthenticationInfo getProvidedAuthenticationInfo()- Returns:
- The
AuthenticationInforetrieved from the registeredAuthenticationInfoProviderornullif no authentication was provided.
-
getFeatureTogglesInfo
- Parameters:
userInfo- theUserInfoobjectparameterInfo- theParameterInfo- Returns:
- The
FeatureTogglesInforetrieved from the registeredFeatureTogglesInfoProvider
-
getLocalizedMessage
Returns the localized message for the given code, arguments and locale if existing,nullotherwise. The method does not throw and returnscodein 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
nullif the code is not resolvable.
-
getProvider
Returns theCdsProviderof typeT- Type Parameters:
T- the specificCdsProvidertype- Parameters:
clazz- the class of the type ofCdsProvider- Returns:
- the
CdsProviderof typeT
-
requestContext
RequestContextRunner requestContext()Starts a newRequestContextwhich defines the context of parameters (reflecting the user, request parameters etc.)- Returns:
- the
RequestContextRunnerused to open the context.
-
changeSetContext
ChangeSetContextRunner changeSetContext()Starts a newChangeSetContextwhich defines the transactional boundaries- Returns:
- the
ChangeSetContextRunnerused to open the context.
-