本文整理汇总了Java中com.querydsl.sql.dml.SQLInsertClause.set方法的典型用法代码示例。如果您正苦于以下问题:Java SQLInsertClause.set方法的具体用法?Java SQLInsertClause.set怎么用?Java SQLInsertClause.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.querydsl.sql.dml.SQLInsertClause
的用法示例。
在下文中一共展示了SQLInsertClause.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertFeatureOfInterest
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertFeatureOfInterest(FeatureOfInterest foi) throws NoSuchEntityException {
// No linked entities to check first.
SQLQueryFactory qFactory = pm.createQueryFactory();
QFeatures qfoi = QFeatures.features;
SQLInsertClause insert = qFactory.insert(qfoi);
insert.set(qfoi.name, foi.getName());
insert.set(qfoi.description, foi.getDescription());
insert.set(qfoi.properties, objectToJson(foi.getProperties()));
String encodingType = foi.getEncodingType();
insert.set(qfoi.encodingType, encodingType);
insertGeometry(insert, qfoi.feature, qfoi.geom, encodingType, foi.getFeature());
UUID generatedId = insert.executeWithKey(qfoi.id);
LOGGER.info("Inserted FeatureOfInterest. Created id = {}.", generatedId);
foi.setId(new UuidId(generatedId));
return true;
}
示例2: insertSensor
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertSensor(Sensor s) throws NoSuchEntityException, IncompleteEntityException {
SQLQueryFactory qFactory = pm.createQueryFactory();
QSensors qs = QSensors.sensors;
SQLInsertClause insert = qFactory.insert(qs);
insert.set(qs.name, s.getName());
insert.set(qs.description, s.getDescription());
insert.set(qs.encodingType, s.getEncodingType());
// TODO: Check metadata serialisation.
insert.set(qs.metadata, s.getMetadata().toString());
insert.set(qs.properties, objectToJson(s.getProperties()));
UUID generatedId = insert.executeWithKey(qs.id);
LOGGER.info("Inserted Sensor. Created id = {}.", generatedId);
s.setId(new UuidId(generatedId));
// Create new datastreams, if any.
for (Datastream ds : s.getDatastreams()) {
ds.setSensor(new SensorBuilder().setId(s.getId()).build());
ds.complete();
pm.insert(ds);
}
return true;
}
示例3: insertSensor
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertSensor(Sensor s) throws NoSuchEntityException, IncompleteEntityException {
SQLQueryFactory qFactory = pm.createQueryFactory();
QSensors qs = QSensors.sensors;
SQLInsertClause insert = qFactory.insert(qs);
insert.set(qs.name, s.getName());
insert.set(qs.description, s.getDescription());
insert.set(qs.encodingType, s.getEncodingType());
// TODO: Check metadata serialisation.
insert.set(qs.metadata, s.getMetadata().toString());
insert.set(qs.properties, objectToJson(s.getProperties()));
String generatedId = insert.executeWithKey(qs.id);
LOGGER.info("Inserted Sensor. Created id = {}.", generatedId);
s.setId(new StringId(generatedId));
// Create new datastreams, if any.
for (Datastream ds : s.getDatastreams()) {
ds.setSensor(new SensorBuilder().setId(s.getId()).build());
ds.complete();
pm.insert(ds);
}
return true;
}
示例4: insertSensor
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertSensor(Sensor s) throws NoSuchEntityException, IncompleteEntityException {
SQLQueryFactory qFactory = pm.createQueryFactory();
QSensors qs = QSensors.sensors;
SQLInsertClause insert = qFactory.insert(qs);
insert.set(qs.name, s.getName());
insert.set(qs.description, s.getDescription());
insert.set(qs.encodingType, s.getEncodingType());
// TODO: Check metadata serialisation.
insert.set(qs.metadata, s.getMetadata().toString());
insert.set(qs.properties, objectToJson(s.getProperties()));
Long generatedId = insert.executeWithKey(qs.id);
LOGGER.info("Inserted Sensor. Created id = {}.", generatedId);
s.setId(new LongId(generatedId));
// Create new datastreams, if any.
for (Datastream ds : s.getDatastreams()) {
ds.setSensor(new SensorBuilder().setId(s.getId()).build());
ds.complete();
pm.insert(ds);
}
return true;
}
示例5: insertFacility
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@TransactionalWrite
public long insertFacility(Facility facility, long facilityId) {
checkNotNull(facility, "facility");
facility.normalize();
SQLInsertClause insert = insertFacility();
insert.set(qFacility.id, facilityId);
populate(facility, insert);
insert.execute();
insertAliases(facilityId, facility.aliases);
insertPorts(facilityId, facility.ports);
updateServices(facilityId, facility.services);
updatePaymentMethods(facilityId, facility.paymentInfo.paymentMethods);
insertPricing(facilityId, facility.pricingMethod.getPricing(facility));
insertUnavailableCapacity(facilityId, facility.unavailableCapacities);
// History updated
final DateTime currentDate = DateTime.now();
facilityHistoryRepository.updateStatusHistory(currentDate, facilityId, facility.status, facility.statusDescription);
facilityHistoryRepository.updateCapacityHistory(currentDate, facilityId, facility.builtCapacity, facility.unavailableCapacities);
return facilityId;
}
示例6: insertHistoricalLocation
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertHistoricalLocation(HistoricalLocation h) throws NoSuchEntityException, IncompleteEntityException {
Thing t = h.getThing();
entityExistsOrCreate(t);
SQLQueryFactory qFactory = pm.createQueryFactory();
QHistLocations qhl = QHistLocations.histLocations;
SQLInsertClause insert = qFactory.insert(qhl);
insert.set(qhl.time, new Timestamp(h.getTime().getDateTime().getMillis()));
insert.set(qhl.thingId, (UUID) h.getThing().getId().getValue());
UUID generatedId = insert.executeWithKey(qhl.id);
LOGGER.info("Inserted HistoricalLocation. Created id = {}.", generatedId);
h.setId(new UuidId(generatedId));
EntitySet<Location> locations = h.getLocations();
for (Location l : locations) {
entityExistsOrCreate(l);
UUID lId = (UUID) l.getId().getValue();
QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
insert = qFactory.insert(qlhl);
insert.set(qlhl.histLocationId, generatedId);
insert.set(qlhl.locationId, lId);
insert.execute();
LOGGER.debug("Linked Location {} to HistoricalLocation {}.", lId, generatedId);
}
return true;
}
示例7: insertHistoricalLocation
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertHistoricalLocation(HistoricalLocation h) throws NoSuchEntityException, IncompleteEntityException {
Thing t = h.getThing();
entityExistsOrCreate(t);
SQLQueryFactory qFactory = pm.createQueryFactory();
QHistLocations qhl = QHistLocations.histLocations;
SQLInsertClause insert = qFactory.insert(qhl);
insert.set(qhl.time, new Timestamp(h.getTime().getDateTime().getMillis()));
insert.set(qhl.thingId, (String) h.getThing().getId().getValue());
String generatedId = insert.executeWithKey(qhl.id);
LOGGER.info("Inserted HistoricalLocation. Created id = {}.", generatedId);
h.setId(new StringId(generatedId));
EntitySet<Location> locations = h.getLocations();
for (Location l : locations) {
entityExistsOrCreate(l);
String lId = (String) l.getId().getValue();
QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
insert = qFactory.insert(qlhl);
insert.set(qlhl.histLocationId, generatedId);
insert.set(qlhl.locationId, lId);
insert.execute();
LOGGER.debug("Linked Location {} to HistoricalLocation {}.", lId, generatedId);
}
return true;
}
示例8: insertObservedProperty
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertObservedProperty(ObservedProperty op) throws NoSuchEntityException, IncompleteEntityException {
SQLQueryFactory qFactory = pm.createQueryFactory();
QObsProperties qop = QObsProperties.obsProperties;
SQLInsertClause insert = qFactory.insert(qop);
insert.set(qop.definition, op.getDefinition());
insert.set(qop.name, op.getName());
insert.set(qop.description, op.getDescription());
insert.set(qop.properties, objectToJson(op.getProperties()));
String generatedId = insert.executeWithKey(qop.id);
LOGGER.info("Inserted ObservedProperty. Created id = {}.", generatedId);
op.setId(new StringId(generatedId));
return true;
}
示例9: insertHistoricalLocation
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertHistoricalLocation(HistoricalLocation h) throws NoSuchEntityException, IncompleteEntityException {
Thing t = h.getThing();
entityExistsOrCreate(t);
SQLQueryFactory qFactory = pm.createQueryFactory();
QHistLocations qhl = QHistLocations.histLocations;
SQLInsertClause insert = qFactory.insert(qhl);
insert.set(qhl.time, new Timestamp(h.getTime().getDateTime().getMillis()));
insert.set(qhl.thingId, (Long) h.getThing().getId().getValue());
Long generatedId = insert.executeWithKey(qhl.id);
LOGGER.info("Inserted HistoricalLocation. Created id = {}.", generatedId);
h.setId(new LongId(generatedId));
EntitySet<Location> locations = h.getLocations();
for (Location l : locations) {
entityExistsOrCreate(l);
Long lId = (Long) l.getId().getValue();
QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
insert = qFactory.insert(qlhl);
insert.set(qlhl.histLocationId, generatedId);
insert.set(qlhl.locationId, lId);
insert.execute();
LOGGER.debug("Linked Location {} to HistoricalLocation {}.", lId, generatedId);
}
return true;
}
示例10: insertAliases
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private void insertAliases(long facilityId, Collection<String> aliases) {
if (aliases != null && !aliases.isEmpty()) {
SQLInsertClause insertBatch = queryFactory.insert(qAlias);
for (String alias : aliases) {
insertBatch.set(qAlias.facilityId, facilityId);
insertBatch.set(qAlias.alias, alias);
insertBatch.addBatch();
}
insertBatch.execute();
}
}
示例11: insertContact
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@TransactionalWrite
public long insertContact(Contact contact, Long contactId) {
SQLInsertClause insert = queryFactory.insert(qContact);
insert.set(qContact.id, contactId);
populate(contact, insert);
insert.execute();
return contactId;
}
示例12: insertOperator
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@TransactionalWrite
public long insertOperator(Operator operator, long operatorId) {
SQLInsertClause insert = queryFactory.insert(qOperator);
insert.set(qOperator.id, operatorId);
nameMapping.populate(operator.name, insert);
insert.execute();
return operatorId;
}
示例13: insertHub
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
@TransactionalWrite
public long insertHub(Hub hub, long hubId) {
SQLInsertClause insert = queryFactory.insert(qHub);
insert.set(qHub.id, hubId);
populate(hub, insert);
insert.execute();
insertHubFacilities(hubId, hub.facilityIds);
return hubId;
}
示例14: insertHubFacilities
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
private void insertHubFacilities(long hubId, Set<Long> facilityIds) {
if (facilityIds != null && !facilityIds.isEmpty()) {
SQLInsertClause insertBatch = queryFactory.insert(qHubFacility);
for (Long facilityId : facilityIds) {
insertBatch.set(qHubFacility.hubId, hubId);
insertBatch.set(qHubFacility.facilityId, facilityId);
insertBatch.addBatch();
}
insertBatch.execute();
}
}
示例15: insertThing
import com.querydsl.sql.dml.SQLInsertClause; //导入方法依赖的package包/类
public boolean insertThing(Thing t) throws NoSuchEntityException, IncompleteEntityException {
SQLQueryFactory qFactory = pm.createQueryFactory();
QThings qt = QThings.things;
SQLInsertClause insert = qFactory.insert(qt);
insert.set(qt.name, t.getName());
insert.set(qt.description, t.getDescription());
insert.set(qt.properties, objectToJson(t.getProperties()));
String thingId = insert.executeWithKey(qt.id);
LOGGER.info("Inserted Thing. Created id = {}.", thingId);
t.setId(new StringId(thingId));
// Create new Locations, if any.
List<String> locationIds = new ArrayList<>();
for (Location l : t.getLocations()) {
entityExistsOrCreate(l);
String lId = (String) l.getId().getValue();
QThingsLocations qtl = QThingsLocations.thingsLocations;
insert = qFactory.insert(qtl);
insert.set(qtl.thingId, thingId);
insert.set(qtl.locationId, lId);
insert.execute();
LOGGER.debug("Linked Location {} to Thing {}.", lId, thingId);
locationIds.add(lId);
}
// Now link the new locations also to a historicalLocation.
if (!locationIds.isEmpty()) {
QHistLocations qhl = QHistLocations.histLocations;
insert = qFactory.insert(qhl);
insert.set(qhl.thingId, thingId);
insert.set(qhl.time, new Timestamp(Calendar.getInstance().getTimeInMillis()));
String histLocationId = insert.executeWithKey(qhl.id);
LOGGER.debug("Created historicalLocation {}", histLocationId);
QLocationsHistLocations qlhl = QLocationsHistLocations.locationsHistLocations;
for (String locId : locationIds) {
qFactory.insert(qlhl)
.set(qlhl.histLocationId, histLocationId)
.set(qlhl.locationId, locId)
.execute();
LOGGER.info("Linked location {} to historicalLocation {}.", locId, histLocationId);
}
}
// Create new datastreams, if any.
for (Datastream ds : t.getDatastreams()) {
ds.setThing(new ThingBuilder().setId(t.getId()).build());
ds.complete();
pm.insert(ds);
}
// TODO: if we allow the creation of historicalLocations through Things
// then we have to be able to link those to Locations we might have just created.
// However, id juggling will be needed!
return true;
}