List of usage examples for io.vertx.core.json JsonObject put
public JsonObject put(String key, Object value)
From source file:io.hijynx.ensemble.identity.RoleServiceVertxEBProxy.java
License:Apache License
public RoleService revoke(String roleId, String privilegeId, Handler<AsyncResult<Void>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w w w . j a v a2 s. c o m*/ JsonObject _json = new JsonObject(); _json.put("roleId", roleId); _json.put("privilegeId", privilegeId); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "revoke"); _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 assign(String roleId, String userId, Handler<AsyncResult<Void>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from www .j av a 2 s .co m*/ JsonObject _json = new JsonObject(); _json.put("roleId", roleId); _json.put("userId", userId); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "assign"); _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 deassign(String roleId, String userId, Handler<AsyncResult<Void>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }// w ww. ja v a2 s. co m JsonObject _json = new JsonObject(); _json.put("roleId", roleId); _json.put("userId", userId); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "deassign"); _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.UserConverter.java
License:Apache License
public static void toJson(User obj, JsonObject json) { if (obj.getEmail() != null) { json.put("email", obj.getEmail()); }//from w w w . ja v a 2 s.co m if (obj.getFirstName() != null) { json.put("firstName", obj.getFirstName()); } if (obj.getLastName() != null) { json.put("lastName", obj.getLastName()); } if (obj.getUserId() != null) { json.put("userId", obj.getUserId()); } if (obj.getUsername() != null) { json.put("username", obj.getUsername()); } }
From source file:io.hijynx.ensemble.identity.UserServiceVertxEBProxy.java
License:Apache License
public UserService addUser(User user, Handler<AsyncResult<Void>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w ww .j a va 2s. c o m*/ JsonObject _json = new JsonObject(); _json.put("user", user == null ? null : user.toJson()); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "addUser"); _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.UserServiceVertxEBProxy.java
License:Apache License
public UserService retrieveUser(String id, Handler<AsyncResult<User>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/* w ww . j av a 2s . c o m*/ JsonObject _json = new JsonObject(); _json.put("id", id); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "retrieveUser"); _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 User(res.result().body()))); } }); return this; }
From source file:io.hijynx.ensemble.identity.UserServiceVertxEBProxy.java
License:Apache License
public UserService retrieveByUsername(String username, Handler<AsyncResult<User>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*ww w .ja v a 2 s . c o m*/ JsonObject _json = new JsonObject(); _json.put("username", username); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "retrieveByUsername"); _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 User(res.result().body()))); } }); return this; }
From source file:io.hijynx.ensemble.identity.UserServiceVertxEBProxy.java
License:Apache License
public UserService updateUser(User user, Handler<AsyncResult<User>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }// w w w . ja v a2 s.c o m JsonObject _json = new JsonObject(); _json.put("user", user == null ? null : user.toJson()); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "updateUser"); _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 User(res.result().body()))); } }); return this; }
From source file:io.hijynx.ensemble.identity.UserServiceVertxEBProxy.java
License:Apache License
public UserService deleteUser(String id, Handler<AsyncResult<Void>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }/*from w ww. j a v a 2s . c o m*/ JsonObject _json = new JsonObject(); _json.put("id", id); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "deleteUser"); _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.UserServiceVertxEBProxy.java
License:Apache License
public UserService updatePassword(String userId, String password, Handler<AsyncResult<Void>> resultHandler) { if (closed) { resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed"))); return this; }//from w w w . j a va2s . com JsonObject _json = new JsonObject(); _json.put("userId", userId); _json.put("password", password); DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions(); _deliveryOptions.addHeader("action", "updatePassword"); _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; }