use of ddf.catalog.filter.impl.PropertyIsEqualToLiteral in project ddf by codice.
the class OpenSearchFilterVisitor method visit.
/**
* PropertyIsEqualTo filter maps to a type/version criteria.
*/
@Override
public Object visit(PropertyIsEqualTo filter, Object data) {
LOGGER.trace("ENTERING: PropertyIsEqualTo filter");
if (currentNest != NestedTypes.NOT) {
if (filter instanceof IsEqualsToImpl) {
IsEqualsToImpl isEqualsTo = (IsEqualsToImpl) filter;
Expression leftValue = isEqualsTo.getLeftValue();
if (Metacard.ID.equals(leftValue.toString())) {
id = isEqualsTo.getExpression2().toString();
}
} else if (filter instanceof PropertyIsEqualToLiteral) {
PropertyIsEqualToLiteral isEqualsTo = (PropertyIsEqualToLiteral) filter;
if (Metacard.ID.equals(isEqualsTo.getExpression1().toString())) {
id = isEqualsTo.getExpression2().toString();
}
}
}
filters.add(filter);
LOGGER.trace("EXITING: PropertyIsEqualTo filter");
return super.visit(filter, data);
}
use of ddf.catalog.filter.impl.PropertyIsEqualToLiteral in project ddf by codice.
the class OpenSearchFilterVisitorTest method testPropertyIsEqualToLiteral.
@Test
public void testPropertyIsEqualToLiteral() {
PropertyIsEqualTo propertyIsEqualToLiteralFilter = new PropertyIsEqualToLiteral(new PropertyNameImpl(ID_ATTRIBUTE_NAME), new LiteralImpl(TEST_STRING));
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(propertyIsEqualToLiteralFilter, openSearchFilterVisitorObject);
assertThat(result.getId(), is(TEST_STRING));
}
Aggregations