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:io.hijynx.ensemble.identity.PrivilegeServiceVertxEBProxy.java

License:Apache License

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

From source file:io.hijynx.ensemble.identity.RoleConverter.java

License:Apache License

public static void toJson(Role obj, JsonObject json) {
    if (obj.getDescription() != null) {
        json.put("description", obj.getDescription());
    }//from   www .  j  a  v a 2  s . com
    if (obj.getRoleId() != null) {
        json.put("roleId", obj.getRoleId());
    }
    if (obj.getRoleName() != null) {
        json.put("roleName", obj.getRoleName());
    }
}

From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java

License:Apache License

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

From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java

License:Apache License

public RoleService retrieveRole(String id, Handler<AsyncResult<Role>> resultHandler) {
    if (closed) {
        resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }//from   ww  w  .  jav  a2s. c  om
    JsonObject _json = new JsonObject();
    _json.put("id", id);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "retrieveRole");
    _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            resultHandler.handle(Future.failedFuture(res.cause()));
        } else {
            resultHandler.handle(
                    Future.succeededFuture(res.result().body() == null ? null : new Role(res.result().body())));
        }
    });
    return this;
}

From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java

License:Apache License

public RoleService retrieveRoleByName(String rolename, Handler<AsyncResult<Role>> resultHandler) {
    if (closed) {
        resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }// w w w .  jav  a2s.  co m
    JsonObject _json = new JsonObject();
    _json.put("rolename", rolename);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "retrieveRoleByName");
    _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            resultHandler.handle(Future.failedFuture(res.cause()));
        } else {
            resultHandler.handle(
                    Future.succeededFuture(res.result().body() == null ? null : new Role(res.result().body())));
        }
    });
    return this;
}

From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java

License:Apache License

public RoleService updateRole(Role role, Handler<AsyncResult<Role>> resultHandler) {
    if (closed) {
        resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/*from   ww  w. java 2 s  . com*/
    JsonObject _json = new JsonObject();
    _json.put("role", role == null ? null : role.toJson());
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "updateRole");
    _vertx.eventBus().<JsonObject>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            resultHandler.handle(Future.failedFuture(res.cause()));
        } else {
            resultHandler.handle(
                    Future.succeededFuture(res.result().body() == null ? null : new Role(res.result().body())));
        }
    });
    return this;
}

From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java

License:Apache License

public RoleService deleteRole(String id, Handler<AsyncResult<Void>> resultHandler) {
    if (closed) {
        resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }/*from  www . j a  v a  2  s .co m*/
    JsonObject _json = new JsonObject();
    _json.put("id", id);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "deleteRole");
    _vertx.eventBus().<Void>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            resultHandler.handle(Future.failedFuture(res.cause()));
        } else {
            resultHandler.handle(Future.succeededFuture(res.result().body()));
        }
    });
    return this;
}

From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java

License:Apache License

public RoleService retrieveAssignedMembers(String roleId, Handler<AsyncResult<List<String>>> resultHandler) {
    if (closed) {
        resultHandler.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("roleId", roleId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "retrieveAssignedMembers");
    _vertx.eventBus().<JsonArray>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            resultHandler.handle(Future.failedFuture(res.cause()));
        } else {
            resultHandler.handle(Future.succeededFuture(convertList(res.result().body().getList())));
        }
    });
    return this;
}

From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java

License:Apache License

public RoleService retrieveAssignedPrivileges(String roleId, Handler<AsyncResult<List<String>>> resultHandler) {
    if (closed) {
        resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
        return this;
    }//w  w  w.java  2  s .c o  m
    JsonObject _json = new JsonObject();
    _json.put("roleId", roleId);
    DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options)
            : new DeliveryOptions();
    _deliveryOptions.addHeader("action", "retrieveAssignedPrivileges");
    _vertx.eventBus().<JsonArray>send(_address, _json, _deliveryOptions, res -> {
        if (res.failed()) {
            resultHandler.handle(Future.failedFuture(res.cause()));
        } else {
            resultHandler.handle(Future.succeededFuture(convertList(res.result().body().getList())));
        }
    });
    return this;
}

From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java

License:Apache License

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