public class DomainUtils {
public static BusinessException notificationErrorsToBusinessException(Notification notification) {
BusinessException ex = new BusinessException();
for (Message m : notification.getMessages(Message.Type.ERROR)) {
Error error = new Error(m.getCode(), m.getDefaultMessage(), m.getPropertyName());
ex.addError(error);
}
return ex;
}