protected F.Either<ControllerProxy, ? extends Result> controllerOrNotFound(final String name) {
F.Option<ModelMetadata> modelInfo = getModel(name);
if (!modelInfo.isDefined())
return F.Either.Right(notFound("Model with name " + name + " not found!"));
ModelMetadata model = modelInfo.get();
ControllerProxy<?,?> crud;
try {
crud = getController(model);
} catch (IncompatibleControllerException e) {
crud = null;
}
if (crud == null)
return F.Either.Right(notFound("Controller for model " + model.getType() + " not found"));
ControllerProxy controller = crud;
return F.Either.Left(controller);
}