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

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

Introduction

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

Prototype

public JsonObject() 

Source Link

Document

Create a new, empty instance

Usage

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;
    }//  w w  w. java  2s  .  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;
    }/*from  w  w w  . j a  v a2  s. co 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 fireAllRules(Handler<AsyncResult<Integer>> handler) {
    if (closed) {
        handler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/*from   ww w . ja  va2  s .  com*/
    JsonObject _json = new JsonObject();
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "fireAllRules");
    _vertx.eventBus().<Integer>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;
    }/*from   w  w w  .j  a  va2s  . c  o  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 w  w  .j av a2s  . c om
    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  om
    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 ww  .ja  v a  2s  .  co  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;
    }//from w  ww.ja va 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", "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   w w w. j  a v 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", "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;
}

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 v  a2  s . 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;
}