Source:
<code>public void deleteTenantMetaData(String tenantUniqueIdentifier) throws TenantMgtException { TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager(); if (tenantManager != null) { Tenant tenant = null; try { tenant = tenantManager.getTenant(tenantUniqueIdentifier); } catch (UserStoreException e) { throw new TenantManagementServerException("Error while getting the tenant with the tenant unique id :" + tenantUniqueIdentifier + " .", e); } if (tenant != null) { int tenantId = tenant.getId(); String tenantDomain = tenant.getDomain(); try { if (log.isDebugEnabled()) { log.debug(String.format("Starting tenant deletion for domain: %s and tenant id: %d from the " + "system.", tenantDomain, tenantId)); } ServerConfigurationService serverConfigurationService = TenantMgtServiceComponent.getServerConfigurationService(); <START> if (Boolean.parseBoolean(serverConfigurationService.getFirstProperty("Tenant.TenantDelete"))) { <END> TenantMgtUtil.deleteTenant(tenantDomain, tenantManager, tenantId, serverConfigurationService); } else { throw new TenantManagementClientException(ERROR_CODE_TENANT_DELETION_NOT_ENABLED.getCode(), ERROR_CODE_TENANT_DELETION_NOT_ENABLED.getMessage()); } } catch (Exception e) { if (e instanceof TenantMgtException) { throw (TenantMgtException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } } else { if (log.isDebugEnabled()) { String msg = "Trying to delete a non-existing tenant with tenant unique id : %s ."; log.debug(String.format(msg, tenantUniqueIdentifier)); } } } }</code><technical_language>beginning of method, need do this validation, if this is false, throw. if (!Boolean.parseBoolean(serverConfigurationService.getFirstProperty("Tenant.TenantDelete"))) { throw new TenantManagementClientException(ERROR_CODE_TENANT_DELETION_NOT_ENABLED.getCode(), ERROR_CODE_TENANT_DELETION_NOT_ENABLED.getMessage()); }</technical_language>

Target:
public void deleteTenantMetaData(String tenantUniqueIdentifier) throws TenantMgtException { ServerConfigurationService serverConfigurationService = TenantMgtServiceComponent.getServerConfigurationService(); if (!Boolean.parseBoolean(serverConfigurationService.getFirstProperty("Tenant.TenantDelete"))) { throw new TenantManagementClientException(ERROR_CODE_TENANT_DELETION_NOT_ENABLED.getCode(), ERROR_CODE_TENANT_DELETION_NOT_ENABLED.getMessage()); } TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager(); if (tenantManager != null) { Tenant tenant; try { tenant = tenantManager.getTenant(tenantUniqueIdentifier); } catch (UserStoreException e) { throw new TenantManagementServerException("Error while getting the tenant with the tenant " + "unique id :" + tenantUniqueIdentifier + " .", e); } if (tenant != null) { int tenantId = tenant.getId(); String tenantDomain = tenant.getDomain(); try { if (log.isDebugEnabled()) { log.debug(String.format("Starting tenant deletion for domain: %s and tenant id: %d from " + "the system.", tenantDomain, tenantId)); } TenantMgtUtil.deleteTenant(tenantDomain); } catch (Exception e) { if (e instanceof TenantMgtException) { throw (TenantMgtException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } } else { if (log.isDebugEnabled()) { String msg = "Trying to delete a non-existing tenant with tenant unique id : %s ."; log.debug(String.format(msg, tenantUniqueIdentifier)); } } } }