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); } }); }