use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class RecordLayerTableModel method exportRecords.
public void exportRecords(final Object target) {
final TableRecordsMode tableRecordsMode = getTableRecordsMode();
if (tableRecordsMode != null) {
final Query query = getFilterQuery();
tableRecordsMode.exportRecords(query, target);
}
}
use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class RecordStoreLayer method newBoundingBoxQuery.
protected Query newBoundingBoxQuery(BoundingBox boundingBox) {
final RecordDefinition recordDefinition = getInternalRecordDefinition();
final FieldDefinition geometryField = recordDefinition.getGeometryField();
boundingBox = convertBoundingBox(boundingBox);
if (geometryField == null || Property.isEmpty(boundingBox)) {
return null;
} else {
Query query = getQuery();
query = query.newQuery(recordDefinition);
query.and(F.envelopeIntersects(geometryField, boundingBox));
return query;
}
}
use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class RecordStoreLayer method getRecords.
@Override
public <R extends LayerRecord> List<R> getRecords(final Geometry geometry, final double distance) {
if (Property.isEmpty(geometry) || !hasGeometryField()) {
return Collections.emptyList();
} else {
final RecordDefinition recordDefinition = getRecordDefinition();
final FieldDefinition geometryField = getGeometryField();
final WithinDistance where = F.dWithin(geometryField, geometry, distance);
final Query query = new Query(recordDefinition, where);
return getRecords(query);
}
}
use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class RecordStoreLayer method refreshDo.
@Override
protected void refreshDo() {
synchronized (getSync()) {
if (this.loadingWorker != null) {
this.loadingWorker.cancel(true);
}
this.loadedBoundingBox = BoundingBox.empty();
this.loadingBoundingBox = this.loadedBoundingBox;
super.refreshDo();
}
final RecordStore recordStore = getRecordStore();
final PathName pathName = getPathName();
final CodeTable codeTable = recordStore.getCodeTable(pathName);
if (codeTable != null) {
codeTable.refresh();
}
if (hasIdField()) {
final List<Identifier> identifiers = new ArrayList<>();
synchronized (getSync()) {
identifiers.addAll(this.recordsByIdentifier.keySet());
}
if (!identifiers.isEmpty()) {
identifiers.sort(Identifier.comparator());
final RecordDefinition recordDefinition = recordStore.getRecordDefinition(pathName);
final List<FieldDefinition> idFields = recordDefinition.getIdFields();
final int idFieldCount = idFields.size();
if (idFieldCount == 1) {
final FieldDefinition idField = idFields.get(0);
final int pageSize = 999;
final int identifierCount = identifiers.size();
for (int i = 0; i < identifiers.size(); i += pageSize) {
final List<Identifier> queryIdentifiers = identifiers.subList(i, Math.min(identifierCount, i + pageSize));
final In in = Q.in(idField, queryIdentifiers);
final Query query = new Query(recordDefinition, in);
updateCachedRecords(recordStore, query);
}
} else if (!idFields.isEmpty()) {
for (final Identifier identifier : identifiers) {
final Query query = new Query(recordDefinition, Q.equalId(idFields, identifier));
updateCachedRecords(recordStore, query);
}
}
}
}
}
use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class AbstractRecordLayer method getQuery.
public final Query getQuery() {
final RecordDefinition recordDefinition = getRecordDefinition();
final Condition whereCondition = getFilter();
return new Query(recordDefinition, whereCondition);
}
Aggregations