private void getObject( final DeleteObjectRequest request, final HttpServerResponse response, final String obj, final String notExists, final JsonObject context, final Consumer<Boolean> onResult) { objectStorage.getObject( request.getType(), request.getId(), ScopeUtils.getScope(request.getScope()), new FutureCallback<ObjectDO>() { @Override public void onSuccess(ObjectDO result) { if (result != null) { onResult.accept(true); } else { HttpHelper.processResponse( "Object with id: " + request.getId() + " does not exist", response, HttpResponseStatus.BAD_REQUEST.code()); context.put(obj, notExists); onResult.accept(true); } } @Override public void onFailure(Throwable t) { context.put(obj, notExists); onResult.accept(true); } }); }
private void deleteObject( DeleteObjectRequest request, final HttpServerResponse response, final Consumer<Boolean> onResult) { objectStorage.deleteObject( request.getType(), request.getId(), ScopeUtils.getScope(request.getScope()), new FutureCallback<ResultSet>() { @Override public void onSuccess(ResultSet result) { HttpHelper.processResponse(response); onResult.accept(true); } @Override public void onFailure(Throwable t) { logger.error("object delete failed with ", t); HttpHelper.processResponse(response, HttpResponseStatus.INTERNAL_SERVER_ERROR.code()); onResult.accept(false); } }); }
private void deleteConnections(final DeleteObjectRequest request) { connectionStorage.deleteConnection( request.getType(), request.getId(), ScopeUtils.getScope(request.getScope()), new FutureCallback<ResultSet>() { @Override public void onSuccess(ResultSet result) { logger.info( "Successfully deleted connections for type: {} and id: {}", request.getType(), request.getId()); } @Override public void onFailure(Throwable t) { logger.error( "Failed to delete connections for type:{}, id:{} with ex:{}", request.getType(), request.getId(), t); } }); }