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


Java SQLUpdateClause.set方法代码示例

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


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

示例1: updateHistoricalLocation

import com.querydsl.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
public boolean updateHistoricalLocation(HistoricalLocation hl, UUID id) {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QHistLocations qhl = QHistLocations.histLocations;
    SQLUpdateClause update = qFactory.update(qhl);
    if (hl.isSetThing()) {
        if (!entityExists(hl.getThing())) {
            throw new IncompleteEntityException("Thing can not be null.");
        }
        update.set(qhl.thingId, (UUID) hl.getThing().getId().getValue());
    }
    if (hl.isSetTime()) {
        if (hl.getTime() == null) {
            throw new IncompleteEntityException("time can not be null.");
        }
        insertTimeInstant(update, qhl.time, hl.getTime());
    }
    update.where(qhl.id.eq(id));
    long count = 0;
    if (!update.isEmpty()) {
        count = update.execute();
    }
    if (count > 1) {
        LOGGER.error("Updating Location {} caused {} rows to change!", id, count);
        throw new IllegalStateException("Update changed multiple rows.");
    }
    LOGGER.debug("Updated Location {}", id);

    // Link existing locations to the HistoricalLocation.
    for (Location l : hl.getLocations()) {
        if (!entityExists(l)) {
            throw new IllegalArgumentException("Unknown Location or Location with no id.");
        }
        UUID lId = (UUID) l.getId().getValue();

        QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
        SQLInsertClause insert = qFactory.insert(qlhl);
        insert.set(qlhl.histLocationId, id);
        insert.set(qlhl.locationId, lId);
        insert.execute();
        LOGGER.debug("Linked Location {} to HistoricalLocation {}.", lId, id);
    }
    return true;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:44,代码来源:EntityInserter.java

示例2: updateObservedProperty

import com.querydsl.sql.dml.SQLUpdateClause; //导入方法依赖的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 com.querydsl.sql.dml.SQLUpdateClause; //导入方法依赖的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: updateHistoricalLocation

import com.querydsl.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
public boolean updateHistoricalLocation(HistoricalLocation hl, long id) {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QHistLocations qhl = QHistLocations.histLocations;
    SQLUpdateClause update = qFactory.update(qhl);
    if (hl.isSetThing()) {
        if (!entityExists(hl.getThing())) {
            throw new IncompleteEntityException("Thing can not be null.");
        }
        update.set(qhl.thingId, (Long) hl.getThing().getId().getValue());
    }
    if (hl.isSetTime()) {
        if (hl.getTime() == null) {
            throw new IncompleteEntityException("time can not be null.");
        }
        insertTimeInstant(update, qhl.time, hl.getTime());
    }
    update.where(qhl.id.eq(id));
    long count = 0;
    if (!update.isEmpty()) {
        count = update.execute();
    }
    if (count > 1) {
        LOGGER.error("Updating Location {} caused {} rows to change!", id, count);
        throw new IllegalStateException("Update changed multiple rows.");
    }
    LOGGER.debug("Updated Location {}", id);

    // Link existing locations to the HistoricalLocation.
    for (Location l : hl.getLocations()) {
        if (!entityExists(l)) {
            throw new IllegalArgumentException("Unknown Location or Location with no id.");
        }
        Long lId = (Long) l.getId().getValue();

        QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
        SQLInsertClause insert = qFactory.insert(qlhl);
        insert.set(qlhl.histLocationId, id);
        insert.set(qlhl.locationId, lId);
        insert.execute();
        LOGGER.debug("Linked Location {} to HistoricalLocation {}.", lId, id);
    }
    return true;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:44,代码来源:EntityInserter.java

示例5: updateObservedProperty

import com.querydsl.sql.dml.SQLUpdateClause; //导入方法依赖的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

示例6: updateSensor

import com.querydsl.sql.dml.SQLUpdateClause; //导入方法依赖的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

示例7: updateHistoricalLocation

import com.querydsl.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
public boolean updateHistoricalLocation(HistoricalLocation hl, String id) {
    SQLQueryFactory qFactory = pm.createQueryFactory();
    QHistLocations qhl = QHistLocations.histLocations;
    SQLUpdateClause update = qFactory.update(qhl);
    if (hl.isSetThing()) {
        if (!entityExists(hl.getThing())) {
            throw new IncompleteEntityException("Thing can not be null.");
        }
        update.set(qhl.thingId, (String) hl.getThing().getId().getValue());
    }
    if (hl.isSetTime()) {
        if (hl.getTime() == null) {
            throw new IncompleteEntityException("time can not be null.");
        }
        insertTimeInstant(update, qhl.time, hl.getTime());
    }
    update.where(qhl.id.eq(id));
    long count = 0;
    if (!update.isEmpty()) {
        count = update.execute();
    }
    if (count > 1) {
        LOGGER.error("Updating Location {} caused {} rows to change!", id, count);
        throw new IllegalStateException("Update changed multiple rows.");
    }
    LOGGER.debug("Updated Location {}", id);

    // Link existing locations to the HistoricalLocation.
    for (Location l : hl.getLocations()) {
        if (!entityExists(l)) {
            throw new IllegalArgumentException("Unknown Location or Location with no id.");
        }
        String lId = (String) l.getId().getValue();

        QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
        SQLInsertClause insert = qFactory.insert(qlhl);
        insert.set(qlhl.histLocationId, id);
        insert.set(qlhl.locationId, lId);
        insert.execute();
        LOGGER.debug("Linked Location {} to HistoricalLocation {}.", lId, id);
    }
    return true;
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:44,代码来源:EntityInserter.java

示例8: updateObservedProperty

import com.querydsl.sql.dml.SQLUpdateClause; //导入方法依赖的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

示例9: updateSensor

import com.querydsl.sql.dml.SQLUpdateClause; //导入方法依赖的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

示例10: setOrdinal

import com.querydsl.sql.dml.SQLUpdateClause; //导入方法依赖的package包/类
@Override
protected SQLUpdateClause setOrdinal(SQLUpdateClause versionUpdateBatch, long ordinal) {
    return versionUpdateBatch.set(options.version.ordinal, ordinal);
}
 
开发者ID:ssaarela,项目名称:javersion,代码行数:5,代码来源:EntityVersionStoreJdbc.java


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