use of org.eclipse.hono.util.TenantResult in project hono by eclipse.
the class BaseTenantService method processRemoveRequest.
private Future<EventBusMessage> processRemoveRequest(final EventBusMessage request) {
final String tenantId = request.getTenant();
if (tenantId == null) {
log.debug("request does not contain mandatory property [{}]", MessageHelper.APP_PROPERTY_TENANT_ID);
return Future.failedFuture(new ClientErrorException(HttpURLConnection.HTTP_BAD_REQUEST));
} else {
log.debug("deleting tenant [{}]", tenantId);
final Future<TenantResult<JsonObject>> removeResult = Future.future();
remove(tenantId, removeResult.completer());
return removeResult.map(tr -> {
return EventBusMessage.forStatusCode(tr.getStatus()).setJsonPayload(tr.getPayload()).setTenant(tenantId).setCacheDirective(tr.getCacheDirective());
});
}
}
Aggregations