Package com.sap.cds.services.utils
Class TenantIdUtils
java.lang.Object
com.sap.cds.services.utils.TenantIdUtils
Utility for retrieving/setting the tenant id from/into the MDC.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclearMDC()Removes the tenant id field from theMDC.static StringGets a tenant id value from the MDC, if existing, or null otherwise.static booleanChecks whether there's a tenant id entry in theMDC.static voidPuts the provided tenant id into theMDCunder the key "tenant_id".
-
Field Details
-
TENANT_ID_FIELD
- See Also:
-
TENANT_ID_UNKNOWN
- See Also:
-
-
Method Details
-
mdcHasEntry
public static boolean mdcHasEntry()Checks whether there's a tenant id entry in theMDC.- Returns:
- true, if there's an entry under the key "tenant_id"
-
putInMDC
Puts the provided tenant id into theMDCunder the key "tenant_id".- Parameters:
tenantId- the tenant id
-
getFromMDC
Gets a tenant id value from the MDC, if existing, or null otherwise.- Returns:
- a tenant id
-
clearMDC
public static void clearMDC()Removes the tenant id field from theMDC.
-