當前位置: 首頁>>代碼示例>>Java>>正文


Java Datastream.getObservations方法代碼示例

本文整理匯總了Java中de.fraunhofer.iosb.ilt.sta.model.Datastream.getObservations方法的典型用法代碼示例。如果您正苦於以下問題:Java Datastream.getObservations方法的具體用法?Java Datastream.getObservations怎麽用?Java Datastream.getObservations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在de.fraunhofer.iosb.ilt.sta.model.Datastream的用法示例。


在下文中一共展示了Datastream.getObservations方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:46,代碼來源:EntityInserter.java

示例2: 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;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:46,代碼來源:EntityInserter.java

示例3: 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;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:46,代碼來源:EntityInserter.java


注:本文中的de.fraunhofer.iosb.ilt.sta.model.Datastream.getObservations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。