components/src/test/java/eu/internetofus/common/components/social_context_builder/WeNetSocialContextBuilderSimulatorGetSetContext.java
/**
   * Create a handler to store the social preferences answers.
   *
   * @return the handler to set a value.
   */
Create a handler to store the social preferences answers.
@return the handler to set a value.
Create a handler to store the social preferences answers . @return the handler to set a value .
public Handler<RoutingContext> createSetSocialPreferencesAnswersHandler() {
    return ctx -> {
      final var response = ctx.response();
      try {
        final var id = this.getIdFrom(ctx, "SOCIAL_PREFERENCES_ANSWERS", "userId", "taskId");
        final var body = ctx.getBody();
        final var value = (JsonObject) Json.decodeValue(body);
        this.values.put(id, value);
        response.setStatusCode(Status.CREATED.getStatusCode());
        response.end(value.getJsonArray("data").toBuffer());
      } catch (final Throwable t) {
        response.setStatusCode(Status.BAD_REQUEST.getStatusCode());
        response.end(new ErrorMessage("bad_value", "Does not exist a valid value on the body.").toBuffer());
      }
    };
  }
public Handler < RoutingContext > createSetSocialPreferencesAnswersHandler ( ) { return ctx -> { final var response = ctx . response ( ) ; try { final var id = this . getIdFrom ( ctx , "SOCIAL_PREFERENCES_ANSWERS" , "userId" , "taskId" ) ; final var body = ctx . getBody ( ) ; final var value = ( JsonObject ) Json . decodeValue ( body ) ; this . values . put ( id , value ) ; response . setStatusCode ( Status . CREATED . getStatusCode ( ) ) ; response . end ( value . getJsonArray ( "data" ) . toBuffer ( ) ) ; } catch ( final Throwable t ) { response . setStatusCode ( Status . BAD_REQUEST . getStatusCode ( ) ) ; response . end ( new ErrorMessage ( "bad_value" , "Does not exist a valid value on the body." ) . toBuffer ( ) ) ; } } ; }
Create a handler to store the social preferences answers.
Create a handler to store the social preferences answers .