use of org.opengis.filter.expression.Expression in project ddf by codice.
the class CswRecordMapperFilterVisitor method visit.
@Override
public Object visit(PropertyIsEqualTo filter, Object extraData) {
if (StringUtils.equals(Core.SOURCE_ID, ((PropertyName) filter.getExpression1()).getPropertyName())) {
sourceIds.add((String) ((Literal) filter.getExpression2()).getValue());
return null;
}
AttributeType type = attributeTypes.get(((PropertyName) filter.getExpression1()).getPropertyName());
LiteralExpressionImpl typedExpression = (LiteralExpressionImpl) filter.getExpression2();
setExpressionType(type, typedExpression);
Expression expr1 = visit(filter.getExpression1(), extraData);
Expression expr2 = visit((Expression) typedExpression, expr1);
return getFactory(extraData).equal(expr1, expr2, filter.isMatchingCase());
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class CswRecordMapperFilterVisitor method visit.
@Override
public Object visit(PropertyIsLessThan filter, Object extraData) {
Expression expr1 = visit(filter.getExpression1(), extraData);
Expression expr2 = visit(filter.getExpression2(), expr1);
// work around since solr provider doesn't support lessthan on temporal (DDF-311)
if (isTemporalQuery(expr1, expr2)) {
return getFactory(extraData).before(expr1, expr2);
} else {
AttributeType type = attributeTypes.get(((PropertyName) filter.getExpression1()).getPropertyName());
LiteralExpressionImpl typedExpression = (LiteralExpressionImpl) filter.getExpression2();
setExpressionType(type, typedExpression);
expr2 = visit((Expression) typedExpression, expr1);
}
return getFactory(extraData).less(expr1, expr2);
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class CswRecordMapperFilterVisitor method visit.
@Override
public Object visit(Beyond filter, Object extraData) {
double distance = getDistanceInMeters(filter.getDistance(), filter.getDistanceUnits());
Expression geometry1 = visit(filter.getExpression1(), SPATIAL_QUERY_TAG);
Expression geometry2 = visit(filter.getExpression2(), extraData);
convertGeometryExpressionToEpsg4326(geometry1);
convertGeometryExpressionToEpsg4326(geometry2);
return getFactory(extraData).beyond(geometry1, geometry2, distance, UomOgcMapping.METRE.name());
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class CswRecordMapperFilterVisitor method visit.
@Override
public Object visit(PropertyIsLessThanOrEqualTo filter, Object extraData) {
Expression expr1 = visit(filter.getExpression1(), extraData);
Expression expr2 = visit(filter.getExpression2(), expr1);
// work around since solr provider doesn't support lessOrEqual on temporal (DDF-311)
if (isTemporalQuery(expr1, expr2)) {
// work around #1 fails, solr provider doesn't support tEquals either (DDF-311)
//TEquals tEquals = getFactory(extraData).tequals(expr1, expr2);
//Before before = getFactory(extraData).before(expr1, expr2);
//return getFactory(extraData).or(tEquals, before);
Object val = null;
Expression other = null;
if (expr2 instanceof Literal) {
val = ((Literal) expr2).getValue();
other = expr1;
} else if (expr1 instanceof Literal) {
val = ((Literal) expr1).getValue();
other = expr2;
}
if (val != null) {
Date orig = (Date) val;
orig.setTime(orig.getTime() + 1);
Literal literal = getFactory(extraData).literal(orig);
return getFactory(extraData).before(other, literal);
}
} else {
AttributeType type = attributeTypes.get(((PropertyName) filter.getExpression1()).getPropertyName());
LiteralExpressionImpl typedExpression = (LiteralExpressionImpl) filter.getExpression2();
setExpressionType(type, typedExpression);
expr2 = visit((Expression) typedExpression, expr1);
}
return getFactory(extraData).lessOrEqual(expr1, expr2);
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class CswRecordMapperFilterVisitor method visit.
@Override
public Object visit(PropertyIsNotEqualTo filter, Object extraData) {
AttributeType type = attributeTypes.get(((PropertyName) filter.getExpression1()).getPropertyName());
LiteralExpressionImpl typedExpression = (LiteralExpressionImpl) filter.getExpression2();
setExpressionType(type, typedExpression);
Expression expr1 = visit(filter.getExpression1(), extraData);
Expression expr2 = visit((Expression) typedExpression, expr1);
return getFactory(extraData).notEqual(expr1, expr2, filter.isMatchingCase());
}
Aggregations