components/src/test/java/eu/internetofus/common/components/CRUDContext.java
/**
   * Return the handler to merge (patch) a value for an identifier with the
   * current one.
   *
   * @return the handler to merge value by its identifier.
   */
Return the handler to merge (patch) a value for an identifier with the
current one.

@return the handler to merge value by its identifier.
Return the handler to merge ( patch ) a value for an identifier with the current one . @return the handler to merge value by its identifier .
public Handler<RoutingContext> patchHandler() {
    return this.toRoutingContextHandler((ctx, id, value) -> {
      final var newValue = this.getNewValueFrom(ctx);
      if (newValue != null) {
        var mergedValue = Merges.mergeJsonObjects(value, newValue);
        mergedValue = mergedValue.put(this.idName, id);
        if (CreateUpdateTsDetails.class.isAssignableFrom(this.modelType)) {
          final var now = TimeManager.now();
          mergedValue = mergedValue.put("_creationTs", value.getValue("_creationTs"));
          mergedValue = mergedValue.put("_lastUpdateTs", now);
        }
        final var response = ctx.response();
        this.values.put(id, mergedValue);
        response.setStatusCode(Status.OK.getStatusCode());
        response.end(mergedValue.toBuffer());
      }
    });
  }
public Handler < RoutingContext > patchHandler ( ) { return this . toRoutingContextHandler ( ( ctx , id , value ) -> { final var newValue = this . getNewValueFrom ( ctx ) ; if ( newValue != null ) { var mergedValue = Merges . mergeJsonObjects ( value , newValue ) ; mergedValue = mergedValue . put ( this . idName , id ) ; if ( CreateUpdateTsDetails . class . isAssignableFrom ( this . modelType ) ) { final var now = TimeManager . now ( ) ; mergedValue = mergedValue . put ( "_creationTs" , value . getValue ( "_creationTs" ) ) ; mergedValue = mergedValue . put ( "_lastUpdateTs" , now ) ; } final var response = ctx . response ( ) ; this . values . put ( id , mergedValue ) ; response . setStatusCode ( Status . OK . getStatusCode ( ) ) ; response . end ( mergedValue . toBuffer ( ) ) ; } } ) ; }
Return the handler to merge (patch) a value for an identifier with the
 current one.
Return the handler to merge ( patch ) a value for an identifier with the current one .