Skip to content

Commit

Permalink
Modify ES evaluation handler service for new interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Pearce committed Dec 10, 2018
1 parent 9588d89 commit 00f9a5c
Showing 1 changed file with 4 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@

@RestController
public class RREController {
private Evaluation evaluation = new Evaluation();
private EvaluationMetadata metadata = new EvaluationMetadata(Collections.emptyList(), Collections.emptyList());

@Autowired
private EvaluationHandlerService evaluationHandler;

@PostMapping("/evaluation")
public void updateEvaluationData(@RequestBody final JsonNode requestBody) throws Exception {
this.evaluation = evaluationHandler.processEvaluationRequest(requestBody);
this.metadata = evaluationMetadata(evaluation);
evaluationHandler.processEvaluationRequest(requestBody);
}

public EvaluationMetadata getMetadata() {
return metadata;
return evaluationHandler.getEvaluationMetadata();
}

@ApiOperation(value = "Returns the evaluation data.")
Expand All @@ -42,27 +39,7 @@ public EvaluationMetadata getMetadata() {
})
@GetMapping(value = "/evaluation", produces = { "application/json" })
@ResponseBody
public Evaluation getEvaluationData() throws Exception {
return evaluation;
}

/**
* Creates the evaluation metadata.
*
* @param evaluation the evaluation data.
* @return the evaluation metadata.
*/
private EvaluationMetadata evaluationMetadata(final Evaluation evaluation) {
final List<String> metrics = new ArrayList<>(
evaluation.getChildren()
.iterator().next()
.getMetrics().keySet());

final List<String> versions = new ArrayList<>(
evaluation.getChildren()
.iterator().next()
.getMetrics().values().iterator().next().getVersions().keySet());

return new EvaluationMetadata(versions, metrics);
public Evaluation getEvaluationData() {
return evaluationHandler.getEvaluation();
}
}

0 comments on commit 00f9a5c

Please sign in to comment.