Search in sources :

Example 11 with BinaryComparisonOpType

use of net.opengis.fes.x20.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));
}
Also used : BinaryComparisonOpType(net.opengis.filter.v_1_1_0.BinaryComparisonOpType) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 12 with BinaryComparisonOpType

use of net.opengis.fes.x20.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);
}
Also used : BinaryComparisonOpType(net.opengis.filter.v_1_1_0.BinaryComparisonOpType) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 13 with BinaryComparisonOpType

use of net.opengis.fes.x20.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 PropertyIsEqualTo:
            JAXBElement<BinaryComparisonOpType> propIsEqualTo = filterObjectFactory.createPropertyIsEqualTo(new BinaryComparisonOpType());
            propIsEqualTo.getValue().getExpression().add(createPropertyNameType(property));
            propIsEqualTo.getValue().getExpression().add(createLiteralType(literal));
            return propIsEqualTo;
        case PropertyIsNotEqualTo:
            JAXBElement<BinaryComparisonOpType> propIsNotEqualTo = filterObjectFactory.createPropertyIsNotEqualTo(new BinaryComparisonOpType());
            propIsNotEqualTo.getValue().getExpression().add(createPropertyNameType(property));
            propIsNotEqualTo.getValue().getExpression().add(createLiteralType(literal));
            return propIsNotEqualTo;
        case PropertyIsGreaterThan:
            JAXBElement<BinaryComparisonOpType> propIsGreaterThan = filterObjectFactory.createPropertyIsGreaterThan(new BinaryComparisonOpType());
            propIsGreaterThan.getValue().getExpression().add(createPropertyNameType(property));
            propIsGreaterThan.getValue().getExpression().add(createLiteralType(literal));
            return propIsGreaterThan;
        case PropertyIsGreaterThanOrEqualTo:
            JAXBElement<BinaryComparisonOpType> propIsGreaterThanOrEqualTo = filterObjectFactory.createPropertyIsGreaterThanOrEqualTo(new BinaryComparisonOpType());
            propIsGreaterThanOrEqualTo.getValue().getExpression().add(createPropertyNameType(property));
            propIsGreaterThanOrEqualTo.getValue().getExpression().add(createLiteralType(literal));
            return propIsGreaterThanOrEqualTo;
        case PropertyIsLessThan:
            JAXBElement<BinaryComparisonOpType> propIsLessThan = filterObjectFactory.createPropertyIsLessThan(new BinaryComparisonOpType());
            propIsLessThan.getValue().getExpression().add(createPropertyNameType(property));
            propIsLessThan.getValue().getExpression().add(createLiteralType(literal));
            return propIsLessThan;
        case PropertyIsLessThanOrEqualTo:
            JAXBElement<BinaryComparisonOpType> propIsLessThanOrEqualTo = filterObjectFactory.createPropertyIsLessThanOrEqualTo(new BinaryComparisonOpType());
            propIsLessThanOrEqualTo.getValue().getExpression().add(createPropertyNameType(property));
            propIsLessThanOrEqualTo.getValue().getExpression().add(createLiteralType(literal));
            return propIsLessThanOrEqualTo;
        case PropertyIsLike:
            JAXBElement<PropertyIsLikeType> propIsLike = filterObjectFactory.createPropertyIsLike(new PropertyIsLikeType());
            propIsLike.getValue().setPropertyName(createPropertyNameType(property).getValue());
            propIsLike.getValue().setEscape(WfsConstants.ESCAPE);
            propIsLike.getValue().setSingleChar(SINGLE_CHAR);
            propIsLike.getValue().setWildCard(WfsConstants.WILD_CARD);
            propIsLike.getValue().setLiteral(createLiteralType(literal).getValue());
            return propIsLike;
        default:
            throw new UnsupportedOperationException("Unsupported Property Comparison Type");
    }
}
Also used : BinaryComparisonOpType(ogc.schema.opengis.filter.v_1_0_0.BinaryComparisonOpType) PropertyIsLikeType(ogc.schema.opengis.filter.v_1_0_0.PropertyIsLikeType)

