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.ProcessServiceVertxEBProxy.java

License:Apache License

public ProcessService signalEventForProcess(String eventName, Long processInstanceId, JsonObject data,
        Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/*from ww w .j a  va2  s.  co  m*/
    JsonObject _json = new JsonObject();
    _json.put("eventName", eventName);
    _json.put("processInstanceId", processInstanceId);
    _json.put("data", data);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "signalEventForProcess");
    _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.ProcessServiceVertxEBProxy.java

License:Apache License

public ProcessService startProcess(String processId, Handler<AsyncResult<ProcessInstanceService>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }//from  ww w .j av  a 2s. com
    JsonObject _json = new JsonObject();
    _json.put("processId", processId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "startProcess");
    _vertx.eventBus().<ProcessInstanceService>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            String addr = res.result().headers().get("proxyaddr");
            handler.handle(Future
                    .succeededFuture(ProxyHelper.createProxy(ProcessInstanceService.class, _vertx, addr)));
        }
    });
    return this;
}

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

License:Apache License

public ProcessService startProcessWithVariables(String processId, JsonObject jsonObject,
        Handler<AsyncResult<ProcessInstanceService>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }//from   w w  w .  j a  v  a 2  s .c o m
    JsonObject _json = new JsonObject();
    _json.put("processId", processId);
    _json.put("jsonObject", jsonObject);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "startProcessWithVariables");
    _vertx.eventBus().<ProcessInstanceService>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            handler.handle(Future.failedFuture(res.cause()));
        } else {
            String addr = res.result().headers().get("proxyaddr");
            handler.handle(Future
                    .succeededFuture(ProxyHelper.createProxy(ProcessInstanceService.class, _vertx, addr)));
        }
    });
    return this;
}

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

License:Apache License

public RuleService delete(String factHandle, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }// www .j av  a 2 s  . c  o  m
    JsonObject _json = new JsonObject();
    _json.put("factHandle", factHandle);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "delete");
    _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.RuleServiceVertxEBProxy.java

License:Apache License

public RuleService getQueryResults(String queryName, String resultName,
        Handler<AsyncResult<JsonArray>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }// w w  w .ja v a 2  s  .co  m
    JsonObject _json = new JsonObject();
    _json.put("queryName", queryName);
    _json.put("resultName", resultName);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "getQueryResults");
    _vertx.eventBus().<JsonArray>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.RuleServiceVertxEBProxy.java

License:Apache License

public RuleService insert(String packageName, String typeName, JsonObject attributes,
        Handler<AsyncResult<String>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/*from  w ww  . ja v  a2  s  . c  o m*/
    JsonObject _json = new JsonObject();
    _json.put("packageName", packageName);
    _json.put("typeName", typeName);
    _json.put("attributes", attributes);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "insert");
    _vertx.eventBus().<String>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.RuleServiceVertxEBProxy.java

License:Apache License

public RuleService update(String factHandle, String factType, JsonObject attributes,
        Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/*from  w  w w  .  ja  v  a2  s  .  c o m*/
    JsonObject _json = new JsonObject();
    _json.put("factHandle", factHandle);
    _json.put("factType", factType);
    _json.put("attributes", attributes);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "update");
    _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 addComment(Long taskId, String userId, String comment, 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 . c o m
    JsonObject _json = new JsonObject();
    _json.put("taskId", taskId);
    _json.put("userId", userId);
    _json.put("comment", comment);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "addComment");
    _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 claim(Long taskId, String userId, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/* w ww  .  j ava2  s . co 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", "claim");
    _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 complete(Long taskId, String userId, JsonObject data, Handler<AsyncResult<Void>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/*from   www . j ava 2  s .  c om*/
    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", "complete");
    _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;
}