Search in sources :

Example 26 with UnaryLogicOpType

use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.

the class TestWfsFilterDelegate method testLogicalNotOfComparison.

@Test
public void testLogicalNotOfComparison() throws Exception {
    String mockProperty = "myPropertyName";
    String mockType = "myType";
    WfsFilterDelegate delegate = mockFeatureMetacardCreateDelegate(mockProperty, mockType);
    FilterType filterToBeNoted = delegate.propertyIsLike(Metacard.ANY_TEXT, LITERAL, true);
    //Perform Test
    FilterType filter = delegate.not(filterToBeNoted);
    //Verify
    assertThat(filter.getLogicOps().getName().toString(), is(LOGICAL_NOT_NAME));
    UnaryLogicOpType logicOpType = (UnaryLogicOpType) filter.getLogicOps().getValue();
    PropertyIsLikeType compOpsType1 = (PropertyIsLikeType) logicOpType.getComparisonOps().getValue();
    String valRef1 = fetchPropertyIsLikeExpression(compOpsType1, VALUE_REFERENCE);
    assertThat(valRef1, is(mockProperty));
    String literal1 = fetchPropertyIsLikeExpression(compOpsType1, LITERAL);
    assertThat(literal1, is(LITERAL));
}
Also used : UnaryLogicOpType(net.opengis.filter.v_2_0_0.UnaryLogicOpType) FilterType(net.opengis.filter.v_2_0_0.FilterType) PropertyIsLikeType(net.opengis.filter.v_2_0_0.PropertyIsLikeType) Test(org.junit.Test)

Example 27 with UnaryLogicOpType

use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.

the class TestWfsFilterDelegate method testDisjointAsNotIntersects.

@Test
public void testDisjointAsNotIntersects() throws SAXException, IOException, JAXBException {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.Intersects.toString());
    FilterType filter = delegate.disjoint(Metacard.ANY_GEO, POLYGON);
    assertTrue(filter.getLogicOps().getValue() instanceof UnaryLogicOpType);
    UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
    assertTrue(type.getSpatialOps().getValue() instanceof BinarySpatialOpType);
    assertXMLEqual(MockWfsServer.getNotIntersectsXmlFilter(), getXmlFromMarshaller(filter));
}
Also used : UnaryLogicOpType(net.opengis.filter.v_2_0_0.UnaryLogicOpType) FilterType(net.opengis.filter.v_2_0_0.FilterType) BinarySpatialOpType(net.opengis.filter.v_2_0_0.BinarySpatialOpType) Test(org.junit.Test)

Example 28 with UnaryLogicOpType

use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.

the class TestWfsFilterDelegate method testDisjointAsNotBBox.

@Test
public void testDisjointAsNotBBox() throws SAXException, IOException, JAXBException {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.toString());
    FilterType filter = delegate.disjoint(Metacard.ANY_GEO, POLYGON);
    assertTrue(filter.getLogicOps().getValue() instanceof UnaryLogicOpType);
    UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
    assertTrue(type.getSpatialOps().getValue() instanceof BBOXType);
    assertXMLEqual(MockWfsServer.getNotBboxXmlFilter(), getXmlFromMarshaller(filter));
}
Also used : UnaryLogicOpType(net.opengis.filter.v_2_0_0.UnaryLogicOpType) FilterType(net.opengis.filter.v_2_0_0.FilterType) BBOXType(net.opengis.filter.v_2_0_0.BBOXType) Test(org.junit.Test)

Example 29 with UnaryLogicOpType

use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.

the class TestWfsFilterDelegate method testDwithinAsNotBeyond.

@Test
public void testDwithinAsNotBeyond() {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.Beyond.toString());
    FilterType filter = delegate.dwithin(Metacard.ANY_GEO, POLYGON, DISTANCE);
    assertTrue(filter.getLogicOps().getValue() instanceof UnaryLogicOpType);
    UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
    assertTrue(type.getSpatialOps().getValue() instanceof DistanceBufferType);
}
Also used : UnaryLogicOpType(net.opengis.filter.v_2_0_0.UnaryLogicOpType) FilterType(net.opengis.filter.v_2_0_0.FilterType) DistanceBufferType(net.opengis.filter.v_2_0_0.DistanceBufferType) Test(org.junit.Test)

Example 30 with UnaryLogicOpType

use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project geo-platform by geosdi.

the class NotOperatorHandler method createLogicOps.

/**
 * @param elements
 * @return {@link UnaryLogicOpType}
 */
protected UnaryLogicOpType createLogicOps(@Nonnull(when = NEVER) List<JAXBElement<?>> elements, @Nonnull(when = NEVER) FilterType filter) {
    checkArgument(elements != null, "The Parameter elements must not be null.");
    checkArgument(filter != null, "The Parameter filter must not be null.");
    if (filter.isSetSpatialOps()) {
        elements.add(filter.getSpatialOps());
        filter.setSpatialOps(null);
    }
    UnaryLogicOpType unaryLogicOpType = new UnaryLogicOpType();
    BinaryLogicOpType and = new BinaryLogicOpType();
    and.setComparisonOpsOrSpatialOpsOrLogicOps(elements);
    unaryLogicOpType.setLogicOps(filterFactory.createAnd(and));
    return unaryLogicOpType;
}
Also used : UnaryLogicOpType(org.geosdi.geoplatform.xml.filter.v110.UnaryLogicOpType) BinaryLogicOpType(org.geosdi.geoplatform.xml.filter.v110.BinaryLogicOpType)

Aggregations

Test (org.junit.Test)24 FilterType (net.opengis.filter.v_2_0_0.FilterType)17 UnaryLogicOpType (net.opengis.filter.v_2_0_0.UnaryLogicOpType)17 FilterType (net.opengis.filter.v_1_1_0.FilterType)8 UnaryLogicOpType (net.opengis.filter.v_1_1_0.UnaryLogicOpType)8 DistanceBufferType (net.opengis.filter.v_2_0_0.DistanceBufferType)6 JAXBElement (javax.xml.bind.JAXBElement)5 ArrayList (java.util.ArrayList)4 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)4 PropertyIsLikeType (net.opengis.filter.v_2_0_0.PropertyIsLikeType)4 UnaryLogicOpType (org.geosdi.geoplatform.xml.filter.v110.UnaryLogicOpType)4 Marshaller (javax.xml.bind.Marshaller)2 Unmarshaller (javax.xml.bind.Unmarshaller)2 BBOXType (net.opengis.filter.v_2_0_0.BBOXType)2 BinaryLogicOpType (net.opengis.filter.v_2_0_0.BinaryLogicOpType)2 BinaryLogicOpType (org.geosdi.geoplatform.xml.filter.v110.BinaryLogicOpType)2 BinaryComparisonOperator (org.opengis.filter.BinaryComparisonOperator)2 Filter (org.opengis.filter.Filter)2 Literal (org.opengis.filter.Literal)2 LogicalOperator (org.opengis.filter.LogicalOperator)2