public interface TenantContext
TenantContext
interface provides information about the tenant which is associated with the current
Thread
.Modifier and Type | Method and Description |
---|---|
<V> V |
execute(String id,
Callable<V> callable)
This method will execute callable.call() method on behalf of the specified tenant and will return the result of
the called method.
|
String |
getAccountName()
Deprecated.
replaced by
Account.getId() |
Collection<Tenant> |
getSubscribedTenants()
Returns all tenants subscribed to the calling application.
|
Tenant |
getTenant()
Returns the
Tenant associated with the current Thread . |
String |
getTenantId()
Deprecated.
replaced by
Tenant.getId() |
@Deprecated String getTenantId()
Tenant.getId()
Thread
.TenantUnavailableException
- when there is no tenant context associated with the current Thread
.@Deprecated String getAccountName()
Account.getId()
Thread
.TenantUnavailableException
- when there is no tenant context associated with the current Thread
.Tenant getTenant()
Tenant
associated with the current Thread
.Tenant
.TenantUnavailableException
- when there is no tenant associated with the current thread or the current VM is not started for a
particular tenant.Collection<Tenant> getSubscribedTenants()
<V> V execute(String id, Callable<V> callable) throws TenantAlreadySetException, InvalidTenantException, Exception
id
- the tenant Id. Tenant Id is accessible via Tenant.getId()
. For example the tenant Id of the
tenant which is assigned to the current thread can be accessed via #getTenantId()
.callable
- an instance on which call() method will be executed.TenantAlreadySetException
- if execution cannot be done with the provided tenant Id.InvalidTenantException
- if there is no tenant with the given id, or if the tenant with the given id is not subscribed to the
application or if the tenant id passed does not correspond to the tenant for which the current VM has
been started.Exception
- any exception thrown during execution of callable.call() method.Copyright © 2018 SAP. All Rights Reserved.