@Override public IDevice deleteDevice(String hardwareId, boolean force) throws SiteWhereException { return delegate.deleteDevice(hardwareId, force); }
@Override public IDevice deleteDevice(UUID id) throws SiteWhereException { return getDelegate().deleteDevice(id); }
@Override public void deleteDevice(GDeleteDeviceRequest request, StreamObserver<GDeleteDeviceResponse> responseObserver) { try { GrpcUtils.handleServerMethodEntry(this, DeviceManagementGrpc.getDeleteDeviceMethod()); IDevice apiResult = getDeviceManagement().deleteDevice(CommonModelConverter.asApiUuid(request.getId())); GDeleteDeviceResponse.Builder response = GDeleteDeviceResponse.newBuilder(); response.setDevice(DeviceModelConverter.asGrpcDevice(apiResult)); responseObserver.onNext(response.build()); responseObserver.onCompleted(); } catch (Throwable e) { GrpcUtils.handleServerMethodException(DeviceManagementGrpc.getDeleteDeviceMethod(), e, responseObserver); } finally { GrpcUtils.handleServerMethodExit(DeviceManagementGrpc.getDeleteDeviceMethod()); } }
/** * Delete device identified by hardware id. * * @param hardwareId * @return */ @RequestMapping(value = "/{hardwareId}", method = RequestMethod.DELETE) @ResponseBody @ApiOperation(value = "Delete device based on unique hardware id") @Secured({ SiteWhereRoles.REST }) @Documented(examples = { @Example(stage = Stage.Response, json = Devices.CreateDeviceResponse.class, description = "deleteDeviceResponse.md") }) public IDevice deleteDevice(@ApiParam(value = "Hardware id", required = true) @PathVariable String hardwareId, @ApiParam(value = "Delete permanently", required = false) @RequestParam(defaultValue = "false") boolean force, HttpServletRequest servletRequest) throws SiteWhereException { Tracer.start(TracerCategory.RestApiCall, "deleteDevice", LOGGER); try { IDevice result = SiteWhere.getServer().getDeviceManagement(getTenant(servletRequest)) .deleteDevice(hardwareId, force); DeviceMarshalHelper helper = new DeviceMarshalHelper(getTenant(servletRequest)); helper.setIncludeAsset(true); helper.setIncludeAssignment(true); return helper.convert(result, SiteWhere.getServer().getAssetModuleManager(getTenant(servletRequest))); } finally { Tracer.stop(LOGGER); } }