作者:名禅 | 来源:互联网 | 2023-08-23 11:31
本文整理了Java中com.sitewhere.spi.device.IDeviceManagement.getCustomerByToken()方法的一些代码示例,展
本文整理了Java中com.sitewhere.spi.device.IDeviceManagement.getCustomerByToken()
方法的一些代码示例,展示了IDeviceManagement.getCustomerByToken()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IDeviceManagement.getCustomerByToken()
方法的具体详情如下:
包路径:com.sitewhere.spi.device.IDeviceManagement
类名称:IDeviceManagement
方法名:getCustomerByToken
IDeviceManagement.getCustomerByToken介绍
[英]Get a customer by alias token.
[中]通过别名令牌获取客户。
代码示例
代码示例来源:origin: sitewhere/sitewhere
@Override
public ICustomer getCustomerByToken(String token) throws SiteWhereException {
return getDelegate().getCustomerByToken(token);
}
代码示例来源:origin: sitewhere/sitewhere
/**
* Get customer that should be used for the given request.
*
* @param registration
* @return
* @throws SiteWhereException
*/
protected ICustomer getCustomerFor(IDeviceRegistrationPayload registration) throws SiteWhereException {
String customerToken = registration.getDeviceRegistrationRequest().getCustomerToken();
if (customerToken != null) {
ICustomer override = getDeviceManagement().getCustomerByToken(customerToken);
if (override == null) {
throw new SiteWhereException("Registration request specified invalid customer token.");
}
return override;
} else if (isUseDefaultCustomer()) {
return getDefaultCustomer();
}
return null;
}
代码示例来源:origin: sitewhere/sitewhere
@Override
public void getCustomerByToken(GGetCustomerByTokenRequest request,
StreamObserver responseObserver) {
try {
GrpcUtils.handleServerMethodEntry(this, DeviceManagementGrpc.getGetCustomerByTokenMethod());
ICustomer apiResult = getDeviceManagement().getCustomerByToken(request.getToken());
GGetCustomerByTokenResponse.Builder respOnse= GGetCustomerByTokenResponse.newBuilder();
if (apiResult != null) {
response.setCustomer(DeviceModelConverter.asGrpcCustomer(apiResult));
}
responseObserver.onNext(response.build());
responseObserver.onCompleted();
} catch (Throwable e) {
GrpcUtils.handleServerMethodException(DeviceManagementGrpc.getGetCustomerByTokenMethod(), e,
responseObserver);
} finally {
GrpcUtils.handleServerMethodExit(DeviceManagementGrpc.getGetCustomerByTokenMethod());
}
}
代码示例来源:origin: sitewhere/sitewhere
ICustomer customer = getDeviceManagement().getCustomerByToken(getDefaultCustomerToken());
if (customer == null) {
throw new SiteWhereException("Registration manager auto assignment customer is invalid.");