Class TenantIdUtils

java.lang.Object
com.sap.cds.services.utils.TenantIdUtils

public class TenantIdUtils extends Object
Utility for retrieving/setting the tenant id from/into the MDC.
  • Field Details

  • Method Details

    • mdcHasEntry

      public static boolean mdcHasEntry()
      Checks whether there's a tenant id entry in the MDC.
      Returns:
      true, if there's an entry under the key "tenant_id"
    • putInMDC

      public static void putInMDC(String tenantId)
      Puts the provided tenant id into the MDC under the key "tenant_id".
      Parameters:
      tenantId - the tenant id
    • getFromMDC

      public static String 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 the MDC.