Example 14 with BinaryComparisonOpType

use of net.opengis.fes.x20.BinaryComparisonOpType in project arctic-sea by 52North.

the class FesDecoderV20Test method should_parse_PropertyIsEqualTo_Filter.

/**
 * Test PropertyIsEqualTo filter decoding
 *
 * @throws OwsExceptionReport
 */
@Test
public void should_parse_PropertyIsEqualTo_Filter() throws DecodingException {
    PropertyIsEqualToDocument propertyIsEqualToDoc = PropertyIsEqualToDocument.Factory.newInstance();
    BinaryComparisonOpType propertyIsEqualToType = propertyIsEqualToDoc.addNewPropertyIsEqualTo();
    // valueReference
    XmlString valueReference = (XmlString) propertyIsEqualToType.addNewExpression().substitute(FilterConstants.QN_VALUE_REFERENCE, XmlString.type);
    valueReference.setStringValue(TEST_VALUE_REFERENCE);
    // literal
    LiteralType literalType = (LiteralType) propertyIsEqualToType.addNewExpression().substitute(FilterConstants.QN_LITERAL, LiteralType.type);
    XmlString newInstance = XmlString.Factory.newInstance();
    newInstance.setStringValue(TEST_LITERAL);
    literalType.set(newInstance);
    // create document
    FilterDocument filterDoc = FilterDocument.Factory.newInstance();
    FilterType filterType = filterDoc.addNewFilter();
    filterType.setComparisonOps(propertyIsEqualToType);
    filterType.getComparisonOps().substitute(FilterConstants.QN_PROPERTY_IS_EQUAL_TO, BinaryComparisonOpType.type);
    ComparisonFilter comparisonFilter = (ComparisonFilter) decoder.decode(filterDoc);
    // test
    assertThat(comparisonFilter.getOperator(), is(FilterConstants.ComparisonOperator.PropertyIsEqualTo));
    assertThat(comparisonFilter.getValueReference(), is(TEST_VALUE_REFERENCE));
    assertThat(comparisonFilter.getValue(), is(TEST_LITERAL));
}
Also used : PropertyIsEqualToDocument(net.opengis.fes.x20.PropertyIsEqualToDocument) FilterType(net.opengis.fes.x20.FilterType) ComparisonFilter(org.n52.shetland.ogc.filter.ComparisonFilter) XmlString(org.apache.xmlbeans.XmlString) LiteralType(net.opengis.fes.x20.LiteralType) FilterDocument(net.opengis.fes.x20.FilterDocument) BinaryComparisonOpType(net.opengis.fes.x20.BinaryComparisonOpType) Test(org.junit.Test)

Aggregations

BinaryComparisonOpType (net.opengis.filter.v_1_1_0.BinaryComparisonOpType)11 Test (org.junit.Test)5 Ignore (org.junit.Ignore)3 BinaryComparisonOpType (net.opengis.fes.x20.BinaryComparisonOpType)1 FilterDocument (net.opengis.fes.x20.FilterDocument)1 FilterType (net.opengis.fes.x20.FilterType)1 LiteralType (net.opengis.fes.x20.LiteralType)1 PropertyIsEqualToDocument (net.opengis.fes.x20.PropertyIsEqualToDocument)1 LiteralType (net.opengis.filter.v_1_1_0.LiteralType)1 PropertyNameType (net.opengis.filter.v_1_1_0.PropertyNameType)1 BinaryComparisonOpType (net.opengis.filter.v_2_0_0.BinaryComparisonOpType)1 PropertyIsLikeType (net.opengis.filter.v_2_0_0.PropertyIsLikeType)1 BinaryComparisonOpType (ogc.schema.opengis.filter.v_1_0_0.BinaryComparisonOpType)1 PropertyIsLikeType (ogc.schema.opengis.filter.v_1_0_0.PropertyIsLikeType)1 XmlString (org.apache.xmlbeans.XmlString)1 ComparisonFilter (org.n52.shetland.ogc.filter.ComparisonFilter)1