@Override public IDevice createDevice(IDeviceCreateRequest device) throws SiteWhereException { return delegate.createDevice(device); }
deviceCreate.setComments("Device created by on-demand registration."); deviceCreate.setMetadata(request.getMetadata()); device = SiteWhere.getServer().getDeviceManagement(getTenant()).createDevice(deviceCreate); } else if (!device.getSpecificationToken().equals(request.getSpecificationToken())) { LOGGER.info("Found existing device registration, but specification does not match.");
@Override public IDevice createDevice(IDeviceCreateRequest device) throws SiteWhereException { return getDelegate().createDevice(device); }
/** * Persist a previously created device. * * @param builder * @return * @throws SiteWhereException */ public IDevice persist(DeviceCreateRequest.Builder builder) throws SiteWhereException { return getDeviceManagement().createDevice(builder.build()); }
public IDevice persist(DeviceCreateRequest.Builder builder) throws SiteWhereException { return getDeviceManagement().createDevice(builder.build()); }
@Override public void createDevice(GCreateDeviceRequest request, StreamObserver<GCreateDeviceResponse> responseObserver) { try { GrpcUtils.handleServerMethodEntry(this, DeviceManagementGrpc.getCreateDeviceMethod()); IDeviceCreateRequest apiRequest = DeviceModelConverter.asApiDeviceCreateRequest(request.getRequest()); IDevice apiResult = getDeviceManagement().createDevice(apiRequest); GCreateDeviceResponse.Builder response = GCreateDeviceResponse.newBuilder(); response.setDevice(DeviceModelConverter.asGrpcDevice(apiResult)); responseObserver.onNext(response.build()); responseObserver.onCompleted(); } catch (Throwable e) { GrpcUtils.handleServerMethodException(DeviceManagementGrpc.getCreateDeviceMethod(), e, responseObserver); } finally { GrpcUtils.handleServerMethodExit(DeviceManagementGrpc.getCreateDeviceMethod()); } }
/** * Create a device. * * @param request * @return */ @RequestMapping(method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "Create new device") @Secured({ SiteWhereRoles.REST }) @Documented(examples = { @Example(stage = Stage.Request, json = Devices.CreateDeviceRequest.class, description = "createDeviceGroupRequest.md"), @Example(stage = Stage.Response, json = Devices.CreateDeviceResponse.class, description = "createDeviceGroupResponse.md") }) public IDevice createDevice(@RequestBody DeviceCreateRequest request, HttpServletRequest servletRequest) throws SiteWhereException { Tracer.start(TracerCategory.RestApiCall, "createDevice", LOGGER); try { IDevice result = SiteWhere.getServer().getDeviceManagement(getTenant(servletRequest)).createDevice(request); DeviceMarshalHelper helper = new DeviceMarshalHelper(getTenant(servletRequest)); helper.setIncludeAsset(false); helper.setIncludeAssignment(false); return helper.convert(result, SiteWhere.getServer().getAssetModuleManager(getTenant(servletRequest))); } finally { Tracer.stop(LOGGER); } }
: "Device created by on-demand registration."); deviceCreate.setMetadata(request.getMetadata()); return getDeviceManagement().createDevice(deviceCreate); } else { getLogger().info("Found existing device registration. Updating device information.");