Class RequestContextImpl
java.lang.Object
com.sap.cds.services.impl.request.RequestContextImpl
- All Implemented Interfaces:
RequestContextSPI,RequestContext,AutoCloseable
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static RequestContextSPIGives direct access to the currentRequestContextstored in theThreadLocalThis may returnnullif there is noRequestContextcurrently openedstatic RequestContextgetCurrentOrDefault(CdsRuntime cdsRuntime) Gives access to either the currentRequestContext, or if this does not exist to aRequestContextHelperthat itself ensures that there is always aRequestContextopened.static RequestContextgetCurrentOrNull(CdsRuntime cdsRuntime) Gives access to either the currentRequestContext, or if this does not exist to aRequestContextHelperthat itself ensures that there is always aRequestContextopened.intgetId()com.sap.cds.reflect.CdsModelgetModel()booleanisClosed()static RequestContextSPIopen(com.sap.cds.reflect.CdsModel cdsModel, ServiceCatalog serviceCatalog, UserInfo userInfo, ParameterInfo parameterInfo, FeatureTogglesInfo featureTogglesInfo, Messages messages, AuthenticationInfo authenticationInfo)
-
Method Details
-
open
public static RequestContextSPI open(com.sap.cds.reflect.CdsModel cdsModel, ServiceCatalog serviceCatalog, UserInfo userInfo, ParameterInfo parameterInfo, FeatureTogglesInfo featureTogglesInfo, Messages messages, AuthenticationInfo authenticationInfo) -
getCurrentOrDefault
Gives access to either the currentRequestContext, or if this does not exist to aRequestContextHelperthat itself ensures that there is always aRequestContextopened. This method will throw aNullPointerException, if the passedCdsRuntimewas null, but guarantees that it will never returnnull- Parameters:
cdsRuntime- A reference to the underlyingCdsRuntimeinstance.- Returns:
- the current
RequestContextor theRequestContextHelper
-
getCurrentOrNull
Gives access to either the currentRequestContext, or if this does not exist to aRequestContextHelperthat itself ensures that there is always aRequestContextopened. THis method might return null, if the passedCdsRuntimewas null.- Parameters:
cdsRuntime- A reference to the underlyingCdsRuntimeinstance.- Returns:
- the current
RequestContext, theRequestContextHelperornull
-
getCurrentInternal
Gives direct access to the currentRequestContextstored in theThreadLocalThis may returnnullif there is noRequestContextcurrently opened- Returns:
- the
RequestContextstored in theThreadLocal
-
getId
public int getId()- Specified by:
getIdin interfaceRequestContextSPI
-
getModel
public com.sap.cds.reflect.CdsModel getModel()- Specified by:
getModelin interfaceRequestContext
-
getServiceCatalog
- Specified by:
getServiceCatalogin interfaceRequestContext
-
getUserInfo
- Specified by:
getUserInfoin interfaceRequestContext
-
getAuthenticationInfo
- Specified by:
getAuthenticationInfoin interfaceRequestContext
-
getParameterInfo
- Specified by:
getParameterInfoin interfaceRequestContext
-
getMessages
- Specified by:
getMessagesin interfaceRequestContext
-
getFeatureTogglesInfo
- Specified by:
getFeatureTogglesInfoin interfaceRequestContext
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceRequestContextSPI
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRequestContextSPI
-