Search in sources :

Example 6 with FilterCapabilities

use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method intersectsMultiple.

private void intersectsMultiple(boolean indexed) {
    List<String> gmlProps = new ArrayList<>();
    gmlProps.add(MOCK_GEOM);
    gmlProps.add(MOCK_GEOM2);
    when(mockFeatureMetacardType.getGmlProperties()).thenReturn(gmlProps);
    for (String gmlProp : gmlProps) {
        when(mockFeatureMetacardType.getAttributeDescriptor(gmlProp)).thenReturn(new FeatureAttributeDescriptor(gmlProp, gmlProp, indexed, false, false, false, BasicTypes.STRING_TYPE));
    }
    SpatialOperatorType operator = new SpatialOperatorType();
    operator.setName(SPATIAL_OPERATORS.Intersects.toString());
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().clear();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().add(operator);
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
    FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    if (indexed) {
        assertNotNull(filter);
        assertTrue(filter.isSetLogicOps());
        assertNotNull(filter.getLogicOps());
    } else {
        assertNull(filter);
    }
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) FilterType(net.opengis.filter.v_2_0_0.FilterType) FeatureAttributeDescriptor(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor) SpatialOperatorType(net.opengis.filter.v_2_0_0.SpatialOperatorType) ArrayList(java.util.ArrayList)

Example 7 with FilterCapabilities

use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method testNoConformance.

@Test
public void testNoConformance() {
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    capabilities.setConformance(null);
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
    assertThat(delegate.isLogicalOps(), is(true));
    assertThat(delegate.isEpsg4326(), is(true));
    assertThat(delegate.isSortingSupported(), is(false));
    assertThat(delegate.getSrsName(), is(GeospatialUtil.EPSG_4326_URN));
    assertThat(delegate.getComparisonOps().size(), is(COMPARISON_OPERATORS.values().length));
    assertThat(delegate.getGeometryOperands().size(), greaterThan(0));
    assertThat(delegate.getSpatialOps().size(), is(SPATIAL_OPERATORS.values().length));
    assertThat(delegate.getTemporalOps().size(), is(TEMPORAL_OPERATORS.values().length));
    assertThat(delegate.getTemporalOperands().size(), greaterThan(0));
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) Test(org.junit.Test)

Example 8 with FilterCapabilities

use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method testConformanceAllowedValues.

@Test
public void testConformanceAllowedValues() {
    // Setup
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    ConformanceType conformance = capabilities.getConformance();
    List<DomainType> domainTypes = conformance.getConstraint();
    for (DomainType domainType : domainTypes) {
        if (StringUtils.equals(domainType.getName(), "ImplementsSorting")) {
            domainType.setNoValues(null);
            ValueType asc = new ValueType();
            asc.setValue("ASC");
            ValueType desc = new ValueType();
            desc.setValue("DESC");
            AllowedValues allowedValues = new AllowedValues();
            List<Object> values = new ArrayList<>();
            values.add(asc);
            values.add(desc);
            allowedValues.setValueOrRange(values);
            domainType.setAllowedValues(allowedValues);
            ValueType defaultValue = new ValueType();
            defaultValue.setValue("ASC");
            domainType.setDefaultValue(defaultValue);
            break;
        }
    }
    // Perform Test
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
    // Verify
    assertThat(delegate.isSortingSupported(), is(true));
    assertThat(delegate.getAllowedSortOrders().size(), is(2));
    assertThat(delegate.getAllowedSortOrders().contains(SortOrder.ASCENDING), is(true));
    assertThat(delegate.getAllowedSortOrders().contains(SortOrder.DESCENDING), is(true));
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) DomainType(net.opengis.ows.v_1_1_0.DomainType) AllowedValues(net.opengis.ows.v_1_1_0.AllowedValues) ValueType(net.opengis.ows.v_1_1_0.ValueType) ArrayList(java.util.ArrayList) ConformanceType(net.opengis.filter.v_2_0_0.ConformanceType) Test(org.junit.Test)

Example 9 with FilterCapabilities

use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method setupFilterDelegate.

