use of com.revolsys.record.query.Condition in project com.revolsys.open by revolsys.
the class ModeAbstractCached method exportRecords.
@Override
public void exportRecords(final Query query, final Object target) {
final Condition filter = query.getWhereCondition();
final Map<? extends CharSequence, Boolean> orderBy = query.getOrderBy();
final AbstractRecordLayer layer = getLayer();
final Iterable<LayerRecord> records = new ListByIndexIterator<>(this.records);
layer.exportRecords(records, filter, orderBy, target);
}
use of com.revolsys.record.query.Condition in project com.revolsys.open by revolsys.
the class ModeAllPaged method isRecordPageQueryChanged.
/**
* Has the record been changed such that
* @param record
* @return
*/
protected boolean isRecordPageQueryChanged(final LayerRecord record) {
final AbstractRecordLayer layer = getLayer();
if (layer.isModified(record)) {
final Condition filter = getFilter();
final RecordLayerTableModel model = getTableModel();
final Comparator<Record> comparator = model.getOrderByComparatorIdentifier();
if (comparator != null) {
final Record orginialRecord = record.getOriginalRecord();
final int compare = comparator.compare(record, orginialRecord);
if (compare != 0) {
return true;
}
}
if (!filter.isEmpty()) {
if (filter.test(record)) {
final Record orginialRecord = record.getOriginalRecord();
if (!filter.test(orginialRecord)) {
return true;
}
}
}
}
return false;
}
use of com.revolsys.record.query.Condition in project com.revolsys.open by revolsys.
the class ModeAllPaged method getRecordsForCache.
@Override
protected List<LayerRecord> getRecordsForCache() {
final AbstractRecordLayer layer = getLayer();
final List<LayerRecord> records = layer.getRecordsNew();
final Condition filter = getFilter();
if (!filter.isEmpty()) {
Predicates.retain(records, filter);
for (final LayerRecord modifiedRecord : layer.getRecordsModified()) {
if (filterTestModified(filter, modifiedRecord)) {
records.add(modifiedRecord);
}
}
}
final RecordLayerTableModel model = getTableModel();
final Comparator<Record> comparator = model.getOrderByComparatorIdentifier();
if (comparator != null) {
records.sort(comparator);
}
return records;
}
use of com.revolsys.record.query.Condition in project com.revolsys.open by revolsys.
the class QueryValueTest method testIsNotNull.
private void testIsNotNull() {
final Condition trueCondition1 = Q.isNotNull(this.idField);
assertConditionTrue(trueCondition1, this.record);
final Condition falseCondition1 = Q.isNotNull(this.descriptionAttribute);
assertConditionFalse(falseCondition1, this.record);
}
use of com.revolsys.record.query.Condition in project com.revolsys.open by revolsys.
the class QueryValueTest method testIsNull.
private void testIsNull() {
final Condition trueCondition1 = Q.isNull(this.descriptionAttribute);
assertConditionTrue(trueCondition1, this.record);
final Condition falseCondition1 = Q.isNull(this.idField);
assertConditionFalse(falseCondition1, this.record);
}
Aggregations