if (isMultiTenantEntity(event.getEntity())) {
Integer currentTenantId = currentTenant.get();
MultiTenantDomainClass entity = (MultiTenantDomainClass) event.getEntity();
Integer entityTenantId = entity.getTenantId();
if (currentTenantId != null && !currentTenantId.equals(entityTenantId)) {
throw new TenantSecurityException("Tried to update '" + event.getEntity() + "' with another tenant id. Expected "
+ currentTenantId + ", found " + entityTenantId, currentTenantId, entityTenantId);
}
}
return false;