use of org.whole.lang.queries.model.Sequence in project whole by wholeplatform.
the class TestsHelpers method createFilterRule.
public static FilterRule createFilterRule(Collection<IEntity> entities) {
// create the filter logic
QueriesEntityFactory qef = QueriesEntityFactory.instance;
Sequence sequence = qef.createSequence(0);
Iterator<IEntity> iterator = entities.iterator();
IEntity baseEntity = iterator.next();
while (iterator.hasNext()) updateFilterBody(baseEntity, iterator.next(), sequence);
if (sequence.wIsEmpty())
return createResolver(FilterRule);
// create the filter rule
TestsEntityFactory tef = TestsEntityFactory.instance;
FilterRule filterRule = tef.createFilterRule(tef.createDescription("Auto-generated filter rule"), createVariable(Name, "filterName"), sequence.wGetAdapter(Statement));
return filterRule;
}
use of org.whole.lang.queries.model.Sequence in project whole by wholeplatform.
the class ResolversTest method testCompositeEntitySetParent.
@Test
public void testCompositeEntitySetParent() {
Sequence sequence = qf.createSequence(0);
org.whole.lang.queries.model.Expression expression = createResolver(QueriesEntityDescriptorEnum.Expression);
sequence.wAdd(expression);
Assert.assertTrue(EntityUtils.isResolver(expression));
expression.wAdd(qf.createChildStep());
Assert.assertTrue(EntityUtils.isResolver(expression));
Filter filter = qf.createFilter();
filter.wSet(QueriesFeatureDescriptorEnum.expression, EntityUtils.clone(expression));
Assert.assertTrue(Matcher.match(QueriesEntityDescriptorEnum.Expression, filter.getExpression()));
}
use of org.whole.lang.queries.model.Sequence in project whole by wholeplatform.
the class ResolversTest method testCompositeEntityResolverTighteningAddByIndexSparse.
@Category(KnownFailingTests.class)
@Test
public void testCompositeEntityResolverTighteningAddByIndexSparse() {
org.whole.lang.queries.model.Expression expression = createResolver(QueriesEntityDescriptorEnum.Expression);
Sequence sequence = qf.createSequence(expression);
expression.wAdd(2, qf.createChildStep());
Assert.assertTrue(EntityUtils.isResolver(expression));
expression.wAdd(6, qf.createPath());
Assert.assertTrue(Matcher.matchImpl(QueriesEntityDescriptorEnum.Sequence, sequence.wGet(0)));
}
use of org.whole.lang.queries.model.Sequence in project whole by wholeplatform.
the class ResolversTest method testCompositeEntityResolverTighteningAddByIndex.
@Category(KnownFailingTests.class)
@Test
public void testCompositeEntityResolverTighteningAddByIndex() {
org.whole.lang.queries.model.Expression expression = createResolver(QueriesEntityDescriptorEnum.Expression);
Sequence sequence = qf.createSequence(expression);
expression.wAdd(0, qf.createChildStep());
Assert.assertTrue(EntityUtils.isResolver(expression));
expression.wAdd(1, qf.createPath());
Assert.assertTrue(Matcher.matchImpl(QueriesEntityDescriptorEnum.Sequence, sequence.wGet(0)));
}
use of org.whole.lang.queries.model.Sequence in project whole by wholeplatform.
the class ResolversTest method testCompositeEntityResolverWithResolve.
@Test
public void testCompositeEntityResolverWithResolve() {
org.whole.lang.queries.model.Expression expression = createResolver(QueriesEntityDescriptorEnum.Expression);
Sequence sequence = qf.createSequence(expression);
expression.wAdd(qf.createChildStep());
Assert.assertTrue(EntityUtils.isResolver(expression));
expression.wResolveWith(QueriesEntityDescriptorEnum.Sequence);
Assert.assertTrue(Matcher.matchImpl(QueriesEntityDescriptorEnum.Sequence, sequence.wGet(0)));
}
Aggregations