Search in sources :

Example 86 with FilterType

use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.

the class TestCswFilterDelegate method testConfigurableMetacardMapping.

@Test
public void testConfigurableMetacardMapping() throws JAXBException, SAXException, IOException {
    // Setup
    CswSourceConfiguration cswSourceConfiguration = new CswSourceConfiguration();
    cswSourceConfiguration.putMetacardCswMapping(Core.ID, CswConstants.CSW_IDENTIFIER);
    cswSourceConfiguration.putMetacardCswMapping(Core.MODIFIED, CswConstants.CSW_MODIFIED);
    cswSourceConfiguration.putMetacardCswMapping(Core.CREATED, CswConstants.CSW_CREATED);
    cswSourceConfiguration.putMetacardCswMapping(Metacard.EFFECTIVE, CswConstants.CSW_DATE_SUBMITTED);
    cswSourceConfiguration.putMetacardCswMapping(Metacard.CONTENT_TYPE, CswConstants.CSW_FORMAT);
    cswSourceConfiguration.setCswAxisOrder(CswAxisOrder.LAT_LON);
    cswSourceConfiguration.setUsePosList(false);
    String contentType = "myContentType";
    CswFilterDelegate localCswFilterDelegate = createCswFilterDelegate(cswSourceConfiguration);
    // Perform Test
    /**
         * Incoming query with Metacard.CONTENT_TYPE equal to myContentType. Metacard.CONTENT_TYPE
         * will be mapped to format in the CswFilterDelegate.
         */
    FilterType filterType = localCswFilterDelegate.propertyIsEqualTo(Metacard.CONTENT_TYPE, contentType, isCaseSensitive);
    // Verify
    /**
         * Verify that a PropertyIsEqualTo filter is created with PropertyName of format and Literal
         * equal to myContentType
         */
    assertXMLEqual(configurableContentTypeMappingXml, getXmlFromMarshaller(filterType));
}
Also used : CswSourceConfiguration(org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration) FilterType(net.opengis.filter.v_1_1_0.FilterType) Test(org.junit.Test)

Example 87 with FilterType

use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.

the class TestCswFilterDelegate method getXmlProperty.

private String getXmlProperty(CswFilterDelegate localCswFilterDelegate, String propName, ComparisonOperatorType comparisonOp, Date beginDate, Date endDate, Map<String, Object> propMap) throws JAXBException {
    String extendedComparisonOp = null;
    if (null != propMap) {
        extendedComparisonOp = (String) propMap.get("extendedComparisonOp");
    }
    FilterType filterType = null;
    switch(comparisonOp) {
        case BETWEEN:
            if (!StringUtils.isBlank(extendedComparisonOp) && extendedComparisonOp.equals("relative")) {
                Object duration = propMap.get("duration");
                if (duration instanceof Long) {
                    filterType = localCswFilterDelegate.relative(propName, ((Long) duration).longValue());
                }
            } else {
                filterType = localCswFilterDelegate.during(propName, beginDate, endDate);
            }
            break;
        default:
            break;
    }
    marshaller.marshal(getFilterTypeJaxbElement(filterType), writer);
    String xml = writer.toString();
    LOGGER.debug(xml);
    return xml;
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType)

Example 88 with FilterType

use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.

the class TestCswFilterDelegate method testPropertyLikeAnyText.

@Test
public void testPropertyLikeAnyText() throws JAXBException, SAXException, IOException {
    FilterType filterType = cswFilterDelegateLatLon.propertyIsLike(propertyNameAnyText, likeLiteral, isCaseSensitive);
    assertXMLEqual(propertyIsLikeXmlAnyText, getXmlFromMarshaller(filterType));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) Test(org.junit.Test)

Example 89 with FilterType

use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.

the class TestCswFilterDelegate method testPropertyIsLessThanFloatLiteral.

@Test
public void testPropertyIsLessThanFloatLiteral() throws JAXBException, SAXException, IOException {
    FilterType filterType = cswFilterDelegateLatLon.propertyIsLessThan(propertyName, floatLiteral);
    assertXMLEqual(propertyIsLessThanXmlWithDecimal, getXmlFromMarshaller(filterType));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) Test(org.junit.Test)

Example 90 with FilterType

use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.

the class TestCswFilterDelegate method testPropertyIsLessThanOrEqualToStringLiteralAnyText.

@Test
public void testPropertyIsLessThanOrEqualToStringLiteralAnyText() throws JAXBException, SAXException, IOException {
    FilterType filterType = cswFilterDelegateLatLon.propertyIsLessThanOrEqualTo(propertyNameAnyText, stringLiteral);
    assertXMLEqual(propertyIsLessThanOrEqualToXmlAnyText, getXmlFromMarshaller(filterType));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)212 FilterType (net.opengis.filter.v_1_1_0.FilterType)209 FilterType (net.opengis.filter.v_2_0_0.FilterType)58 ArrayList (java.util.ArrayList)50 JAXBElement (javax.xml.bind.JAXBElement)12 CswSourceConfiguration (org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration)12 BinaryTemporalOpType (net.opengis.filter.v_2_0_0.BinaryTemporalOpType)11 FeatureAttributeDescriptor (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor)11 QName (javax.xml.namespace.QName)10 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)10 LineString (com.vividsolutions.jts.geom.LineString)9 Date (java.util.Date)9 DistanceBufferType (net.opengis.filter.v_2_0_0.DistanceBufferType)9 UnaryLogicOpType (net.opengis.filter.v_2_0_0.UnaryLogicOpType)9 DateTime (org.joda.time.DateTime)8 Method (java.lang.reflect.Method)7 QueryConstraintType (net.opengis.cat.csw.v_2_0_2.QueryConstraintType)7 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)7 TimePeriodType (net.opengis.gml.v_3_2_1.TimePeriodType)7 TimePositionType (net.opengis.gml.v_3_2_1.TimePositionType)7