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> createAddSocialNotificationInteractionHandler() {
    return ctx -> {
      final var response = ctx.response();
      try {
        final var value = ctx.getBodyAsJson();
        final var state = Model.fromJsonObject(value, UserMessage.class);
        if (state == null) {
          response.setStatusCode(Status.BAD_REQUEST.getStatusCode());
          response.end(new ErrorMessage("bad_status", "The body is not a valid user message").toBuffer());
        } else {
          final var notifications = this.getSocialNotificationInteractions();
          notifications.add(value);
          response.setStatusCode(Status.CREATED.getStatusCode());
          response.end(value.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 > createAddSocialNotificationInteractionHandler ( ) { return ctx -> { final var response = ctx . response ( ) ; try { final var value = ctx . getBodyAsJson ( ) ; final var state = Model . fromJsonObject ( value , UserMessage . class ) ; if ( state == null ) { response . setStatusCode ( Status . BAD_REQUEST . getStatusCode ( ) ) ; response . end ( new ErrorMessage ( "bad_status" , "The body is not a valid user message" ) . toBuffer ( ) ) ; } else { final var notifications = this . getSocialNotificationInteractions ( ) ; notifications . add ( value ) ; response . setStatusCode ( Status . CREATED . getStatusCode ( ) ) ; response . end ( value . 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 .