当前位置: 首页>>代码示例>>Java>>正文


Java Observation.complete方法代码示例

本文整理汇总了Java中de.fraunhofer.iosb.ilt.sta.model.Observation.complete方法的典型用法代码示例。如果您正苦于以下问题:Java Observation.complete方法的具体用法?Java Observation.complete怎么用?Java Observation.complete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.fraunhofer.iosb.ilt.sta.model.Observation的用法示例。


在下文中一共展示了Observation.complete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: insertDatastream

import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的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;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:46,代码来源:EntityInserter.java

示例2: insertMultiDatastream

import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
public boolean insertMultiDatastream(MultiDatastream ds) throws NoSuchEntityException, IncompleteEntityException {
    // First check Sensor and Thing
    Sensor s = ds.getSensor();
    entityExistsOrCreate(s);

    Thing t = ds.getThing();
    entityExistsOrCreate(t);

    SQLQueryFactory qFactory = pm.createQueryFactory();

    QMultiDatastreams qd = QMultiDatastreams.multiDatastreams;
    SQLInsertClause insert = qFactory.insert(qd);
    insert.set(qd.name, ds.getName());
    insert.set(qd.description, ds.getDescription());
    insert.set(qd.observationTypes, objectToJson(ds.getMultiObservationDataTypes()));
    insert.set(qd.unitOfMeasurements, objectToJson(ds.getUnitOfMeasurements()));
    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.sensorId, (UUID) s.getId().getValue());
    insert.set(qd.thingId, (UUID) t.getId().getValue());

    UUID multiDatastreamId = insert.executeWithKey(qd.id);
    LOGGER.info("Inserted multiDatastream. Created id = {}.", multiDatastreamId);
    ds.setId(new UuidId(multiDatastreamId));

    // Create new Locations, if any.
    EntitySet<ObservedProperty> ops = ds.getObservedProperties();
    int rank = 0;
    for (ObservedProperty op : ops) {
        entityExistsOrCreate(op);
        UUID opId = (UUID) op.getId().getValue();

        QMultiDatastreamsObsProperties qMdOp = QMultiDatastreamsObsProperties.multiDatastreamsObsProperties;
        insert = qFactory.insert(qMdOp);
        insert.set(qMdOp.multiDatastreamId, multiDatastreamId);
        insert.set(qMdOp.obsPropertyId, opId);
        insert.set(qMdOp.rank, rank);
        insert.execute();
        LOGGER.debug("Linked MultiDatastream {} to ObservedProperty {} with rank {}.", multiDatastreamId, opId, rank);
        rank++;
    }

    // Create Observations, if any.
    for (Observation o : ds.getObservations()) {
        o.setMultiDatastream(new MultiDatastreamBuilder().setId(ds.getId()).build());
        o.complete();
        pm.insert(o);
    }

    return true;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:57,代码来源:EntityInserter.java

示例3: insertDatastream

import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的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;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:46,代码来源:EntityInserter.java

示例4: insertMultiDatastream

