本文整理汇总了Java中de.fraunhofer.iosb.ilt.sta.model.Datastream.setId方法的典型用法代码示例。如果您正苦于以下问题:Java Datastream.setId方法的具体用法?Java Datastream.setId怎么用?Java Datastream.setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.fraunhofer.iosb.ilt.sta.model.Datastream
的用法示例。
在下文中一共展示了Datastream.setId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: datastreamFromId
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
private static Datastream datastreamFromId(UUID id) {
if (id == null) {
return null;
}
Datastream ds = new Datastream();
ds.setId(new UuidId(id));
ds.setExportObject(false);
return ds;
}
示例2: datastreamFromId
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
private static Datastream datastreamFromId(Long id) {
if (id == null) {
return null;
}
Datastream ds = new Datastream();
ds.setId(new LongId(id));
ds.setExportObject(false);
return ds;
}
示例3: datastreamFromId
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
private static Datastream datastreamFromId(String id) {
if (id == null) {
return null;
}
Datastream ds = new Datastream();
ds.setId(new StringId(id));
ds.setExportObject(false);
return ds;
}
示例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: insertDatastream
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
public boolean insertDatastream(Datastream ds) throws NoSuchEntityException, IncompleteEntityException {
// First check ObservedPropery, Sensor and Thing
ObservedProperty op = ds.getObservedProperty();
entityExistsOrCreate(op);
Sensor s = ds.getSensor();
entityExistsOrCreate(s);
Thing t = ds.getThing();
entityExistsOrCreate(t);
SQLQueryFactory qFactory = pm.createQueryFactory();
QDatastreams qd = QDatastreams.datastreams;
SQLInsertClause insert = qFactory.insert(qd);
insert.set(qd.name, ds.getName());
insert.set(qd.description, ds.getDescription());
insert.set(qd.observationType, ds.getObservationType());
insert.set(qd.unitDefinition, ds.getUnitOfMeasurement().getDefinition());
insert.set(qd.unitName, ds.getUnitOfMeasurement().getName());
insert.set(qd.unitSymbol, ds.getUnitOfMeasurement().getSymbol());
insert.set(qd.properties, objectToJson(ds.getProperties()));
insert.set(qd.phenomenonTimeStart, new Timestamp(PostgresPersistenceManagerUuid.DATETIME_MAX.getMillis()));
insert.set(qd.phenomenonTimeEnd, new Timestamp(PostgresPersistenceManagerUuid.DATETIME_MIN.getMillis()));
insert.set(qd.resultTimeStart, new Timestamp(PostgresPersistenceManagerUuid.DATETIME_MAX.getMillis()));
insert.set(qd.resultTimeEnd, new Timestamp(PostgresPersistenceManagerUuid.DATETIME_MIN.getMillis()));
insert.set(qd.obsPropertyId, (UUID) op.getId().getValue());
insert.set(qd.sensorId, (UUID) s.getId().getValue());
insert.set(qd.thingId, (UUID) t.getId().getValue());
UUID datastreamId = insert.executeWithKey(qd.id);
LOGGER.info("Inserted datastream. Created id = {}.", datastreamId);
ds.setId(new UuidId(datastreamId));
// Create Observations, if any.
for (Observation o : ds.getObservations()) {
o.setDatastream(new DatastreamBuilder().setId(ds.getId()).build());
o.complete();
pm.insert(o);
}
return true;
}
示例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));
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;
}
示例7: insertDatastream
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
public boolean insertDatastream(Datastream ds) throws NoSuchEntityException, IncompleteEntityException {
// First check ObservedPropery, Sensor and Thing
ObservedProperty op = ds.getObservedProperty();
entityExistsOrCreate(op);
Sensor s = ds.getSensor();
entityExistsOrCreate(s);
Thing t = ds.getThing();
entityExistsOrCreate(t);
SQLQueryFactory qFactory = pm.createQueryFactory();
QDatastreams qd = QDatastreams.datastreams;
SQLInsertClause insert = qFactory.insert(qd);
insert.set(qd.name, ds.getName());
insert.set(qd.description, ds.getDescription());
insert.set(qd.observationType, ds.getObservationType());
insert.set(qd.unitDefinition, ds.getUnitOfMeasurement().getDefinition());
insert.set(qd.unitName, ds.getUnitOfMeasurement().getName());
insert.set(qd.unitSymbol, ds.getUnitOfMeasurement().getSymbol());
insert.set(qd.properties, objectToJson(ds.getProperties()));
insert.set(qd.phenomenonTimeStart, new Timestamp(PostgresPersistenceManagerLong.DATETIME_MAX.getMillis()));
insert.set(qd.phenomenonTimeEnd, new Timestamp(PostgresPersistenceManagerLong.DATETIME_MIN.getMillis()));
insert.set(qd.resultTimeStart, new Timestamp(PostgresPersistenceManagerLong.DATETIME_MAX.getMillis()));
insert.set(qd.resultTimeEnd, new Timestamp(PostgresPersistenceManagerLong.DATETIME_MIN.getMillis()));
insert.set(qd.obsPropertyId, (Long) op.getId().getValue());
insert.set(qd.sensorId, (Long) s.getId().getValue());
insert.set(qd.thingId, (Long) t.getId().getValue());
Long datastreamId = insert.executeWithKey(qd.id);
LOGGER.info("Inserted datastream. Created id = {}.", datastreamId);
ds.setId(new LongId(datastreamId));
// Create Observations, if any.
for (Observation o : ds.getObservations()) {
o.setDatastream(new DatastreamBuilder().setId(ds.getId()).build());
o.complete();
pm.insert(o);
}
return true;
}
示例8: 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;
}
示例9: insertDatastream
import de.fraunhofer.iosb.ilt.sta.model.Datastream; //导入方法依赖的package包/类
public boolean insertDatastream(Datastream ds) throws NoSuchEntityException, IncompleteEntityException {
// First check ObservedPropery, Sensor and Thing
ObservedProperty op = ds.getObservedProperty();
entityExistsOrCreate(op);
Sensor s = ds.getSensor();
entityExistsOrCreate(s);
Thing t = ds.getThing();
entityExistsOrCreate(t);
SQLQueryFactory qFactory = pm.createQueryFactory();
QDatastreams qd = QDatastreams.datastreams;
SQLInsertClause insert = qFactory.insert(qd);
insert.set(qd.name, ds.getName());
insert.set(qd.description, ds.getDescription());
insert.set(qd.observationType, ds.getObservationType());
insert.set(qd.unitDefinition, ds.getUnitOfMeasurement().getDefinition());
insert.set(qd.unitName, ds.getUnitOfMeasurement().getName());
insert.set(qd.unitSymbol, ds.getUnitOfMeasurement().getSymbol());
insert.set(qd.properties, objectToJson(ds.getProperties()));
insert.set(qd.phenomenonTimeStart, new Timestamp(PostgresPersistenceManagerString.DATETIME_MAX.getMillis()));
insert.set(qd.phenomenonTimeEnd, new Timestamp(PostgresPersistenceManagerString.DATETIME_MIN.getMillis()));
insert.set(qd.resultTimeStart, new Timestamp(PostgresPersistenceManagerString.DATETIME_MAX.getMillis()));
insert.set(qd.resultTimeEnd, new Timestamp(PostgresPersistenceManagerString.DATETIME_MIN.getMillis()));
insert.set(qd.obsPropertyId, (String) op.getId().getValue());
insert.set(qd.sensorId, (String) s.getId().getValue());
insert.set(qd.thingId, (String) t.getId().getValue());
String datastreamId = insert.executeWithKey(qd.id);
LOGGER.info("Inserted datastream. Created id = {}.", datastreamId);
ds.setId(new StringId(datastreamId));
// Create Observations, if any.
for (Observation o : ds.getObservations()) {
o.setDatastream(new DatastreamBuilder().setId(ds.getId()).build());
o.complete();
pm.insert(o);
}
return true;
}