Search in sources :

Example 1 with BinaryComparisonOpType

use of org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType in project ddf by codice.

the class CswFilterFactory method createPropertyIsGreaterThan.

private JAXBElement<BinaryComparisonOpType> createPropertyIsGreaterThan(String propertyName, Object literal) {
    BinaryComparisonOpType propertyIsGreaterThan = new BinaryComparisonOpType();
    propertyIsGreaterThan.getExpression().add(createPropertyNameType(Arrays.asList(new Object[] { propertyName })));
    propertyIsGreaterThan.getExpression().add(createLiteralType(literal));
    return filterObjectFactory.createPropertyIsGreaterThan(propertyIsGreaterThan);
}
Also used : BinaryComparisonOpType(net.opengis.filter.v_1_1_0.BinaryComparisonOpType)

Example 2 with BinaryComparisonOpType

use of org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType in project ddf by codice.

the class WfsFilterDelegate method createPropertyIsFilter.

private JAXBElement<? extends ComparisonOpsType> createPropertyIsFilter(String property, Object literal, PROPERTY_IS_OPS operation, boolean isCaseSensitive) {
    switch(operation) {
        case PropertyIsEqualTo:
            JAXBElement<BinaryComparisonOpType> propIsEqualTo = filterObjectFactory.createPropertyIsEqualTo(new BinaryComparisonOpType());
            propIsEqualTo.getValue().getExpression().add(createPropertyNameType(property));
            propIsEqualTo.getValue().getExpression().add(createLiteralType(literal));
            propIsEqualTo.getValue().setMatchCase(isCaseSensitive);
            return propIsEqualTo;
        case PropertyIsNotEqualTo:
            JAXBElement<BinaryComparisonOpType> propIsNotEqualTo = filterObjectFactory.createPropertyIsNotEqualTo(new BinaryComparisonOpType());
            propIsNotEqualTo.getValue().getExpression().add(createPropertyNameType(property));
            propIsNotEqualTo.getValue().getExpression().add(createLiteralType(literal));
            propIsNotEqualTo.getValue().setMatchCase(isCaseSensitive);
            return propIsNotEqualTo;
        case PropertyIsGreaterThan:
            JAXBElement<BinaryComparisonOpType> propIsGreaterThan = filterObjectFactory.createPropertyIsGreaterThan(new BinaryComparisonOpType());
            propIsGreaterThan.getValue().getExpression().add(createPropertyNameType(property));
            propIsGreaterThan.getValue().getExpression().add(createLiteralType(literal));
            propIsGreaterThan.getValue().setMatchCase(isCaseSensitive);
            return propIsGreaterThan;
        case PropertyIsGreaterThanOrEqualTo:
            JAXBElement<BinaryComparisonOpType> propIsGreaterThanOrEqualTo = filterObjectFactory.createPropertyIsGreaterThanOrEqualTo(new BinaryComparisonOpType());
            propIsGreaterThanOrEqualTo.getValue().getExpression().add(createPropertyNameType(property));
            propIsGreaterThanOrEqualTo.getValue().getExpression().add(createLiteralType(literal));
            propIsGreaterThanOrEqualTo.getValue().setMatchCase(isCaseSensitive);
            return propIsGreaterThanOrEqualTo;
        case PropertyIsLessThan:
            JAXBElement<BinaryComparisonOpType> propIsLessThan = filterObjectFactory.createPropertyIsLessThan(new BinaryComparisonOpType());
            propIsLessThan.getValue().getExpression().add(createPropertyNameType(property));
            propIsLessThan.getValue().getExpression().add(createLiteralType(literal));
            propIsLessThan.getValue().setMatchCase(isCaseSensitive);
            return propIsLessThan;
        case PropertyIsLessThanOrEqualTo:
            JAXBElement<BinaryComparisonOpType> propIsLessThanOrEqualTo = filterObjectFactory.createPropertyIsLessThanOrEqualTo(new BinaryComparisonOpType());
            propIsLessThanOrEqualTo.getValue().getExpression().add(createPropertyNameType(property));
            propIsLessThanOrEqualTo.getValue().getExpression().add(createLiteralType(literal));
            propIsLessThanOrEqualTo.getValue().setMatchCase(isCaseSensitive);
            return propIsLessThanOrEqualTo;
        case PropertyIsLike:
            JAXBElement<PropertyIsLikeType> propIsLike = filterObjectFactory.createPropertyIsLike(new PropertyIsLikeType());
            propIsLike.getValue().setPropertyName(createPropertyNameType(property).getValue());
            propIsLike.getValue().setEscapeChar(escapeChar);
            propIsLike.getValue().setSingleChar(singleChar);
            propIsLike.getValue().setWildCard(wildcardChar);
            final String literalReplaced = replaceSpecialPropertyIsLikeChars((String) literal);
            propIsLike.getValue().setLiteral(createLiteralType(literalReplaced).getValue());
            propIsLike.getValue().setMatchCase(isCaseSensitive);
            return propIsLike;
        default:
            throw new UnsupportedOperationException("Unsupported Property Comparison Type");
    }
}
Also used : LineString(org.locationtech.jts.geom.LineString) BinaryComparisonOpType(net.opengis.filter.v_1_1_0.BinaryComparisonOpType) PropertyIsLikeType(net.opengis.filter.v_1_1_0.PropertyIsLikeType)

