use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class RecordLayerTableModel method getFilterQuery.
protected Query getFilterQuery() {
final Query query = this.layer.getQuery();
final Condition filter = getFilter();
query.and(filter);
query.setOrderBy(this.orderBy);
if (this.filterByBoundingBox) {
final Project project = this.layer.getProject();
final BoundingBox viewBoundingBox = project.getViewBoundingBox();
final RecordDefinition recordDefinition = this.layer.getRecordDefinition();
final FieldDefinition geometryField = recordDefinition.getGeometryField();
if (geometryField != null) {
query.and(F.envelopeIntersects(geometryField, viewBoundingBox));
}
}
return query;
}
use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class LoadingWorker method handleBackground.
@Override
protected List<LayerRecord> handleBackground() {
try {
final Query query = this.layer.newBoundingBoxQuery(this.viewportBoundingBox);
// TODO cancellable
final List<LayerRecord> records = this.layer.getRecords(query);
this.layer.setIndexRecords(this.viewportBoundingBox, records);
return records;
} catch (final Exception e) {
if (this.layer.isDeleted()) {
return null;
} else {
throw e;
}
}
}
use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class RecordStoreQueryReader method open.
@Override
@PostConstruct
public void open() {
if (this.typePaths != null) {
for (final String tableName : this.typePaths) {
final RecordDefinition recordDefinition = this.recordStore.getRecordDefinition(tableName);
if (recordDefinition != null) {
Query query;
if (this.boundingBox == null) {
query = new Query(recordDefinition);
query.setWhereCondition(new SqlCondition(this.whereClause));
} else {
query = Query.intersects(recordDefinition, this.boundingBox);
}
addQuery(query);
}
}
}
super.open();
}
use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class RecordStoreQueryReader method newQueryIterator.
protected AbstractIterator<Record> newQueryIterator(final int i) {
if (i < this.queries.size()) {
final Query query = this.queries.get(i);
if (Property.hasValue(this.whereClause)) {
query.and(new SqlCondition(this.whereClause));
}
if (this.boundingBox != null) {
final FieldDefinition geometryField = query.getRecordDefinition().getGeometryField();
query.and(F.envelopeIntersects(geometryField, this.boundingBox));
}
final AbstractIterator<Record> iterator = this.recordStore.newIterator(query, getProperties());
return iterator;
}
throw new NoSuchElementException();
}
use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class AbstractRecordLayer method setSelectedRecordsById.
public void setSelectedRecordsById(final Identifier id) {
final RecordDefinition recordDefinition = getRecordDefinition();
if (recordDefinition != null) {
final FieldDefinition idField = recordDefinition.getIdField();
if (idField == null) {
clearSelectedRecords();
} else {
final Query query = Query.where(Q::equal, idField, id);
setSelectedRecords(query);
}
}
}
Aggregations