use of org.activityinfo.store.query.shared.columns.ForeignKey in project activityinfo by bedatadriven.
the class FormScan method updateFromCache.
public void updateFromCache(Map<String, Object> cached) {
// See which columns we could retrieve from cache
for (FormulaNode fieldId : Lists.newArrayList(columnMap.keySet())) {
ColumnView view = (ColumnView) cached.get(fieldCacheKey(fieldId));
if (view != null) {
// populate the pending result slot with the view from the cache
columnMap.get(fieldId).set(view);
// remove this column from the list of columns to fetch
columnMap.remove(fieldId);
// resolve the rowCount slot if still needed
if (rowCount != null) {
rowCount.set(view.numRows());
rowCount = null;
}
}
}
// And which foreign keys...
for (ForeignKeyId keyId : Lists.newArrayList(foreignKeyMap.keySet())) {
ForeignKey map = (ForeignKey) cached.get(fkCacheKey(keyId));
if (map != null) {
foreignKeyMap.get(keyId).set(map);
foreignKeyMap.remove(keyId);
}
}
// Do we need a row count?
if (rowCount != null) {
Integer count = (Integer) cached.get(rowCountKey());
if (count != null) {
rowCount.set(count);
}
}
}
Aggregations