public Builder(String token, String name) { request.setToken(token); request.setName(name); request.setContainerPolicy(DeviceContainerPolicy.Standalone); }
public Builder withDescription(String description) { request.setDescription(description); return this; }
public Builder metadata(String name, String value) { if (request.getMetadata() == null) { request.setMetadata(new HashMap<String, String>()); } request.getMetadata().put(name, value); return this; }
/** * Convert device type create request from GRPC to API. * * @param grpc * @return * @throws SiteWhereException */ public static IDeviceTypeCreateRequest asApiDeviceTypeCreateRequest(GDeviceTypeCreateRequest grpc) throws SiteWhereException { DeviceTypeCreateRequest api = new DeviceTypeCreateRequest(); api.setToken(grpc.hasToken() ? grpc.getToken().getValue() : null); api.setName(grpc.hasName() ? grpc.getName().getValue() : null); api.setDescription(grpc.hasDescription() ? grpc.getDescription().getValue() : null); api.setContainerPolicy(DeviceModelConverter.asApiDeviceContainerPolicy(grpc.getContainerPolicy())); api.setDeviceElementSchema(DeviceModelConverter.asApiDeviceElementSchema(grpc.getDeviceElementSchema())); api.setMetadata(grpc.getMetadataMap()); CommonModelConverter.setBrandingInformation(api, grpc.getBranding()); return api; }
public Builder makeComposite() { request.setContainerPolicy(DeviceContainerPolicy.Composite); return this; }
public DeviceElementSchemaBuilder newSchema() { DeviceElementSchemaBuilder schema = new DeviceElementSchemaBuilder(); request.setDeviceElementSchema(schema.build()); return schema; }
public Builder withImageUrl(String imageUrl) { request.setImageUrl(imageUrl); return this; }