本文整理汇总了Java中de.fraunhofer.iosb.ilt.sta.model.Datastream.setSensor方法的典型用法代码示例。如果您正苦于以下问题:Java Datastream.setSensor方法的具体用法?Java Datastream.setSensor怎么用?Java Datastream.setSensor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.fraunhofer.iosb.ilt.sta.model.Datastream
的用法示例。
在下文中一共展示了Datastream.setSensor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertSensor
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
public boolean insertSensor(Sensor s) throws NoSuchEntityException, IncompleteEntityException {
SQLQueryFactory qFactory = pm.createQueryFactory();
QSensors qs = QSensors.sensors;
SQLInsertClause insert = qFactory.insert(qs);
insert.set(qs.name, s.getName());
insert.set(qs.description, s.getDescription());
insert.set(qs.encodingType, s.getEncodingType());
// TODO: Check metadata serialisation.
insert.set(qs.metadata, s.getMetadata().toString());
insert.set(qs.properties, objectToJson(s.getProperties()));
UUID generatedId = insert.executeWithKey(qs.id);
LOGGER.info("Inserted Sensor. Created id = {}.", generatedId);
s.setId(new UuidId(generatedId));
// Create new datastreams, if any.
for (Datastream ds : s.getDatastreams()) {
ds.setSensor(new SensorBuilder().setId(s.getId()).build());
ds.complete();
pm.insert(ds);
}
return true;
}
示例2: insertSensor
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
public boolean insertSensor(Sensor s) throws NoSuchEntityException, IncompleteEntityException {
SQLQueryFactory qFactory = pm.createQueryFactory();
QSensors qs = QSensors.sensors;
SQLInsertClause insert = qFactory.insert(qs);
insert.set(qs.name, s.getName());
insert.set(qs.description, s.getDescription());
insert.set(qs.encodingType, s.getEncodingType());
// TODO: Check metadata serialisation.
insert.set(qs.metadata, s.getMetadata().toString());
insert.set(qs.properties, objectToJson(s.getProperties()));
Long generatedId = insert.executeWithKey(qs.id);
LOGGER.info("Inserted Sensor. Created id = {}.", generatedId);
s.setId(new LongId(generatedId));
// Create new datastreams, if any.
for (Datastream ds : s.getDatastreams()) {
ds.setSensor(new SensorBuilder().setId(s.getId()).build());
ds.complete();
pm.insert(ds);
}
return true;
}
示例3: insertSensor
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
public boolean insertSensor(Sensor s) throws NoSuchEntityException, IncompleteEntityException {
SQLQueryFactory qFactory = pm.createQueryFactory();
QSensors qs = QSensors.sensors;
SQLInsertClause insert = qFactory.insert(qs);
insert.set(qs.name, s.getName());
insert.set(qs.description, s.getDescription());
insert.set(qs.encodingType, s.getEncodingType());
// TODO: Check metadata serialisation.
insert.set(qs.metadata, s.getMetadata().toString());
insert.set(qs.properties, objectToJson(s.getProperties()));
String generatedId = insert.executeWithKey(qs.id);
LOGGER.info("Inserted Sensor. Created id = {}.", generatedId);
s.setId(new StringId(generatedId));
// Create new datastreams, if any.
for (Datastream ds : s.getDatastreams()) {
ds.setSensor(new SensorBuilder().setId(s.getId()).build());
ds.complete();
pm.insert(ds);
}
return true;
}
示例4: create
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
@Override
public Datastream create(Tuple tuple, Query query, DataSize dataSize) {
Set<Property> select = query == null ? Collections.emptySet() : query.getSelect();
Datastream entity = new Datastream();
entity.setName(tuple.get(qInstance.name));
entity.setDescription(tuple.get(qInstance.description));
UUID id = tuple.get(qInstance.id);
if (id != null) {
entity.setId(new UuidId(tuple.get(qInstance.id)));
}
entity.setObservationType(tuple.get(qInstance.observationType));
String observedArea = tuple.get(qInstance.observedArea.asText());
if (observedArea != null) {
try {
Polygon polygon = GeoHelper.parsePolygon(observedArea);
entity.setObservedArea(polygon);
} catch (IllegalArgumentException e) {
// It's not a polygon, probably a point or a line.
}
}
ObservedProperty op = observedProperyFromId(tuple.get(qInstance.obsPropertyId));
entity.setObservedProperty(op);
Timestamp pTimeStart = tuple.get(qInstance.phenomenonTimeStart);
Timestamp pTimeEnd = tuple.get(qInstance.phenomenonTimeEnd);
if (pTimeStart != null && pTimeEnd != null) {
entity.setPhenomenonTime(intervalFromTimes(pTimeStart, pTimeEnd));
}
Timestamp rTimeStart = tuple.get(qInstance.resultTimeStart);
Timestamp rTimeEnd = tuple.get(qInstance.resultTimeEnd);
if (rTimeStart != null && rTimeEnd != null) {
entity.setResultTime(intervalFromTimes(rTimeStart, rTimeEnd));
}
if (select.isEmpty() || select.contains(EntityProperty.Properties)) {
String props = tuple.get(qInstance.properties);
entity.setProperties(jsonToObject(props, Map.class));
}
entity.setSensor(sensorFromId(tuple.get(qInstance.sensorId)));
entity.setThing(thingFromId(tuple.get(qInstance.thingId)));
entity.setUnitOfMeasurement(new UnitOfMeasurement(tuple.get(qInstance.unitName), tuple.get(qInstance.unitSymbol), tuple.get(qInstance.unitDefinition)));
return entity;
}
示例5: create
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
@Override
public Datastream create(Tuple tuple, Query query, DataSize dataSize) {
Set<Property> select = query == null ? Collections.emptySet() : query.getSelect();
Datastream entity = new Datastream();
entity.setName(tuple.get(qInstance.name));
entity.setDescription(tuple.get(qInstance.description));
Long id = tuple.get(qInstance.id);
if (id != null) {
entity.setId(new LongId(tuple.get(qInstance.id)));
}
entity.setObservationType(tuple.get(qInstance.observationType));
String observedArea = tuple.get(qInstance.observedArea.asText());
if (observedArea != null) {
try {
Polygon polygon = GeoHelper.parsePolygon(observedArea);
entity.setObservedArea(polygon);
} catch (IllegalArgumentException e) {
// It's not a polygon, probably a point or a line.
}
}
ObservedProperty op = observedProperyFromId(tuple.get(qInstance.obsPropertyId));
entity.setObservedProperty(op);
Timestamp pTimeStart = tuple.get(qInstance.phenomenonTimeStart);
Timestamp pTimeEnd = tuple.get(qInstance.phenomenonTimeEnd);
if (pTimeStart != null && pTimeEnd != null) {
entity.setPhenomenonTime(intervalFromTimes(pTimeStart, pTimeEnd));
}
Timestamp rTimeStart = tuple.get(qInstance.resultTimeStart);
Timestamp rTimeEnd = tuple.get(qInstance.resultTimeEnd);
if (rTimeStart != null && rTimeEnd != null) {
entity.setResultTime(intervalFromTimes(rTimeStart, rTimeEnd));
}
if (select.isEmpty() || select.contains(EntityProperty.Properties)) {
String props = tuple.get(qInstance.properties);
entity.setProperties(jsonToObject(props, Map.class));
}
entity.setSensor(sensorFromId(tuple.get(qInstance.sensorId)));
entity.setThing(thingFromId(tuple.get(qInstance.thingId)));
entity.setUnitOfMeasurement(new UnitOfMeasurement(tuple.get(qInstance.unitName), tuple.get(qInstance.unitSymbol), tuple.get(qInstance.unitDefinition)));
return entity;
}
示例6: create
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
@Override
public Datastream create(Tuple tuple, Query query, DataSize dataSize) {
Set<Property> select = query == null ? Collections.emptySet() : query.getSelect();
Datastream entity = new Datastream();
entity.setName(tuple.get(qInstance.name));
entity.setDescription(tuple.get(qInstance.description));
String id = tuple.get(qInstance.id);
if (id != null) {
entity.setId(new StringId(tuple.get(qInstance.id)));
}
entity.setObservationType(tuple.get(qInstance.observationType));
String observedArea = tuple.get(qInstance.observedArea.asText());
if (observedArea != null) {
try {
Polygon polygon = GeoHelper.parsePolygon(observedArea);
entity.setObservedArea(polygon);
} catch (IllegalArgumentException e) {
// It's not a polygon, probably a point or a line.
}
}
ObservedProperty op = observedProperyFromId(tuple.get(qInstance.obsPropertyId));
entity.setObservedProperty(op);
Timestamp pTimeStart = tuple.get(qInstance.phenomenonTimeStart);
Timestamp pTimeEnd = tuple.get(qInstance.phenomenonTimeEnd);
if (pTimeStart != null && pTimeEnd != null) {
entity.setPhenomenonTime(intervalFromTimes(pTimeStart, pTimeEnd));
}
Timestamp rTimeStart = tuple.get(qInstance.resultTimeStart);
Timestamp rTimeEnd = tuple.get(qInstance.resultTimeEnd);
if (rTimeStart != null && rTimeEnd != null) {
entity.setResultTime(intervalFromTimes(rTimeStart, rTimeEnd));
}
if (select.isEmpty() || select.contains(EntityProperty.Properties)) {
String props = tuple.get(qInstance.properties);
entity.setProperties(jsonToObject(props, Map.class));
}
entity.setSensor(sensorFromId(tuple.get(qInstance.sensorId)));
entity.setThing(thingFromId(tuple.get(qInstance.thingId)));
entity.setUnitOfMeasurement(new UnitOfMeasurement(tuple.get(qInstance.unitName), tuple.get(qInstance.unitSymbol), tuple.get(qInstance.unitDefinition)));
return entity;
}