use of io.gravitee.repository.management.model.Tenant in project gravitee-management-rest-api by gravitee-io.
the class TenantServiceImpl method delete.
@Override
public void delete(final String tenantId) {
try {
Optional<Tenant> tenantOptional = tenantRepository.findById(tenantId);
if (tenantOptional.isPresent()) {
tenantRepository.delete(tenantId);
auditService.createPortalAuditLog(Collections.singletonMap(TENANT, tenantId), TENANT_DELETED, new Date(), null, tenantOptional.get());
tenantRepository.delete(tenantId);
}
} catch (TechnicalException ex) {
LOGGER.error("An error occurs while trying to delete tenant {}", tenantId, ex);
throw new TechnicalManagementException("An error occurs while trying to delete tenant " + tenantId, ex);
}
}
Aggregations