Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : ABL API for Multi-tenant and Table Partition Management : Maintaining multi-tenant and table partition entities : Tenants (creating, reading, updating and deleting)
 
Tenants (creating, reading, updating and deleting)
The following code shows how to use the API service to create, read, update, and delete tenants using the ITenant interface:
define variable tenant as ITenant no-undo.

tenant = service:NewTenant("Andersen").
/* Set properties and optionally add elements to collections */
. . .
service:CreateTenant(tenant).

. . .
tenant = service:GetTenant("Acme").
/* Set properties and/or add/delete domain(s) */
. . .
service:UpdateTenant(tenant).

. . .
service:DeleteTenant("Andersen").
It is also possible to retrieve a collection of all the tenants in the database from the service and then do create, read, update, and delete on tenants in the ITenantSet collection before passing the collection to the service to be committed in a single transaction:
define variable tenantSet as ITenantSet no-undo.
define variable tenant as ITenant no-undo.

tenantSet = service:GetTenants().
tenant = service:newTenant("Andersen").
/* Set properties and optionally add elements to collections */
. . .
tenantSet:Add(tenant).

tenant = tenantSet:Find("Johnson")
tenant:Description = "Johnson is a paying customer.".

tenant = tenantSet:Find("Smith").
tenantSet:Remove(tenant).

service:UpdateTenants(tenantSet).
* Getting a tenant by an external ID