@Override public IDeviceCommand updateDeviceCommand(String token, IDeviceCommandCreateRequest request) throws SiteWhereException { return delegate.updateDeviceCommand(token, request); }
@Override public IDeviceCommand updateDeviceCommand(UUID id, IDeviceCommandCreateRequest request) throws SiteWhereException { return getDelegate().updateDeviceCommand(id, request); }
/** * Update an existing device command. * * @param token * @param request * @return * @throws SiteWhereException */ @RequestMapping(value = "/{token}", method = RequestMethod.PUT) @ResponseBody @ApiOperation(value = "Update an existing device command") @Secured({ SiteWhereRoles.REST }) @Documented(examples = { @Example(stage = Stage.Request, json = Commands.DeviceCommandUpdateRequest.class, description = "updateDeviceCommandRequest.md"), @Example(stage = Stage.Response, json = Commands.DeviceCommandUpdateResponse.class, description = "updateDeviceCommandResponse.md") }) public IDeviceCommand updateDeviceCommand(@ApiParam(value = "Token", required = true) @PathVariable String token, @RequestBody DeviceCommandCreateRequest request, HttpServletRequest servletRequest) throws SiteWhereException { Tracer.start(TracerCategory.RestApiCall, "updateDeviceCommand", LOGGER); try { return SiteWhere.getServer().getDeviceManagement(getTenant(servletRequest)).updateDeviceCommand(token, request); } finally { Tracer.stop(LOGGER); } }
@Override public void updateDeviceCommand(GUpdateDeviceCommandRequest request, StreamObserver<GUpdateDeviceCommandResponse> responseObserver) { try { GrpcUtils.handleServerMethodEntry(this, DeviceManagementGrpc.getUpdateDeviceCommandMethod()); IDeviceCommandCreateRequest apiRequest = DeviceModelConverter .asApiDeviceCommandCreateRequest(request.getRequest()); IDeviceCommand apiResult = getDeviceManagement() .updateDeviceCommand(CommonModelConverter.asApiUuid(request.getId()), apiRequest); GUpdateDeviceCommandResponse.Builder response = GUpdateDeviceCommandResponse.newBuilder(); response.setCommand(DeviceModelConverter.asGrpcDeviceCommand(apiResult)); responseObserver.onNext(response.build()); responseObserver.onCompleted(); } catch (Throwable e) { GrpcUtils.handleServerMethodException(DeviceManagementGrpc.getUpdateDeviceCommandMethod(), e, responseObserver); } finally { GrpcUtils.handleServerMethodExit(DeviceManagementGrpc.getUpdateDeviceCommandMethod()); } }