Search in sources :

Example 1 with NodeMatcher

use of org.activityinfo.store.query.shared.NodeMatcher in project activityinfo by bedatadriven.

the class SubFormSummaryTest method matchNodes.

@Test
public void matchNodes() {
    TestingStorageProvider catalog = new TestingStorageProvider();
    ClinicForm clinicForm = catalog.getClinicForm();
    FormTree formTree = catalog.getFormTree(clinicForm.getFormId());
    NodeMatcher nodeMatcher = new NodeMatcher(formTree);
    Collection<NodeMatch> nodeMatches = nodeMatcher.resolveSymbol(new SymbolNode("NUM_CONSULT"));
    assertThat(nodeMatches, hasSize(1));
    NodeMatch nodeMatch = Iterables.getOnlyElement(nodeMatches);
    JoinNode joinNode = Iterables.getOnlyElement(nodeMatch.getJoins());
}
Also used : SymbolNode(org.activityinfo.model.formula.SymbolNode) FormTree(org.activityinfo.model.formTree.FormTree) JoinNode(org.activityinfo.store.query.shared.join.JoinNode) NodeMatch(org.activityinfo.store.query.shared.NodeMatch) NodeMatcher(org.activityinfo.store.query.shared.NodeMatcher) Test(org.junit.Test)

Aggregations

FormTree (org.activityinfo.model.formTree.FormTree)1 SymbolNode (org.activityinfo.model.formula.SymbolNode)1 NodeMatch (org.activityinfo.store.query.shared.NodeMatch)1 NodeMatcher (org.activityinfo.store.query.shared.NodeMatcher)1 JoinNode (org.activityinfo.store.query.shared.join.JoinNode)1 Test (org.junit.Test)1