ResponseBuilder rb;
if (!classifier.isUpdatable()) {
rb = Response.status(Response.Status.BAD_REQUEST).entity(
String.format("Classifier %s is not updateble.\n", classifier.getName()));
} else {
TrainingSet trainingSet = classifier.getTrainingSet();
if (exampleIds != null && !exampleIds.isEmpty()) {
for (String exampleId : exampleIds) {
trainingSet.registerExample(exampleId, null, null);
}
} else {
// implement a way to cleanup a complete training set? or is it too dangerous and we should
// return an error instead?
}
rb = Response.ok(String.format("Successfully deleted examples in training set '%s'.\n",
trainingSet.getName()));
}
addCORSOrigin(servletContext, rb, headers);
return rb.build();
}