use of org.activityinfo.store.query.server.ColumnSetBuilder in project activityinfo by bedatadriven.
the class UnaryFunctionQueryTest method setup.
@Before
public void setup() {
catalog = new TestingStorageProvider();
builder = new ColumnSetBuilder(catalog, new NullFormScanCache(), new NullFormSupervisor());
intakeForm = catalog.getIntakeForm();
}
use of org.activityinfo.store.query.server.ColumnSetBuilder in project activityinfo by bedatadriven.
the class ActivityInfoClientAsyncStub method queryTableColumns.
@Override
public Promise<ColumnSet> queryTableColumns(QueryModel query) {
try {
FormStorageProvider catalog = newCatalog();
ColumnSetBuilder builder = new ColumnSetBuilder(catalog, new NullFormSupervisor());
return Promise.resolved(builder.build(query));
} catch (Exception e) {
return Promise.rejected(e);
}
}
use of org.activityinfo.store.query.server.ColumnSetBuilder in project activityinfo by bedatadriven.
the class QueryEvaluatorTest method circularReference.
@Test
public void circularReference() throws Exception {
final FormClass formClass = new FormClass(ResourceId.valueOf("XYZ"));
formClass.addField(ResourceId.valueOf("FA")).setCode("A").setLabel("Field A").setType(new CalculatedFieldType("B"));
formClass.addField(ResourceId.valueOf("FB")).setCode("B").setLabel("Field B").setType(new CalculatedFieldType("A"));
FormStorageProviderStub catalog = new FormStorageProviderStub();
catalog.addForm(formClass).withRowCount(10);
ColumnSetBuilder builder = new ColumnSetBuilder(catalog, new NullFormScanCache(), new NullFormSupervisor());
FormScanBatch batch = builder.createNewBatch();
QueryEvaluator evaluator = new QueryEvaluator(FilterLevel.BASE, catalog.getTree(formClass.getId()), batch);
Slot<ColumnView> a = evaluator.evaluateExpression(new SymbolNode("A"));
Slot<ColumnView> aPlusOne = evaluator.evaluateExpression(FormulaParser.parse("A+1"));
builder.execute(batch);
assertThat(a.get().numRows(), equalTo(10));
assertThat(a.get().getString(0), nullValue());
assertThat(aPlusOne.get().getString(0), nullValue());
assertThat(aPlusOne.get().getDouble(0), equalTo(1d));
}
use of org.activityinfo.store.query.server.ColumnSetBuilder in project activityinfo by bedatadriven.
the class GetSitesHandler method initialiseHandler.
private void initialiseHandler(GetSites command, User user) {
catalog = catalogProvider.get();
if (catalog != null) {
this.command = command;
builder = new ColumnSetBuilder(catalog, new AppEngineFormScanCache(), new FormSupervisorAdapter(catalog, user.getId()));
linkedBuilder = new ColumnSetBuilder(catalog, new AppEngineFormScanCache(), new NullFormSupervisor());
batchFormTreeBuilder = new BatchingFormTreeBuilder(catalog);
batch = builder.createNewBatch();
linkedBatch = linkedBuilder.createNewBatch();
selfLinkedActivities = Maps.newHashMap();
sortInfo = command.getSortInfo();
offset = command.getOffset();
limit = command.getLimit();
totalResultLength = 0;
} else {
throw new CommandException("Could not retrieve form catalog");
}
}
use of org.activityinfo.store.query.server.ColumnSetBuilder in project activityinfo by bedatadriven.
the class AsyncClientStub method queryTableColumns.
@Override
public Promise<ColumnSet> queryTableColumns(QueryModel query) {
if (!connected) {
return offlineResult();
}
ColumnSetBuilder columnSetBuilder = new ColumnSetBuilder(storageProvider, new NullFormScanCache(), new NullFormSupervisor());
ColumnSet columnSet = columnSetBuilder.build(query);
return Promise.resolved(columnSet);
}
Aggregations