use of org.craftercms.profile.exceptions.NoSuchTenantException in project profile by craftercms.
the class TenantServiceImpl method updateTenant.
protected Tenant updateTenant(String tenantName, UpdateCallback callback) throws ProfileException {
Tenant tenant = getTenant(tenantName);
if (tenant != null) {
checkIfTenantActionIsAllowed(tenantName, TenantAction.UPDATE_TENANT);
UpdateHelper updateHelper = new UpdateHelper();
TenantUpdater tenantUpdater = new TenantUpdater(tenant, updateHelper, tenantRepository);
callback.doWithTenant(tenantUpdater);
try {
tenantUpdater.update();
} catch (MongoDataException e) {
throw new I10nProfileException(ERROR_KEY_UPDATE_TENANT_ERROR, e, tenant.getName());
}
} else {
throw new NoSuchTenantException(tenantName);
}
return tenant;
}
Aggregations