@groovy.transform.CompileStatic class CurrentTenantHolder extends java.lang.Object
| Constructor and description |
|---|
CurrentTenantHolder() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static java.io.Serializable |
get()Obtain the tenant bound to the current thread, irrespective of datastore. |
|
static java.io.Serializable |
get(Datastore datastore)
|
|
static void |
remove(Datastore datastore) |
|
static void |
remove(java.lang.Class<? extends Datastore> datastoreClass) |
|
static void |
set(Datastore datastore, java.io.Serializable tenantId)Set the current tenant |
|
static void |
set(java.lang.Class<? extends Datastore> datastoreClass, java.io.Serializable tenantId) |
<T> |
static T |
withTenant(Datastore datastore, java.io.Serializable tenantId, groovy.lang.Closure<T> callable)Execute with the current tenant |
<T> |
static T |
withTenant(java.lang.Class<? extends Datastore> datastoreClass, java.io.Serializable tenantId, groovy.lang.Closure<T> callable) |
<T> |
static T |
withoutTenant(Datastore datastore, groovy.lang.Closure<T> callable)Execute without current tenant |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Obtain the tenant bound to the current thread, irrespective of datastore. Prefer get(Datastore). A thread can hold a different tenant for each datastore, and only the datastore-scoped lookup can say which of them applies to a given operation.
null if no tenant is bound
Set the current tenant
tenantId - The tenant idExecute with the current tenant
callable - The closureExecute without current tenant
callable - The closure