if (domainObject != null) {
Set<ConstraintViolation<Object>> errors = service.validate(domainObject);
if (errors != null && !errors.isEmpty()) {
SimpleProxyId<?> id = entry.getKey();
for (ConstraintViolation<Object> error : errors) {
ViolationMessage message = FACTORY.violation().as();
message.setClientId(id.getClientId());
message.setMessage(error.getMessage());
message.setPath(error.getPropertyPath().toString());
if (id.isEphemeral()) {
message.setClientId(id.getClientId());
message.setStrength(Strength.EPHEMERAL);
} else {
message.setServerId(toBase64(id.getServerId()));
}
message.setTypeToken(service.resolveTypeToken(id.getProxyClass()));
errorMessages.add(message);
}
}
}
}