interface TenantService
A Service with utility methods for working with Multi-Tenancy
Type Params | Return Type | Name and description |
---|---|---|
|
abstract java.io.Serializable |
currentId()
|
|
abstract void |
eachTenant(groovy.lang.Closure callable) Execute the given closure for each tenant. |
<T> |
abstract T |
withCurrent(groovy.lang.Closure<T> callable) Execute the given closure with the current tenant. |
<T> |
abstract T |
withId(java.io.Serializable tenantId, groovy.lang.Closure<T> callable) Execute the given closure with given tenant id. |
<T> |
abstract T |
withoutId(groovy.lang.Closure<T> callable) Execute the given closure without any tenant id. |
Execute the given closure for each tenant. This method will create a new datastore session for the scope of the call and hence is designed to be used to manage the connection life cycle
callable
- The closureExecute the given closure with the current tenant. This method will create a new datastore session for the scope of the call and hence is designed to be used to manage the connection life cycle
callable
- The closureExecute the given closure with given tenant id. This method will create a new datastore session for the scope of the call and hence is designed to be used to manage the connection life cycle
tenantId
- The tenant idcallable
- The closureExecute the given closure without any tenant id. In Multi tenancy mode SINGLE this will execute against the default data source. If multi tenancy mode MULTI this will execute without including the "tenantId" on any query. Use with caution.
callable
- The closure