Example 3 with BinaryComparisonOpType

use of org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType in project ddf by codice.

the class CswQueryFactoryTest method testPostGetRecordsTemporalPropertyIsLessOgcFilter.

@Test
public void testPostGetRecordsTemporalPropertyIsLessOgcFilter() throws CswException, UnsupportedQueryException, SourceUnavailableException, FederationException {
    BinaryComparisonOpType op = createTemporalBinaryComparisonOpType(CswConstants.CSW_CREATED, TIMESTAMP);
    ogcTemporalQuery(Core.CREATED, filterObjectFactory.createPropertyIsLessThan(op), Before.class);
}
Also used : BinaryComparisonOpType(net.opengis.filter.v_1_1_0.BinaryComparisonOpType) Test(org.junit.Test)

Example 4 with BinaryComparisonOpType

use of org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType in project ddf by codice.

the class CswQueryFactoryTest method testPostGetRecordsTemporalPropertyIsLessOrEqualOgcFilter.

@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 testPostGetRecordsTemporalPropertyIsLessOrEqualOgcFilter() throws CswException, UnsupportedQueryException, SourceUnavailableException, FederationException {
    BinaryComparisonOpType op = createTemporalBinaryComparisonOpType(CswConstants.CSW_CREATED, TIMESTAMP);
    ogcOrdTemporalQuery(filterObjectFactory.createPropertyIsLessThanOrEqualTo(op));
}
Also used : BinaryComparisonOpType(net.opengis.filter.v_1_1_0.BinaryComparisonOpType) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 5 with BinaryComparisonOpType

use of org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType in project ddf by codice.

the class CswQueryFactoryTest method createTemporalBinaryComparisonOpType.

private BinaryComparisonOpType createTemporalBinaryComparisonOpType(String attr, String comparison) {
    BinaryComparisonOpType comparisonOp = new BinaryComparisonOpType();
    PropertyNameType propName = new PropertyNameType();
    propName.getContent().add(attr);
    comparisonOp.getExpression().add(filterObjectFactory.createPropertyName(propName));
    LiteralType literal = new LiteralType();
    literal.getContent().add(comparison);
    comparisonOp.getExpression().add(filterObjectFactory.createLiteral(literal));
    return comparisonOp;
}
Also used : LiteralType(net.opengis.filter.v_1_1_0.LiteralType) BinaryComparisonOpType(net.opengis.filter.v_1_1_0.BinaryComparisonOpType) PropertyNameType(net.opengis.filter.v_1_1_0.PropertyNameType)

Aggregations

Test (org.junit.Test)22 JAXBElement (javax.xml.bind.JAXBElement)21 Marshaller (javax.xml.bind.Marshaller)18 Unmarshaller (javax.xml.bind.Unmarshaller)18 BinaryComparisonOperator (org.opengis.filter.BinaryComparisonOperator)18 Filter (org.opengis.filter.Filter)18 Literal (org.opengis.filter.Literal)18 ValueReference (org.opengis.filter.ValueReference)18 BinaryComparisonOpType (net.opengis.filter.v_1_1_0.BinaryComparisonOpType)13 BinaryComparisonOpType (org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType)9 FilterType (org.geotoolkit.ogc.xml.v100.FilterType)9 LiteralType (org.geotoolkit.ogc.xml.v100.LiteralType)9 PropertyNameType (org.geotoolkit.ogc.xml.v100.PropertyNameType)9 BinaryComparisonOpType (org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType)9 FilterType (org.geotoolkit.ogc.xml.v110.FilterType)9 LiteralType (org.geotoolkit.ogc.xml.v110.LiteralType)9 PropertyNameType (org.geotoolkit.ogc.xml.v110.PropertyNameType)9 ComparisonOpsType (org.geotoolkit.ogc.xml.v110.ComparisonOpsType)7 ComparisonOpsType (org.geotoolkit.ogc.xml.v100.ComparisonOpsType)6 LogicalOperator (org.opengis.filter.LogicalOperator)6