public Builder withComment(String comments) { request.setComments(comments); return this; }
public Builder withComment(String comments) { request.setComments(comments); return this; }
public Object generate() throws SiteWhereException { DeviceCreateRequest request = new DeviceCreateRequest(); request.setComments(ExampleData.TRACKER.getComments() + " Updated."); return request; } }
public Builder(String deviceTypeToken, String token) { request.setDeviceTypeToken(deviceTypeToken); request.setToken(token); request.setStatus(null); request.setComments(""); }
public Builder(String siteToken, String specificationToken, String hardwareId) { request.setSiteToken(siteToken); request.setSpecificationToken(specificationToken); request.setHardwareId(hardwareId); request.setStatus(DeviceStatus.Ok); request.setComments(""); }
public Builder(IDevice api) { request.setSiteToken(api.getSiteToken()); request.setSpecificationToken(api.getSpecificationToken()); request.setHardwareId(api.getHardwareId()); request.setStatus(api.getStatus()); request.setComments(api.getComments()); request.setParentHardwareId(api.getParentHardwareId()); if (api.getDeviceElementMappings() != null) { request.setDeviceElementMappings(new ArrayList<DeviceElementMapping>()); request.getDeviceElementMappings().addAll(api.getDeviceElementMappings()); } if (api.getMetadata() != null) { request.setMetadata(new HashMap<String, String>()); request.getMetadata().putAll(api.getMetadata()); } }
public Object generate() throws SiteWhereException { DeviceCreateRequest request = new DeviceCreateRequest(); request.setSiteToken(ExampleData.SITE_CONSTRUCTION.getToken()); request.setSpecificationToken(ExampleData.SPEC_MEITRACK.getToken()); request.setHardwareId(ExampleData.TRACKER.getHardwareId()); request.setComments(ExampleData.TRACKER.getComments()); return request; } }
deviceCreate.setSpecificationToken(request.getSpecificationToken()); deviceCreate.setSiteToken(siteToken); deviceCreate.setComments("Device created by on-demand registration."); deviceCreate.setMetadata(request.getMetadata()); device = SiteWhere.getServer().getDeviceManagement(getTenant()).createDevice(deviceCreate);
/** * Convert device create request from GRPC to API. * * @param grpc * @return * @throws SiteWhereException */ public static DeviceCreateRequest asApiDeviceCreateRequest(GDeviceCreateRequest grpc) throws SiteWhereException { DeviceCreateRequest api = new DeviceCreateRequest(); api.setToken(grpc.hasToken() ? grpc.getToken().getValue() : null); api.setParentDeviceToken(grpc.hasParentDeviceToken() ? grpc.getParentDeviceToken().getValue() : null); api.setDeviceTypeToken(grpc.hasDeviceTypeToken() ? grpc.getDeviceTypeToken().getValue() : null); api.setStatus(grpc.hasStatus() ? grpc.getStatus().getValue() : null); api.setComments(grpc.hasComments() ? grpc.getComments().getValue() : null); api.setDeviceElementMappings( DeviceModelConverter.asApiDeviceElementMappings(grpc.getDeviceElementMappingsList())); api.setMetadata(grpc.getMetadataMap()); return api; }
deviceCreate.setDeviceElementMappings(request.getDeviceElementMappings()); deviceCreate.setParentDeviceToken(request.getParentDeviceToken()); deviceCreate.setComments(request.getComments() != null ? request.getComments() : "Device created by on-demand registration."); deviceCreate.setMetadata(request.getMetadata());