use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class TestWfsFilterDelegate method testIntersectsAsNotDisjoint.
@Test
public void testIntersectsAsNotDisjoint() {
WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.Disjoint.toString());
FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
assertTrue(filter.isSetLogicOps());
assertTrue(filter.getLogicOps().getValue() instanceof UnaryLogicOpType);
UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
assertTrue(type.isSetSpatialOps());
assertTrue(type.getSpatialOps().getValue() instanceof BinarySpatialOpType);
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class TestWfsFilterDelegate method testLogicalNotOfLogicals.
@Test
public void testLogicalNotOfLogicals() throws Exception {
String mockProperty = "myPropertyName";
String mockType = "myType";
WfsFilterDelegate delegate = mockFeatureMetacardCreateDelegate(mockProperty, mockType);
FilterType compFilter1 = delegate.propertyIsLike(Metacard.ANY_TEXT, LITERAL, true);
FilterType compFilter2 = delegate.propertyIsLike(Metacard.ANY_TEXT, LITERAL, true);
List<FilterType> subFiltersToBeOred = new ArrayList<>();
subFiltersToBeOred.add(compFilter1);
subFiltersToBeOred.add(compFilter2);
//Perform Test
FilterType filter = delegate.not(delegate.or(subFiltersToBeOred));
//Verify
assertThat(filter.getLogicOps().getName().toString(), is(LOGICAL_NOT_NAME));
UnaryLogicOpType logicOpType = (UnaryLogicOpType) filter.getLogicOps().getValue();
BinaryLogicOpType logicOrType = (BinaryLogicOpType) logicOpType.getLogicOps().getValue();
assertThat(logicOpType.getLogicOps().getName().toString(), is(LOGICAL_OR_NAME));
PropertyIsLikeType compOpsType1 = (PropertyIsLikeType) logicOrType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(0).getValue();
String valRef1 = fetchPropertyIsLikeExpression(compOpsType1, VALUE_REFERENCE);
assertThat(valRef1, is(mockProperty));
String literal1 = fetchPropertyIsLikeExpression(compOpsType1, LITERAL);
assertThat(literal1, is(LITERAL));
PropertyIsLikeType compOpsType2 = (PropertyIsLikeType) logicOrType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(1).getValue();
String valRef2 = fetchPropertyIsLikeExpression(compOpsType2, VALUE_REFERENCE);
assertThat(valRef2, is(mockProperty));
String literal2 = fetchPropertyIsLikeExpression(compOpsType2, LITERAL);
assertThat(literal2, is(LITERAL));
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class TestWfsFilterDelegate method testLogicalNotOfSpatial.
@Test
public void testLogicalNotOfSpatial() throws Exception {
String mockProperty = "myPropertyName";
String mockType = "myType";
WfsFilterDelegate delegate = mockFeatureMetacardCreateDelegate(mockProperty, mockType);
FilterType spatialFilter1 = delegate.dwithin(Metacard.ANY_GEO, "POINT (30 10)", Double.valueOf(1000));
//Perform Test
FilterType filter = delegate.not(spatialFilter1);
//Verify
assertThat(filter.getLogicOps().getName().toString(), is(LOGICAL_NOT_NAME));
UnaryLogicOpType logicOpType = (UnaryLogicOpType) filter.getLogicOps().getValue();
DistanceBufferType spatialOpsType1 = (DistanceBufferType) logicOpType.getSpatialOps().getValue();
assertThat(Double.toString(spatialOpsType1.getDistance().getValue()), is(Double.valueOf(1000).toString()));
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class WfsFilterDelegate method not.
@Override
public FilterType not(FilterType filterToBeNoted) {
FilterType returnFilter = new FilterType();
if (filterToBeNoted == null) {
return returnFilter;
}
UnaryLogicOpType notType = new UnaryLogicOpType();
if (filterToBeNoted.isSetComparisonOps()) {
notType.setComparisonOps(filterToBeNoted.getComparisonOps());
} else if (filterToBeNoted.isSetLogicOps()) {
notType.setLogicOps(filterToBeNoted.getLogicOps());
} else if (filterToBeNoted.isSetSpatialOps()) {
notType.setSpatialOps(filterToBeNoted.getSpatialOps());
} else {
return returnFilter;
}
returnFilter.setLogicOps(filterObjectFactory.createNot(notType));
return returnFilter;
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class CswFilterFactory method buildNotFilter.
public FilterType buildNotFilter(FilterType filter) {
FilterType returnFilter = new FilterType();
if (filter == null) {
return returnFilter;
}
UnaryLogicOpType notType = new UnaryLogicOpType();
if (filter.isSetComparisonOps()) {
notType.setComparisonOps(filter.getComparisonOps());
} else if (filter.isSetLogicOps()) {
notType.setLogicOps(filter.getLogicOps());
} else if (filter.isSetSpatialOps()) {
notType.setSpatialOps(filter.getSpatialOps());
} else {
return returnFilter;
}
returnFilter.setLogicOps(filterObjectFactory.createNot(notType));
return returnFilter;
}
Aggregations