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));
}
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));
}
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));
}
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);
}
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;
}
Aggregations