use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class CodeTableProperty method loadAll.
public synchronized void loadAll() {
final long time = System.currentTimeMillis();
if (this.threadLoading.get() != Boolean.TRUE) {
if (this.loading) {
while (this.loading) {
try {
wait(1000);
} catch (final InterruptedException e) {
}
}
return;
} else {
this.threadLoading.set(Boolean.TRUE);
this.loading = true;
try {
final RecordDefinition recordDefinition = this.recordStore.getRecordDefinition(this.typePath);
final Query query = new Query(recordDefinition);
query.setFieldNames(recordDefinition.getFieldNames());
for (final String order : this.orderBy) {
query.addOrderBy(order);
}
try (Reader<Record> reader = this.recordStore.getRecords(query)) {
final List<Record> codes = reader.toList();
final CategoryLabelCountMap statistics = this.recordStore.getStatistics();
if (statistics != null) {
statistics.getLabelCountMap("query").addCount(this.typePath, -codes.size());
}
Collections.sort(codes, new RecordFieldComparator(this.orderBy));
addValues(codes);
}
Property.firePropertyChange(this, "valuesChanged", false, true);
} finally {
this.loading = false;
this.loaded = true;
this.threadLoading.set(null);
this.notifyAll();
}
}
}
Dates.debugEllapsedTime(this, "Load All: " + getTypePath(), time);
}
use of com.revolsys.record.query.Query in project com.revolsys.open by revolsys.
the class RecordHtmlUiBuilder method newDataTableMap.
@SuppressWarnings("unchecked")
public Map<String, Object> newDataTableMap(final HttpServletRequest request, final String pageName, final Map<String, Object> parameters) {
final RecordDefinition recordDefinition = getRecordDefinition();
Query query = (Query) parameters.get("query");
if (query == null) {
final Map<String, Object> filter = (Map<String, Object>) parameters.get("filter");
query = Query.and(recordDefinition, filter);
}
final String fromClause = (String) parameters.get("fromClause");
if (Property.hasValue(fromClause)) {
query.setFromClause(fromClause);
}
return newDataTableMap(request, pageName, query);
}
Aggregations