vertx/src/main/java/eu/internetofus/common/vertx/ModelResources.java
/**
   * Check if a model exist.
   *
   * @param model    context of the model to check id exist.
   * @param searcher function to obtain the model.
   * @param context  of the request.
   *
   * @param <I>      type of identifier.
   * @param <T>      type of model.
   */
Check if a model exist.
@param model    context of the model to check id exist.
@param searcher function to obtain the model.
@param context  of the request.

@param       type of identifier.
@param       type of model.
Check if a model exist . @param model context of the model to check id exist . @param searcher function to obtain the model . @param context of the request . @param type of identifier . @param type of model .
static <I, T extends Model> void checkModelExist(@NotNull final ModelContext<T, I, ?> model,
      @NotNull final BiConsumer<I, Handler<AsyncResult<T>>> searcher, @NotNull final ServiceContext context) {
    searcher.accept(model.id, search -> {
      if (search.result() != null) {
        ServiceResponseHandlers.responseOk(context.resultHandler);
      } else {
        ServiceResponseHandlers.responseWithErrorMessage(context.resultHandler, Status.NOT_FOUND,
            "not_found_" + model.name, "Does not exist a '" + model.name + "' associated to '" + model.id + "'.");
      }
    });
  }
static < I , T extends Model > void checkModelExist ( @ NotNull final ModelContext < T , I , ? > model , @ NotNull final BiConsumer < I , Handler < AsyncResult < T > > > searcher , @ NotNull final ServiceContext context ) { searcher . accept ( model . id , search -> { if ( search . result ( ) != null ) { ServiceResponseHandlers . responseOk ( context . resultHandler ) ; } else { ServiceResponseHandlers . responseWithErrorMessage ( context . resultHandler , Status . NOT_FOUND , "not_found_" + model . name , "Does not exist a '" + model . name + "' associated to '" + model . id + "'." ) ; } } ) ; }
Check if a model exist.
Check if a model exist .