Example usage for io.vertx.core.json JsonObject put

List of usage examples for io.vertx.core.json JsonObject put

Introduction

In this page you can find the example usage for io.vertx.core.json JsonObject put.

Prototype

public JsonObject put(String key, Object value) 

Source Link

Document

Put an Object into the JSON object with the specified key.

Usage

From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java

License:Apache License

public TaskService delegate(Long taskId, String userId, String newUserId, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/*from   w  w w  .  j  a va  2s .  c  om*/
    JsonObject _json = new JsonObject();
    _json.put("taskId", taskId);
    _json.put("userId", userId);
    _json.put("newUserId", newUserId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "delegate");
    _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            handler.handle(Future.succeededFuture(res.result().body()));
        }
    });
    return this;
}

From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java

License:Apache License

public TaskService exit(Long taskId, String userId, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }//from  ww w.  j  a  v a2  s . c o  m
    JsonObject _json = new JsonObject();
    _json.put("taskId", taskId);
    _json.put("userId", userId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "exit");
    _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            handler.handle(Future.succeededFuture(res.result().body()));
        }
    });
    return this;
}

From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java

License:Apache License

public TaskService fail(Long taskId, String userId, JsonObject data, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/*from w w  w  .jav a  2  s.co  m*/
    JsonObject _json = new JsonObject();
    _json.put("taskId", taskId);
    _json.put("userId", userId);
    _json.put("data", data);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "fail");
    _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            handler.handle(Future.succeededFuture(res.result().body()));
        }
    });
    return this;
}

From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java

License:Apache License

public TaskService forward(Long taskId, String userId, String newUserId, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }// ww w . j a  v  a  2s .  c o  m
    JsonObject _json = new JsonObject();
    _json.put("taskId", taskId);
    _json.put("userId", userId);
    _json.put("newUserId", newUserId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "forward");
    _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            handler.handle(Future.succeededFuture(res.result().body()));
        }
    });
    return this;
}

From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java

License:Apache License

public TaskService getContent(Long taskId, Handler<AsyncResult<JsonObject>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }//from   w  w w  .j  av  a  2s.co  m
    JsonObject _json = new JsonObject();
    _json.put("taskId", taskId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "getContent");
    _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            handler.handle(Future.succeededFuture(res.result().body()));
        }
    });
    return this;
}

From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java

License:Apache License

public TaskService release(Long taskId, String userId, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/*w w w. j a v a 2  s.c  o  m*/
    JsonObject _json = new JsonObject();
    _json.put("taskId", taskId);
    _json.put("userId", userId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "release");
    _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            handler.handle(Future.succeededFuture(res.result().body()));
        }
    });
    return this;
}

From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java

License:Apache License

public TaskService resume(Long taskId, String userId, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }//from  w  ww  .  j av a  2 s .c o m
    JsonObject _json = new JsonObject();
    _json.put("taskId", taskId);
    _json.put("userId", userId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "resume");
    _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            handler.handle(Future.succeededFuture(res.result().body()));
        }
    });
    return this;
}

From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java

License:Apache License

public TaskService skip(Long taskId, String userId, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }//  w  w w .  j  a  v a  2s . c o  m
    JsonObject _json = new JsonObject();
    _json.put("taskId", taskId);
    _json.put("userId", userId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "skip");
    _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            handler.handle(Future.succeededFuture(res.result().body()));
        }
    });
    return this;
}

From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java

License:Apache License

public TaskService start(Long taskId, String userId, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/*from   ww w.  j  av  a 2s.  c  o  m*/
    JsonObject _json = new JsonObject();
    _json.put("taskId", taskId);
    _json.put("userId", userId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "start");
    _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            handler.handle(Future.succeededFuture(res.result().body()));
        }
    });
    return this;
}

From source file:com.diabolicallabs.process.manager.service.TaskServiceVertxEBProxy.java

License:Apache License

public TaskService stop(Long taskId, String userId, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }//from  www  .  ja  v  a  2  s  . c  o  m
    JsonObject _json = new JsonObject();
    _json.put("taskId", taskId);
    _json.put("userId", userId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "stop");
    _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            handler.handle(Future.succeededFuture(res.result().body()));
        }
    });
    return this;
}