@Override public IDeviceCommand createDeviceCommand(IDeviceSpecification spec, IDeviceCommandCreateRequest request) throws SiteWhereException { return delegate.createDeviceCommand(spec, request); }
@Override public IDeviceCommand createDeviceCommand(IDeviceCommandCreateRequest request) throws SiteWhereException { return getDelegate().createDeviceCommand(request); }
/** * Persist a previously created command. * * @param builder * @return * @throws SiteWhereException */ public IDeviceCommand persist(DeviceCommandCreateRequest.Builder builder) throws SiteWhereException { return getDeviceManagement().createDeviceCommand(builder.build()); }
public IDeviceCommand persist(IDeviceSpecification specification, DeviceCommandCreateRequest.Builder builder) throws SiteWhereException { return getDeviceManagement().createDeviceCommand(specification, builder.build()); }
/** * Create a device specification. * * @param request * @return */ @RequestMapping(value = "/{token}/commands", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "Create device command for specification.") @Secured({ SiteWhereRoles.REST }) @Documented(examples = { @Example(stage = Stage.Request, json = Specifications.CreateDeviceCommandRequest.class, description = "createDeviceCommandRequest.md"), @Example(stage = Stage.Response, json = Specifications.CreateDeviceCommandResponse.class, description = "createDeviceCommandResponse.md") }) public IDeviceCommand createDeviceCommand(@ApiParam(value = "Token", required = true) @PathVariable String token, @RequestBody DeviceCommandCreateRequest request, HttpServletRequest servletRequest) throws SiteWhereException { Tracer.start(TracerCategory.RestApiCall, "createDeviceCommand", LOGGER); try { IDeviceSpecification spec = assertDeviceSpecificationByToken(token, servletRequest); IDeviceCommand result = SiteWhere.getServer().getDeviceManagement(getTenant(servletRequest)) .createDeviceCommand(spec, request); return result; } finally { Tracer.stop(LOGGER); } }
@Override public void createDeviceCommand(GCreateDeviceCommandRequest request, StreamObserver<GCreateDeviceCommandResponse> responseObserver) { try { GrpcUtils.handleServerMethodEntry(this, DeviceManagementGrpc.getCreateDeviceCommandMethod()); IDeviceCommandCreateRequest apiRequest = DeviceModelConverter .asApiDeviceCommandCreateRequest(request.getRequest()); IDeviceCommand apiResult = getDeviceManagement().createDeviceCommand(apiRequest); GCreateDeviceCommandResponse.Builder response = GCreateDeviceCommandResponse.newBuilder(); response.setCommand(DeviceModelConverter.asGrpcDeviceCommand(apiResult)); responseObserver.onNext(response.build()); responseObserver.onCompleted(); } catch (Throwable e) { GrpcUtils.handleServerMethodException(DeviceManagementGrpc.getCreateDeviceCommandMethod(), e, responseObserver); } finally { GrpcUtils.handleServerMethodExit(DeviceManagementGrpc.getCreateDeviceCommandMethod()); } }