use of org.wso2.carbon.tenant.mgt.services.TenantMgtService in project identity-api-server by wso2.
the class ServerTenantManagementService method listTenants.
/**
* Get tenant list.
*
* @param limit Items per page.
* @param offset Offset.
* @param filter Filter string. E.g. filter="domainName" sw "wso2.com"
* @param sortBy Attribute to sort the tenants by. E.g. domainName
* @param sortOrder Order in which tenants should be sorted. Can be either ASC or DESC.
* @return TenantsListResponse.
*/
public TenantsListResponse listTenants(Integer limit, Integer offset, String sortOrder, String sortBy, String filter) {
handleNotImplementedCapabilities(filter);
TenantMgtService tenantMgtService = TenantManagementServiceHolder.getTenantMgtService();
try {
TenantSearchResult tenantSearchResult = tenantMgtService.listTenants(limit, offset, sortOrder, sortBy, filter);
return createTenantListResponse(tenantSearchResult);
} catch (TenantMgtException e) {
throw handleTenantManagementException(e, TenantManagementConstants.ErrorMessage.ERROR_CODE_ERROR_LISTING_TENANTS, null);
}
}
use of org.wso2.carbon.tenant.mgt.services.TenantMgtService in project identity-api-server by wso2.
the class ServerTenantManagementService method addTenant.
public String addTenant(ChannelVerifiedTenantModel channelVerifiedTenantModel) {
String resourceId;
TenantMgtService tenantMgtService = TenantManagementServiceHolder.getTenantMgtService();
try {
validateInputAgainstCode(channelVerifiedTenantModel);
Tenant tenant = createTenantInfoBean(channelVerifiedTenantModel);
resourceId = tenantMgtService.addTenant(tenant);
} catch (TenantMgtException e) {
throw handleTenantManagementException(e, TenantManagementConstants.ErrorMessage.ERROR_CODE_ERROR_ADDING_TENANT, null);
}
return resourceId;
}
use of org.wso2.carbon.tenant.mgt.services.TenantMgtService in project identity-api-server by wso2.
the class ServerTenantManagementService method addTenant.
/**
* Add a tenant.
*
* @param tenantModel tenantModel.
* @return TenantResponseModel.
*/
public String addTenant(TenantModel tenantModel) {
String resourceId;
TenantMgtService tenantMgtService = TenantManagementServiceHolder.getTenantMgtService();
try {
Tenant tenant = createTenantInfoBean(tenantModel);
resourceId = tenantMgtService.addTenant(tenant);
} catch (TenantMgtException e) {
throw handleTenantManagementException(e, TenantManagementConstants.ErrorMessage.ERROR_CODE_ERROR_ADDING_TENANT, null);
}
return resourceId;
}
Aggregations