import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
public boolean insertMultiDatastream(MultiDatastream ds) throws NoSuchEntityException, IncompleteEntityException {
    // First check Sensor and Thing
    Sensor s = ds.getSensor();
    entityExistsOrCreate(s);

    Thing t = ds.getThing();
    entityExistsOrCreate(t);

    SQLQueryFactory qFactory = pm.createQueryFactory();

    QMultiDatastreams qd = QMultiDatastreams.multiDatastreams;
    SQLInsertClause insert = qFactory.insert(qd);
    insert.set(qd.name, ds.getName());
    insert.set(qd.description, ds.getDescription());
    insert.set(qd.observationTypes, objectToJson(ds.getMultiObservationDataTypes()));
    insert.set(qd.unitOfMeasurements, objectToJson(ds.getUnitOfMeasurements()));
    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.sensorId, (Long) s.getId().getValue());
    insert.set(qd.thingId, (Long) t.getId().getValue());

    Long multiDatastreamId = insert.executeWithKey(qd.id);
    LOGGER.info("Inserted multiDatastream. Created id = {}.", multiDatastreamId);
    ds.setId(new LongId(multiDatastreamId));

    // Create new Locations, if any.
    EntitySet<ObservedProperty> ops = ds.getObservedProperties();
    int rank = 0;
    for (ObservedProperty op : ops) {
        entityExistsOrCreate(op);
        Long opId = (Long) op.getId().getValue();

        QMultiDatastreamsObsProperties qMdOp = QMultiDatastreamsObsProperties.multiDatastreamsObsProperties;
        insert = qFactory.insert(qMdOp);
        insert.set(qMdOp.multiDatastreamId, multiDatastreamId);
        insert.set(qMdOp.obsPropertyId, opId);
        insert.set(qMdOp.rank, rank);
        insert.execute();
        LOGGER.debug("Linked MultiDatastream {} to ObservedProperty {} with rank {}.", multiDatastreamId, opId, rank);
        rank++;
    }

    // Create Observations, if any.
    for (Observation o : ds.getObservations()) {
        o.setMultiDatastream(new MultiDatastreamBuilder().setId(ds.getId()).build());
        o.complete();
        pm.insert(o);
    }

    return true;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:57,代码来源:EntityInserter.java

示例5: insertDatastream

import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的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;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:46,代码来源:EntityInserter.java

示例6: insertMultiDatastream

import de.fraunhofer.iosb.ilt.sta.model.Observation; //导入方法依赖的package包/类
public boolean insertMultiDatastream(MultiDatastream ds) throws NoSuchEntityException, IncompleteEntityException {
    // First check Sensor and Thing
    Sensor s = ds.getSensor();
    entityExistsOrCreate(s);

    Thing t = ds.getThing();
    entityExistsOrCreate(t);

    SQLQueryFactory qFactory = pm.createQueryFactory();

    QMultiDatastreams qd = QMultiDatastreams.multiDatastreams;
    SQLInsertClause insert = qFactory.insert(qd);
    insert.set(qd.name, ds.getName());
    insert.set(qd.description, ds.getDescription());
    insert.set(qd.observationTypes, objectToJson(ds.getMultiObservationDataTypes()));
    insert.set(qd.unitOfMeasurements, objectToJson(ds.getUnitOfMeasurements()));
    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.sensorId, (String) s.getId().getValue());
    insert.set(qd.thingId, (String) t.getId().getValue());

    String multiDatastreamId = insert.executeWithKey(qd.id);
    LOGGER.info("Inserted multiDatastream. Created id = {}.", multiDatastreamId);
    ds.setId(new StringId(multiDatastreamId));

    // Create new Locations, if any.
    EntitySet<ObservedProperty> ops = ds.getObservedProperties();
    int rank = 0;
    for (ObservedProperty op : ops) {
        entityExistsOrCreate(op);
        String opId = (String) op.getId().getValue();

        QMultiDatastreamsObsProperties qMdOp = QMultiDatastreamsObsProperties.multiDatastreamsObsProperties;
        insert = qFactory.insert(qMdOp);
        insert.set(qMdOp.multiDatastreamId, multiDatastreamId);
        insert.set(qMdOp.obsPropertyId, opId);
        insert.set(qMdOp.rank, rank);
        insert.execute();
        LOGGER.debug("Linked MultiDatastream {} to ObservedProperty {} with rank {}.", multiDatastreamId, opId, rank);
        rank++;
    }

    // Create Observations, if any.
    for (Observation o : ds.getObservations()) {
        o.setMultiDatastream(new MultiDatastreamBuilder().setId(ds.getId()).build());
        o.complete();
        pm.insert(o);
    }

    return true;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:57,代码来源:EntityInserter.java


注:本文中的de.fraunhofer.iosb.ilt.sta.model.Observation.complete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。