use of org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType in project geotoolkit by Geomatys.
the class OGC110Test method testFilterComparisonPropertyIsGreaterThanOrEqual.
@Test
public void testFilterComparisonPropertyIsGreaterThanOrEqual() throws JAXBException, NoSuchAuthorityCodeException, FactoryException {
final Unmarshaller UNMARSHALLER = POOL.acquireUnmarshaller();
final Marshaller MARSHALLER = POOL.acquireMarshaller();
// Read test
Object obj = UNMARSHALLER.unmarshal(FILE_FIL_COMP_ISGREATEROREQUAL);
assertNotNull(obj);
JAXBElement<? extends FilterType> jaxfilter = (JAXBElement<? extends FilterType>) obj;
assertNotNull(jaxfilter);
Filter filter = TRANSFORMER_GT.visitFilter(jaxfilter.getValue());
assertNotNull(filter);
BinaryComparisonOperator prop = (BinaryComparisonOperator) filter;
ValueReference left = (ValueReference) prop.getOperand1();
Literal right = (Literal) prop.getOperand2();
assertEquals(left.getXPath(), valueStr);
assertEquals(((Number) right.apply(null)).floatValue(), valueF, DELTA);
// write test
FilterType ft = TRANSFORMER_OGC.apply(filter);
assertNotNull(ft.getComparisonOps());
ComparisonOpsType cot = ft.getComparisonOps().getValue();
BinaryComparisonOpType pibt = (BinaryComparisonOpType) cot;
PropertyNameType lf = (PropertyNameType) pibt.getExpression().get(0).getValue();
LiteralType rg = (LiteralType) pibt.getExpression().get(1).getValue();
assertEquals(valueStr, lf.getContent());
numberEquals(valueF, rg.getContent().get(0));
MARSHALLER.marshal(ft.getComparisonOps(), TEST_FILE_FIL_COMP_ISGREATEROREQUAL);
POOL.recycle(MARSHALLER);
POOL.recycle(UNMARSHALLER);
}
use of org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType in project ddf by codice.
the class CswQueryFactoryTest method testPostGetRecordsTemporalPropertyIsGreaterOrEqualOgcFilter.
@Ignore("TODO: the functions this test tests has been augmented to play well with the limited capabilities of the Solr provider. " + "These tests and the functions they test should be reenabled and refactored after DDF-311 is addressed")
@Test
public void testPostGetRecordsTemporalPropertyIsGreaterOrEqualOgcFilter() throws CswException, UnsupportedQueryException, SourceUnavailableException, FederationException {
BinaryComparisonOpType op = createTemporalBinaryComparisonOpType(CswConstants.CSW_CREATED, TIMESTAMP);
ogcOrdTemporalQuery(filterObjectFactory.createPropertyIsGreaterThanOrEqualTo(op));
}
use of org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType in project ddf by codice.
the class CswQueryFactoryTest method testPostGetRecordsTemporalPropertyIsGreaterOgcFilter.
@Ignore("TODO: the functions this test tests has been augmented to play well with the limited capabilities of the Solr provider. " + "These tests and the functions they test should be reenabled and refactored after DDF-311 is addressed")
@Test
public void testPostGetRecordsTemporalPropertyIsGreaterOgcFilter() throws CswException, UnsupportedQueryException, SourceUnavailableException, FederationException {
BinaryComparisonOpType op = createTemporalBinaryComparisonOpType(CswConstants.CSW_CREATED, TIMESTAMP);
ogcTemporalQuery(Core.CREATED, filterObjectFactory.createPropertyIsGreaterThan(op), After.class);
}
use of org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType in project ddf by codice.
the class WfsFilterDelegate method createPropertyIsFilter.
private JAXBElement<? extends ComparisonOpsType> createPropertyIsFilter(String property, Object literal, PROPERTY_IS_OPS operation) {
switch(operation) {
case PROPERTY_IS_EQUAL_TO:
JAXBElement<BinaryComparisonOpType> propIsEqualTo = filterObjectFactory.createPropertyIsEqualTo(new BinaryComparisonOpType());
propIsEqualTo.getValue().getExpression().add(createPropertyNameType(property));
propIsEqualTo.getValue().getExpression().add(createLiteralType(literal));
return propIsEqualTo;
case PROPERTY_IS_NOT_EQUAL_TO:
JAXBElement<BinaryComparisonOpType> propIsNotEqualTo = filterObjectFactory.createPropertyIsNotEqualTo(new BinaryComparisonOpType());
propIsNotEqualTo.getValue().getExpression().add(createPropertyNameType(property));
propIsNotEqualTo.getValue().getExpression().add(createLiteralType(literal));
return propIsNotEqualTo;
case PROPERTY_IS_GREATER_THAN:
JAXBElement<BinaryComparisonOpType> propIsGreaterThan = filterObjectFactory.createPropertyIsGreaterThan(new BinaryComparisonOpType());
propIsGreaterThan.getValue().getExpression().add(createPropertyNameType(property));
propIsGreaterThan.getValue().getExpression().add(createLiteralType(literal));
return propIsGreaterThan;
case PROPERTY_IS_GREATER_THAN_OR_EQUAL_TO:
JAXBElement<BinaryComparisonOpType> propIsGreaterThanOrEqualTo = filterObjectFactory.createPropertyIsGreaterThanOrEqualTo(new BinaryComparisonOpType());
propIsGreaterThanOrEqualTo.getValue().getExpression().add(createPropertyNameType(property));
propIsGreaterThanOrEqualTo.getValue().getExpression().add(createLiteralType(literal));
return propIsGreaterThanOrEqualTo;
case PROPERTY_IS_LESS_THAN:
JAXBElement<BinaryComparisonOpType> propIsLessThan = filterObjectFactory.createPropertyIsLessThan(new BinaryComparisonOpType());
propIsLessThan.getValue().getExpression().add(createPropertyNameType(property));
propIsLessThan.getValue().getExpression().add(createLiteralType(literal));
return propIsLessThan;
case PROPERTY_IS_LESS_THAN_OR_EQUAL_TO:
JAXBElement<BinaryComparisonOpType> propIsLessThanOrEqualTo = filterObjectFactory.createPropertyIsLessThanOrEqualTo(new BinaryComparisonOpType());
propIsLessThanOrEqualTo.getValue().getExpression().add(createPropertyNameType(property));
propIsLessThanOrEqualTo.getValue().getExpression().add(createLiteralType(literal));
return propIsLessThanOrEqualTo;
case PROPERTY_IS_LIKE:
JAXBElement<PropertyIsLikeType> propIsLike = filterObjectFactory.createPropertyIsLike(new PropertyIsLikeType());
propIsLike.getValue().setEscapeChar(Wfs20Constants.ESCAPE);
propIsLike.getValue().setSingleChar(SINGLE_CHAR);
propIsLike.getValue().setWildCard(Wfs20Constants.WILD_CARD);
propIsLike.getValue().getExpression().add(createLiteralType(literal));
propIsLike.getValue().getExpression().add(createPropertyNameType(property));
return propIsLike;
default:
throw new UnsupportedOperationException("Unsupported Property Comparison Type");
}
}
use of org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType in project ddf by codice.
the class CswFilterFactory method createPropertyIsLessThan.
private JAXBElement<BinaryComparisonOpType> createPropertyIsLessThan(String propertyName, Object literal) {
BinaryComparisonOpType propertyIsLessThan = new BinaryComparisonOpType();
propertyIsLessThan.getExpression().add(createPropertyNameType(Arrays.asList(new Object[] { propertyName })));
propertyIsLessThan.getExpression().add(createLiteralType(literal));
return filterObjectFactory.createPropertyIsLessThan(propertyIsLessThan);
}
Aggregations