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


Java Datastream.getId方法代碼示例

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


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

示例1: getTimeForDatastream

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //導入方法依賴的package包/類
private Instant getTimeForDatastream(Datastream ds) throws ServiceFailureException {
    Id dsId = ds.getId();
    Instant latest = datastreamCache.get(dsId);
    if (latest == null) {
        Observation firstObs = ds.observations().query().select("@iot.id", "phenomenonTime").orderBy("phenomenonTime desc").first();
        if (firstObs == null) {
            latest = Instant.MIN;
        } else {
            TimeObject phenomenonTime = firstObs.getPhenomenonTime();
            if (phenomenonTime.isInterval()) {
                latest = phenomenonTime.getAsInterval().getStart();
            } else {
                latest = phenomenonTime.getAsDateTime().toInstant();
            }
        }
        datastreamCache.put(dsId, latest);
    }
    return latest;
}
 
開發者ID:hylkevds,項目名稱:SensorThingsProcessor,代碼行數:20,代碼來源:ValidatorNewer.java

示例2: updateObservedProperty

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //導入方法依賴的package包/類
public boolean updateObservedProperty(ObservedProperty op, UUID opId) throws NoSuchEntityException {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QObsProperties qop = QObsProperties.obsProperties;
    SQLUpdateClause update = qFactory.update(qop);
    if (op.isSetDefinition()) {
        if (op.getDefinition() == null) {
            throw new IncompleteEntityException("definition can not be null.");
        }
        update.set(qop.definition, op.getDefinition());
    }
    if (op.isSetDescription()) {
        if (op.getDescription() == null) {
            throw new IncompleteEntityException("description can not be null.");
        }
        update.set(qop.description, op.getDescription());
    }
    if (op.isSetName()) {
        if (op.getName() == null) {
            throw new IncompleteEntityException("name can not be null.");
        }
        update.set(qop.name, op.getName());
    }
    if (op.isSetProperties()) {
        update.set(qop.properties, objectToJson(op.getProperties()));
    }

    update.where(qop.id.eq(opId));
    long count = 0;
    if (!update.isEmpty()) {
        count = update.execute();
    }
    if (count > 1) {
        LOGGER.error("Updating ObservedProperty {} caused {} rows to change!", opId, count);
        throw new IllegalStateException("Update changed multiple rows.");
    }

    // Link existing Datastreams to the observedProperty.
    for (Datastream ds : op.getDatastreams()) {
        if (ds.getId() == null || !entityExists(ds)) {
            throw new NoSuchEntityException("ObservedProperty with no id or non existing.");
        }
        UUID dsId = (UUID) ds.getId().getValue();
        QDatastreams qds = QDatastreams.datastreams;
        long dsCount = qFactory.update(qds)
                .set(qds.obsPropertyId, opId)
                .where(qds.id.eq(dsId))
                .execute();
        if (dsCount > 0) {
            LOGGER.info("Assigned datastream {} to ObservedProperty {}.", dsId, opId);
        }
    }

    if (!op.getMultiDatastreams().isEmpty()) {
        throw new IllegalArgumentException("Can not add MultiDatastreams to an ObservedProperty.");
    }

    LOGGER.debug("Updated ObservedProperty {}", opId);
    return true;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:60,代碼來源:EntityInserter.java

示例3: updateSensor

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //導入方法依賴的package包/類
public boolean updateSensor(Sensor s, UUID sensorId) throws NoSuchEntityException {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QSensors qs = QSensors.sensors;
    SQLUpdateClause update = qFactory.update(qs);
    if (s.isSetName()) {
        if (s.getName() == null) {
            throw new IncompleteEntityException("name can not be null.");
        }
        update.set(qs.name, s.getName());
    }
    if (s.isSetDescription()) {
        if (s.getDescription() == null) {
            throw new IncompleteEntityException("description can not be null.");
        }
        update.set(qs.description, s.getDescription());
    }
    if (s.isSetEncodingType()) {
        if (s.getEncodingType() == null) {
            throw new IncompleteEntityException("encodingType can not be null.");
        }
        update.set(qs.encodingType, s.getEncodingType());
    }
    if (s.isSetMetadata()) {
        if (s.getMetadata() == null) {
            throw new IncompleteEntityException("metadata can not be null.");
        }
        // TODO: Check metadata serialisation.
        update.set(qs.metadata, s.getMetadata().toString());
    }
    if (s.isSetProperties()) {
        update.set(qs.properties, objectToJson(s.getProperties()));
    }

    update.where(qs.id.eq(sensorId));
    long count = 0;
    if (!update.isEmpty()) {
        count = update.execute();
    }
    if (count > 1) {
        LOGGER.error("Updating Sensor {} caused {} rows to change!", sensorId, count);
        throw new IllegalStateException("Update changed multiple rows.");
    }

    // Link existing Datastreams to the sensor.
    for (Datastream ds : s.getDatastreams()) {
        if (ds.getId() == null || !entityExists(ds)) {
            throw new NoSuchEntityException("Datastream with no id or non existing.");
        }
        UUID dsId = (UUID) ds.getId().getValue();
        QDatastreams qds = QDatastreams.datastreams;
        long dsCount = qFactory.update(qds)
                .set(qds.sensorId, sensorId)
                .where(qds.id.eq(dsId))
                .execute();
        if (dsCount > 0) {
            LOGGER.info("Assigned datastream {} to sensor {}.", dsId, sensorId);
        }
    }

    // Link existing MultiDatastreams to the sensor.
    for (MultiDatastream mds : s.getMultiDatastreams()) {
        if (mds.getId() == null || !entityExists(mds)) {
            throw new NoSuchEntityException("MultiDatastream with no id or non existing.");
        }
        UUID mdsId = (UUID) mds.getId().getValue();
        QMultiDatastreams qmds = QMultiDatastreams.multiDatastreams;
        long mdsCount = qFactory.update(qmds)
                .set(qmds.sensorId, sensorId)
                .where(qmds.id.eq(mdsId))
                .execute();
        if (mdsCount > 0) {
            LOGGER.info("Assigned multiDatastream {} to sensor {}.", mdsId, sensorId);
        }
    }

    LOGGER.debug("Updated Sensor {}", sensorId);
    return true;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:79,代碼來源:EntityInserter.java

示例4: updateObservedProperty

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //導入方法依賴的package包/類
public boolean updateObservedProperty(ObservedProperty op, long opId) throws NoSuchEntityException {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QObsProperties qop = QObsProperties.obsProperties;
    SQLUpdateClause update = qFactory.update(qop);
    if (op.isSetDefinition()) {
        if (op.getDefinition() == null) {
            throw new IncompleteEntityException("definition can not be null.");
        }
        update.set(qop.definition, op.getDefinition());
    }
    if (op.isSetDescription()) {
        if (op.getDescription() == null) {
            throw new IncompleteEntityException("description can not be null.");
        }
        update.set(qop.description, op.getDescription());
    }
    if (op.isSetName()) {
        if (op.getName() == null) {
            throw new IncompleteEntityException("name can not be null.");
        }
        update.set(qop.name, op.getName());
    }
    if (op.isSetProperties()) {
        update.set(qop.properties, objectToJson(op.getProperties()));
    }

    update.where(qop.id.eq(opId));
    long count = 0;
    if (!update.isEmpty()) {
        count = update.execute();
    }
    if (count > 1) {
        LOGGER.error("Updating ObservedProperty {} caused {} rows to change!", opId, count);
        throw new IllegalStateException("Update changed multiple rows.");
    }

    // Link existing Datastreams to the observedProperty.
    for (Datastream ds : op.getDatastreams()) {
        if (ds.getId() == null || !entityExists(ds)) {
            throw new NoSuchEntityException("ObservedProperty with no id or non existing.");
        }
        Long dsId = (Long) ds.getId().getValue();
        QDatastreams qds = QDatastreams.datastreams;
        long dsCount = qFactory.update(qds)
                .set(qds.obsPropertyId, opId)
                .where(qds.id.eq(dsId))
                .execute();
        if (dsCount > 0) {
            LOGGER.info("Assigned datastream {} to ObservedProperty {}.", dsId, opId);
        }
    }

    if (!op.getMultiDatastreams().isEmpty()) {
        throw new IllegalArgumentException("Can not add MultiDatastreams to an ObservedProperty.");
    }

    LOGGER.debug("Updated ObservedProperty {}", opId);
    return true;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:60,代碼來源:EntityInserter.java

示例5: updateSensor

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //導入方法依賴的package包/類
public boolean updateSensor(Sensor s, long sensorId) throws NoSuchEntityException {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QSensors qs = QSensors.sensors;
    SQLUpdateClause update = qFactory.update(qs);
    if (s.isSetName()) {
        if (s.getName() == null) {
            throw new IncompleteEntityException("name can not be null.");
        }
        update.set(qs.name, s.getName());
    }
    if (s.isSetDescription()) {
        if (s.getDescription() == null) {
            throw new IncompleteEntityException("description can not be null.");
        }
        update.set(qs.description, s.getDescription());
    }
    if (s.isSetEncodingType()) {
        if (s.getEncodingType() == null) {
            throw new IncompleteEntityException("encodingType can not be null.");
        }
        update.set(qs.encodingType, s.getEncodingType());
    }
    if (s.isSetMetadata()) {
        if (s.getMetadata() == null) {
            throw new IncompleteEntityException("metadata can not be null.");
        }
        // TODO: Check metadata serialisation.
        update.set(qs.metadata, s.getMetadata().toString());
    }
    if (s.isSetProperties()) {
        update.set(qs.properties, objectToJson(s.getProperties()));
    }

    update.where(qs.id.eq(sensorId));
    long count = 0;
    if (!update.isEmpty()) {
        count = update.execute();
    }
    if (count > 1) {
        LOGGER.error("Updating Sensor {} caused {} rows to change!", sensorId, count);
        throw new IllegalStateException("Update changed multiple rows.");
    }

    // Link existing Datastreams to the sensor.
    for (Datastream ds : s.getDatastreams()) {
        if (ds.getId() == null || !entityExists(ds)) {
            throw new NoSuchEntityException("Datastream with no id or non existing.");
        }
        Long dsId = (Long) ds.getId().getValue();
        QDatastreams qds = QDatastreams.datastreams;
        long dsCount = qFactory.update(qds)
                .set(qds.sensorId, sensorId)
                .where(qds.id.eq(dsId))
                .execute();
        if (dsCount > 0) {
            LOGGER.info("Assigned datastream {} to sensor {}.", dsId, sensorId);
        }
    }

    // Link existing MultiDatastreams to the sensor.
    for (MultiDatastream mds : s.getMultiDatastreams()) {
        if (mds.getId() == null || !entityExists(mds)) {
            throw new NoSuchEntityException("MultiDatastream with no id or non existing.");
        }
        Long mdsId = (Long) mds.getId().getValue();
        QMultiDatastreams qmds = QMultiDatastreams.multiDatastreams;
        long mdsCount = qFactory.update(qmds)
                .set(qmds.sensorId, sensorId)
                .where(qmds.id.eq(mdsId))
                .execute();
        if (mdsCount > 0) {
            LOGGER.info("Assigned multiDatastream {} to sensor {}.", mdsId, sensorId);
        }
    }

    LOGGER.debug("Updated Sensor {}", sensorId);
    return true;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:79,代碼來源:EntityInserter.java

示例6: updateObservedProperty

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //導入方法依賴的package包/類
public boolean updateObservedProperty(ObservedProperty op, String opId) throws NoSuchEntityException {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QObsProperties qop = QObsProperties.obsProperties;
    SQLUpdateClause update = qFactory.update(qop);
    if (op.isSetDefinition()) {
        if (op.getDefinition() == null) {
            throw new IncompleteEntityException("definition can not be null.");
        }
        update.set(qop.definition, op.getDefinition());
    }
    if (op.isSetDescription()) {
        if (op.getDescription() == null) {
            throw new IncompleteEntityException("description can not be null.");
        }
        update.set(qop.description, op.getDescription());
    }
    if (op.isSetName()) {
        if (op.getName() == null) {
            throw new IncompleteEntityException("name can not be null.");
        }
        update.set(qop.name, op.getName());
    }
    if (op.isSetProperties()) {
        update.set(qop.properties, objectToJson(op.getProperties()));
    }

    update.where(qop.id.eq(opId));
    long count = 0;
    if (!update.isEmpty()) {
        count = update.execute();
    }
    if (count > 1) {
        LOGGER.error("Updating ObservedProperty {} caused {} rows to change!", opId, count);
        throw new IllegalStateException("Update changed multiple rows.");
    }

    // Link existing Datastreams to the observedProperty.
    for (Datastream ds : op.getDatastreams()) {
        if (ds.getId() == null || !entityExists(ds)) {
            throw new NoSuchEntityException("ObservedProperty with no id or non existing.");
        }
        String dsId = (String) ds.getId().getValue();
        QDatastreams qds = QDatastreams.datastreams;
        long dsCount = qFactory.update(qds)
                .set(qds.obsPropertyId, opId)
                .where(qds.id.eq(dsId))
                .execute();
        if (dsCount > 0) {
            LOGGER.info("Assigned datastream {} to ObservedProperty {}.", dsId, opId);
        }
    }

    if (!op.getMultiDatastreams().isEmpty()) {
        throw new IllegalArgumentException("Can not add MultiDatastreams to an ObservedProperty.");
    }

    LOGGER.debug("Updated ObservedProperty {}", opId);
    return true;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:60,代碼來源:EntityInserter.java

示例7: updateSensor

import de.fraunhofer.iosb.ilt.sta.model.Datastream; //導入方法依賴的package包/類
public boolean updateSensor(Sensor s, String sensorId) throws NoSuchEntityException {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QSensors qs = QSensors.sensors;
    SQLUpdateClause update = qFactory.update(qs);
    if (s.isSetName()) {
        if (s.getName() == null) {
            throw new IncompleteEntityException("name can not be null.");
        }
        update.set(qs.name, s.getName());
    }
    if (s.isSetDescription()) {
        if (s.getDescription() == null) {
            throw new IncompleteEntityException("description can not be null.");
        }
        update.set(qs.description, s.getDescription());
    }
    if (s.isSetEncodingType()) {
        if (s.getEncodingType() == null) {
            throw new IncompleteEntityException("encodingType can not be null.");
        }
        update.set(qs.encodingType, s.getEncodingType());
    }
    if (s.isSetMetadata()) {
        if (s.getMetadata() == null) {
            throw new IncompleteEntityException("metadata can not be null.");
        }
        // TODO: Check metadata serialisation.
        update.set(qs.metadata, s.getMetadata().toString());
    }
    if (s.isSetProperties()) {
        update.set(qs.properties, objectToJson(s.getProperties()));
    }

    update.where(qs.id.eq(sensorId));
    long count = 0;
    if (!update.isEmpty()) {
        count = update.execute();
    }
    if (count > 1) {
        LOGGER.error("Updating Sensor {} caused {} rows to change!", sensorId, count);
        throw new IllegalStateException("Update changed multiple rows.");
    }

    // Link existing Datastreams to the sensor.
    for (Datastream ds : s.getDatastreams()) {
        if (ds.getId() == null || !entityExists(ds)) {
            throw new NoSuchEntityException("Datastream with no id or non existing.");
        }
        String dsId = (String) ds.getId().getValue();
        QDatastreams qds = QDatastreams.datastreams;
        long dsCount = qFactory.update(qds)
                .set(qds.sensorId, sensorId)
                .where(qds.id.eq(dsId))
                .execute();
        if (dsCount > 0) {
            LOGGER.info("Assigned datastream {} to sensor {}.", dsId, sensorId);
        }
    }

    // Link existing MultiDatastreams to the sensor.
    for (MultiDatastream mds : s.getMultiDatastreams()) {
        if (mds.getId() == null || !entityExists(mds)) {
            throw new NoSuchEntityException("MultiDatastream with no id or non existing.");
        }
        String mdsId = (String) mds.getId().getValue();
        QMultiDatastreams qmds = QMultiDatastreams.multiDatastreams;
        long mdsCount = qFactory.update(qmds)
                .set(qmds.sensorId, sensorId)
                .where(qmds.id.eq(mdsId))
                .execute();
        if (mdsCount > 0) {
            LOGGER.info("Assigned multiDatastream {} to sensor {}.", mdsId, sensorId);
        }
    }

    LOGGER.debug("Updated Sensor {}", sensorId);
    return true;
}
 
開發者ID:FraunhoferIOSB,項目名稱:SensorThingsServer,代碼行數:79,代碼來源:EntityInserter.java


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