当前位置: 首页>>代码示例>>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;未经允许,请勿转载。