protected EvaluationResponse evaluate(Evaluator evaluator, EvaluationRequest request){
logger.info("Received {}", request);
Map<String, ?> requestArguments = request.getArguments();
EvaluationResponse response = new EvaluationResponse(request.getId());
Map<FieldName, Object> arguments = Maps.newLinkedHashMap();
List<FieldName> activeFields = evaluator.getActiveFields();
for(FieldName activeField : activeFields){
String key = activeField.getValue();
Object value = requestArguments.get(key);
if(value == null && !requestArguments.containsKey(key)){
logger.warn("Evaluation request {} does not specify an active field {}", request.getId(), key);
}
arguments.put(activeField, EvaluatorUtil.prepare(evaluator, activeField, value));
}
logger.debug("Evaluation request {} has prepared arguments: {}", request.getId(), arguments);
Map<FieldName, ?> result = evaluator.evaluate(arguments);
logger.debug("Evaluation response {} has result: {}", response.getId(), result);
response.setResult(EvaluatorUtil.decode(result));
logger.info("Returned {}", response);
return response;
}