use of net.opengis.filter.v_1_1_0.ComparisonOperatorType in project ddf by codice.
the class TestWfsFilterDelegate method makeDelegateForLogicalSupportTests.
private WfsFilterDelegate makeDelegateForLogicalSupportTests() {
String mockProperty = "myPropertyName";
String mockType = "myType";
List<String> mockProperties = new ArrayList<>(1);
mockProperties.add(mockProperty);
when(mockFeatureMetacardType.getProperties()).thenReturn(mockProperties);
when(mockFeatureMetacardType.getGmlProperties()).thenReturn(mockProperties);
when(mockFeatureMetacardType.getTextualProperties()).thenReturn(mockProperties);
when(mockFeatureMetacardType.getTemporalProperties()).thenReturn(mockProperties);
when(mockFeatureMetacardType.getName()).thenReturn(mockType);
FeatureAttributeDescriptor mockFeatureAttributeDescriptor = mock(FeatureAttributeDescriptor.class);
when(mockFeatureAttributeDescriptor.isIndexed()).thenReturn(true);
when(mockFeatureAttributeDescriptor.getPropertyName()).thenReturn(mockProperty);
when(mockFeatureMetacardType.getAttributeDescriptor(mockProperty)).thenReturn(mockFeatureAttributeDescriptor);
FilterCapabilities filterCap = MockWfsServer.getFilterCapabilities();
//Create new ScalarCapabiltiesType without Logical Operator support
ScalarCapabilitiesType scalar = new ScalarCapabilitiesType();
scalar.setComparisonOperators(new ComparisonOperatorsType());
for (COMPARISON_OPERATORS compOp : COMPARISON_OPERATORS.values()) {
ComparisonOperatorType operator = new ComparisonOperatorType();
operator.setName(compOp.toString());
scalar.getComparisonOperators().getComparisonOperator().add(operator);
}
filterCap.setScalarCapabilities(scalar);
return new WfsFilterDelegate(mockFeatureMetacardType, filterCap, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
}
use of net.opengis.filter.v_1_1_0.ComparisonOperatorType 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;
}
use of net.opengis.filter.v_1_1_0.ComparisonOperatorType in project ddf by codice.
the class CswFilterDelegateTest 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;
}
use of net.opengis.filter.v_1_1_0.ComparisonOperatorType in project ddf by codice.
the class CswEndpointTest method verifyFilterCapabilities.
/**
* Helper method to verify the FilterCapabilities section matches the endpoint's definition
*
* @param ct The CapabilitiesType to verify
*/
private void verifyFilterCapabilities(CapabilitiesType ct) {
FilterCapabilities fc = ct.getFilterCapabilities();
assertThat(fc.getIdCapabilities(), notNullValue());
assertThat(fc.getIdCapabilities().getEIDOrFID(), hasSize(1));
assertThat(fc.getScalarCapabilities(), notNullValue());
assertThat(CswEndpoint.COMPARISON_OPERATORS, hasSize(fc.getScalarCapabilities().getComparisonOperators().getComparisonOperator().size()));
for (ComparisonOperatorType cot : CswEndpoint.COMPARISON_OPERATORS) {
assertThat(fc.getScalarCapabilities().getComparisonOperators().getComparisonOperator(), hasItem(cot));
}
assertThat(fc.getSpatialCapabilities(), notNullValue());
assertThat(CswEndpoint.SPATIAL_OPERATORS, hasSize(fc.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().size()));
for (SpatialOperatorType sot : fc.getSpatialCapabilities().getSpatialOperators().getSpatialOperator()) {
assertThat(CswEndpoint.SPATIAL_OPERATORS, hasItem(sot.getName()));
}
}
use of net.opengis.filter.v_1_1_0.ComparisonOperatorType in project ddf by codice.
the class WfsFilterDelegate method updateAllowedOperations.
private void updateAllowedOperations(FilterCapabilities filterCapabilities) {
comparisonOps = Collections.newSetFromMap(new ConcurrentHashMap<>(new EnumMap<>(COMPARISON_OPERATORS.class)));
geometryOperands = new ArrayList<>();
temporalOperands = new ArrayList<>();
if (filterCapabilities == null) {
LOGGER.debug("WFS 2.0 Service doesn't support any filters");
return;
}
// CONFORMANCE
configureConformance(filterCapabilities.getConformance());
ScalarCapabilitiesType scalarCapabilities = filterCapabilities.getScalarCapabilities();
if (scalarCapabilities != null) {
// LOGICAL OPERATORS
if (scalarCapabilities.getLogicalOperators() != null) {
logicalOps = true;
}
// COMPARISON OPERATORS
ComparisonOperatorsType comparisonOperators = scalarCapabilities.getComparisonOperators();
if (comparisonOperators != null) {
for (ComparisonOperatorType comp : comparisonOperators.getComparisonOperator()) {
if (null != comp) {
comparisonOps.add(COMPARISON_OPERATORS.getEnum(comp.getName()));
}
}
}
}
// SPATIAL OPERATORS
SpatialCapabilitiesType spatialCapabilities = filterCapabilities.getSpatialCapabilities();
if (spatialCapabilities != null) {
if (spatialCapabilities.getSpatialOperators() != null) {
setSpatialOps(spatialCapabilities.getSpatialOperators());
}
// GEOMETRY OPERANDS
GeometryOperandsType geometryOperandsType = spatialCapabilities.getGeometryOperands();
if (geometryOperandsType != null) {
for (GeometryOperandsType.GeometryOperand geoOperand : geometryOperandsType.getGeometryOperand()) {
if (geoOperand.getName() != null) {
geometryOperands.add(geoOperand.getName());
}
}
LOGGER.debug("geometryOperands: {}", geometryOperands);
}
}
// TEMPORAL OPERATORS
TemporalCapabilitiesType temporalCapabilitiesType = filterCapabilities.getTemporalCapabilities();
if (temporalCapabilitiesType != null) {
if (temporalCapabilitiesType.getTemporalOperators() != null) {
setTemporalOps(temporalCapabilitiesType.getTemporalOperators());
}
// TEMPORAL OPERANDS
TemporalOperandsType temporalOperandsType = temporalCapabilitiesType.getTemporalOperands();
if (temporalOperandsType != null) {
for (TemporalOperandsType.TemporalOperand temporalOperand : temporalOperandsType.getTemporalOperand()) {
if (temporalOperand.getName() != null) {
temporalOperands.add(temporalOperand.getName());
}
}
LOGGER.debug("temporalOperands: {}", temporalOperands);
}
}
}
Aggregations