use of org.opengis.filter.expression.Expression in project ddf by codice.
the class CswRecordMapperFilterVisitor method visit.
@Override
public Object visit(Function function, Object extraData) {
if (function instanceof FuzzyFunction) {
//FuzzyFunction has 1 parameter to visit
Expression expr1 = visit(function.getParameters().get(0), null);
((FuzzyFunction) function).setParameters(Arrays.asList(expr1));
return function;
} else {
return super.visit(function, extraData);
}
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testSourceIdFilter.
@Test
public void testSourceIdFilter() {
Expression val = factory.literal("source1");
Expression val2 = factory.literal("source2");
Expression sourceExpr = factory.property(Core.SOURCE_ID);
PropertyIsEqualTo filter = factory.equal(sourceExpr, val, false);
Filter filter2 = factory.equal(sourceExpr, val2, false);
Filter likeFilter = factory.like(attrExpr, "something");
Filter sourceFilter = factory.or(filter, filter2);
Filter totalFilter = factory.and(sourceFilter, likeFilter);
Object obj = totalFilter.accept(visitor, null);
assertThat(obj, instanceOf(PropertyIsLike.class));
PropertyIsLike duplicate = (PropertyIsLike) obj;
assertThat(duplicate.getExpression(), is(attrExpr));
assertThat(duplicate.getLiteral(), is("something"));
assertThat(visitor.getSourceIds().size(), is(2));
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsLessThanOrEqualToTemporal.
@Ignore("not supported by solr provider")
@Test
public void testVisitPropertyIsLessThanOrEqualToTemporal() {
Expression val = factory.literal(new Date());
PropertyIsLessThanOrEqualTo filter = factory.lessOrEqual(created, val);
Object obj = visitor.visit(filter, null);
assertThat(obj, instanceOf(Or.class));
Or duplicate = (Or) obj;
for (Filter child : duplicate.getChildren()) {
BinaryTemporalOperator binary = (BinaryTemporalOperator) child;
assertThat(binary, anyOf(instanceOf(TEquals.class), instanceOf(Before.class)));
assertThat(binary.getExpression1(), is(created));
assertThat(binary.getExpression2(), is(val));
}
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsGreaterThan.
@Test
public void testVisitPropertyIsGreaterThan() {
Expression val = factory.literal(8);
PropertyIsGreaterThan filter = factory.greater(attrExpr, val);
Object obj = visitor.visit(filter, null);
assertThat(obj, instanceOf(PropertyIsGreaterThan.class));
PropertyIsGreaterThan duplicate = (PropertyIsGreaterThan) obj;
assertThat(duplicate.getExpression1(), is(attrExpr));
assertThat(duplicate.getExpression2(), is(val));
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsLessThanOrEqualTo.
@Test
public void testVisitPropertyIsLessThanOrEqualTo() {
Expression val = factory.literal(8);
PropertyIsLessThanOrEqualTo filter = factory.lessOrEqual(attrExpr, val);
Object obj = visitor.visit(filter, null);
assertThat(obj, instanceOf(PropertyIsLessThanOrEqualTo.class));
PropertyIsLessThanOrEqualTo duplicate = (PropertyIsLessThanOrEqualTo) obj;
assertThat(duplicate.getExpression1(), is(attrExpr));
assertThat(duplicate.getExpression2(), is(val));
}
Aggregations