private WfsFilterDelegate setupFilterDelegate(String spatialOpType) {
    List<String> gmlProps = new ArrayList<>();
    gmlProps.add(MOCK_GEOM);
    when(mockFeatureMetacardType.getGmlProperties()).thenReturn(gmlProps);
    when(mockFeatureMetacardType.getAttributeDescriptor(MOCK_GEOM)).thenReturn(new FeatureAttributeDescriptor(MOCK_GEOM, MOCK_GEOM, true, false, false, false, BasicTypes.STRING_TYPE));
    SpatialOperatorType operator = new SpatialOperatorType();
    operator.setName(spatialOpType);
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().clear();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().add(operator);
    return new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) FeatureAttributeDescriptor(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor) SpatialOperatorType(net.opengis.filter.v_2_0_0.SpatialOperatorType) ArrayList(java.util.ArrayList)

Example 10 with FilterCapabilities

use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method setupFilterCapabilities.

private FilterCapabilities setupFilterCapabilities() {
    FilterCapabilities filterCapabilities = new FilterCapabilities();
    TemporalCapabilitiesType temporal = new TemporalCapabilitiesType();
    temporal.setTemporalOperators(new TemporalOperatorsType());
    TemporalOperatorType duringOperator = new TemporalOperatorType();
    duringOperator.setName(TEMPORAL_OPERATORS.During.name());
    temporal.getTemporalOperators().getTemporalOperator().add(duringOperator);
    TemporalOperandsType temporalOperands = new TemporalOperandsType();
    List<QName> timeQNames = Arrays.asList(new QName(Wfs20Constants.GML_3_2_NAMESPACE, "TimePeriod"), new QName(Wfs20Constants.GML_3_2_NAMESPACE, "TimeInstant"));
    for (QName qName : timeQNames) {
        TemporalOperandsType.TemporalOperand operand = new TemporalOperandsType.TemporalOperand();
        operand.setName(qName);
        temporalOperands.getTemporalOperand().add(operand);
    }
    temporal.setTemporalOperands(temporalOperands);
    filterCapabilities.setTemporalCapabilities(temporal);
    return filterCapabilities;
}
Also used : TemporalCapabilitiesType(net.opengis.filter.v_2_0_0.TemporalCapabilitiesType) FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) TemporalOperatorType(net.opengis.filter.v_2_0_0.TemporalOperatorType) QName(javax.xml.namespace.QName) TemporalOperatorsType(net.opengis.filter.v_2_0_0.TemporalOperatorsType) TemporalOperandsType(net.opengis.filter.v_2_0_0.TemporalOperandsType)

Aggregations

FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)17 ArrayList (java.util.ArrayList)15 Test (org.junit.Test)12 FilterType (net.opengis.filter.v_2_0_0.FilterType)7 FilterCapabilities (net.opengis.filter.v_1_1_0.FilterCapabilities)6 SpatialOperatorType (net.opengis.filter.v_2_0_0.SpatialOperatorType)6 ComparisonOperatorsType (net.opengis.filter.v_1_1_0.ComparisonOperatorsType)5 LogicalOperators (net.opengis.filter.v_1_1_0.LogicalOperators)5 ScalarCapabilitiesType (net.opengis.filter.v_1_1_0.ScalarCapabilitiesType)5 FeatureAttributeDescriptor (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor)5 QName (javax.xml.namespace.QName)4 SpatialCapabilitiesType (net.opengis.filter.v_1_1_0.SpatialCapabilitiesType)4 SpatialOperatorsType (net.opengis.filter.v_1_1_0.SpatialOperatorsType)4 Date (java.util.Date)3 SpatialOperatorType (net.opengis.filter.v_1_1_0.SpatialOperatorType)3 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)3 BinaryTemporalOpType (net.opengis.filter.v_2_0_0.BinaryTemporalOpType)3 ConformanceType (net.opengis.filter.v_2_0_0.ConformanceType)3 GeometryOperand (net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand)3 TimePeriodType (net.opengis.gml.v_3_2_1.TimePeriodType)3