use of net.opengis.ows.v_1_1_0.DomainType in project ddf by codice.
the class TestWfsSource method testSortingAscendingSortingNotSupported.
/**
* Verify that the SortBy is NOT set. In this case, sorting is not supported in the capabilities.
*/
@Test
public void testSortingAscendingSortingNotSupported() throws Exception {
// Setup
final String searchPhrase = "*";
final String mockTemporalFeatureProperty = "myTemporalFeatureProperty";
final String mockFeatureType = "{http://example.com}" + SAMPLE_FEATURE_NAME + 0;
final int pageSize = 1;
// Set ImplementsSorting to FALSE (sorting not supported)
FilterCapabilities mockCapabilitiesSortingNotSupported = MockWfsServer.getFilterCapabilities();
ConformanceType conformance = mockCapabilitiesSortingNotSupported.getConformance();
List<DomainType> domainTypes = conformance.getConstraint();
for (DomainType domainType : domainTypes) {
if (StringUtils.equals(domainType.getName(), "ImplementsSorting")) {
ValueType valueType = new ValueType();
valueType.setValue("FALSE");
domainType.setDefaultValue(valueType);
break;
}
}
WfsSource source = getWfsSource(ONE_TEXT_PROPERTY_SCHEMA, mockCapabilitiesSortingNotSupported, GeospatialUtil.EPSG_4326_URN, 1, false, false, 0);
MetacardMapper mockMetacardMapper = mock(MetacardMapper.class);
when(mockMetacardMapper.getFeatureType()).thenReturn(mockFeatureType);
when(mockMetacardMapper.getSortByTemporalFeatureProperty()).thenReturn(mockTemporalFeatureProperty);
List<MetacardMapper> mappers = new ArrayList<MetacardMapper>(1);
mappers.add(mockMetacardMapper);
source.setMetacardToFeatureMapper(mappers);
QueryImpl query = new QueryImpl(builder.attribute(Metacard.ANY_TEXT).is().like().text(searchPhrase));
query.setPageSize(pageSize);
SortBy sortBy = new SortByImpl(Result.TEMPORAL, SortOrder.ASCENDING);
query.setSortBy(sortBy);
// Perform Test
GetFeatureType featureType = source.buildGetFeatureRequest(query);
// Verify
QueryType queryType = (QueryType) featureType.getAbstractQueryExpression().get(0).getValue();
assertFalse(queryType.isSetAbstractSortingClause());
}
use of net.opengis.ows.v_1_1_0.DomainType 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));
}
use of net.opengis.ows.v_1_1_0.DomainType in project ddf by codice.
the class TestCswCqlFilter method getOperation.
private static Operation getOperation() {
List<DomainType> getRecordsParameters = new ArrayList<>(6);
DomainType typeName = new DomainType();
typeName.setName(CswConstants.TYPE_NAME_PARAMETER);
getRecordsParameters.add(typeName);
DomainType outputSchema = new DomainType();
outputSchema.setName(CswConstants.OUTPUT_SCHEMA_PARAMETER);
getRecordsParameters.add(outputSchema);
DomainType constraintLang = new DomainType();
constraintLang.setName(CswConstants.CONSTRAINT_LANGUAGE_PARAMETER);
getRecordsParameters.add(constraintLang);
DomainType outputFormat = new DomainType();
outputFormat.setName(CswConstants.OUTPUT_FORMAT_PARAMETER);
getRecordsParameters.add(outputFormat);
DomainType resultType = new DomainType();
resultType.setName(CswConstants.RESULT_TYPE_PARAMETER);
getRecordsParameters.add(resultType);
DomainType elementSetName = new DomainType();
elementSetName.setName(CswConstants.ELEMENT_SET_NAME_PARAMETER);
getRecordsParameters.add(elementSetName);
Operation getRecords = new Operation();
getRecords.setName(CswConstants.GET_RECORDS);
getRecords.setParameter(getRecordsParameters);
List<Operation> operations = new ArrayList<>(1);
operations.add(getRecords);
return getRecords;
}
use of net.opengis.ows.v_1_1_0.DomainType in project ddf by codice.
the class AbstractCswSource method readGetRecordsOperation.
/**
* Parses the getRecords {@link Operation} to understand the capabilities of the org.codice.ddf.spatial.ogc.csw.catalog.common.Csw Server. A
* sample GetRecords Operation may look like this:
* <p>
* <pre>
* <ows:Operation name="GetRecords">
* <ows:DCP>
* <ows:HTTP>
* <ows:Get xlink:href="http://www.cubewerx.com/cwcsw.cgi?" />
* <ows:Post xlink:href="http://www.cubewerx.com/cwcsw.cgi" />
* </ows:HTTP>
* </ows:DCP>
* <ows:Parameter name="TypeName">
* <ows:Value>csw:Record</ows:Value>
* </ows:Parameter>
* <ows:Parameter name="outputFormat">
* <ows:Value>application/xml</ows:Value>
* <ows:Value>text/html</ows:Value>
* <ows:Value>text/plain</ows:Value>
* </ows:Parameter>
* <ows:Parameter name="outputSchema">
* <ows:Value>http://www.opengis.net/cat/csw/2.0.2</ows:Value>
* </ows:Parameter>
* <ows:Parameter name="resultType">
* <ows:Value>hits</ows:Value>
* <ows:Value>results</ows:Value>
* <ows:Value>validate</ows:Value>
* </ows:Parameter>
* <ows:Parameter name="ElementSetName">
* <ows:Value>brief</ows:Value>
* <ows:Value>summary</ows:Value>
* <ows:Value>full</ows:Value>
* </ows:Parameter>
* <ows:Parameter name="CONSTRAINTLANGUAGE">
* <ows:Value>Filter</ows:Value>
* </ows:Parameter>
* </ows:Operation>
* </pre>
*
* @param capabilitiesType The capabilities the org.codice.ddf.spatial.ogc.csw.catalog.common.Csw Server supports
*/
private void readGetRecordsOperation(CapabilitiesType capabilitiesType) {
OperationsMetadata operationsMetadata = capabilitiesType.getOperationsMetadata();
if (null == operationsMetadata) {
LOGGER.info("{}: CSW Source contains no operations", cswSourceConfiguration.getId());
return;
}
description = capabilitiesType.getServiceIdentification().getAbstract();
Operation getRecordsOp = getOperation(operationsMetadata, CswConstants.GET_RECORDS);
if (null == getRecordsOp) {
LOGGER.info("{}: CSW Source contains no getRecords Operation", cswSourceConfiguration.getId());
return;
}
this.supportedOutputSchemas = getParameter(getRecordsOp, CswConstants.OUTPUT_SCHEMA_PARAMETER);
DomainType constraintLanguage = getParameter(getRecordsOp, CswConstants.CONSTRAINT_LANGUAGE_PARAMETER);
if (null != constraintLanguage) {
DomainType outputFormatValues = getParameter(getRecordsOp, CswConstants.OUTPUT_FORMAT_PARAMETER);
DomainType resultTypesValues = getParameter(getRecordsOp, CswConstants.RESULT_TYPE_PARAMETER);
readSetDetailLevels(getParameter(getRecordsOp, CswConstants.ELEMENT_SET_NAME_PARAMETER));
List<String> constraints = new ArrayList<>();
for (String s : constraintLanguage.getValue()) {
constraints.add(s.toLowerCase());
}
if (constraints.contains(CswConstants.CONSTRAINT_LANGUAGE_CQL.toLowerCase()) && !constraints.contains(CswConstants.CONSTRAINT_LANGUAGE_FILTER.toLowerCase())) {
isConstraintCql = true;
} else {
isConstraintCql = false;
}
setFilterDelegate(getRecordsOp, capabilitiesType.getFilterCapabilities(), outputFormatValues, resultTypesValues, cswSourceConfiguration);
spatialCapabilities = capabilitiesType.getFilterCapabilities().getSpatialCapabilities();
if (!NO_FORCE_SPATIAL_FILTER.equals(forceSpatialFilter)) {
SpatialOperatorType sot = new SpatialOperatorType();
SpatialOperatorNameType sont = SpatialOperatorNameType.fromValue(forceSpatialFilter);
sot.setName(sont);
sot.setGeometryOperands(cswFilterDelegate.getGeoOpsForSpatialOp(sont));
SpatialOperatorsType spatialOperators = new SpatialOperatorsType();
spatialOperators.setSpatialOperator(Arrays.asList(sot));
cswFilterDelegate.setSpatialOps(spatialOperators);
}
}
}
use of net.opengis.ows.v_1_1_0.DomainType in project ddf by codice.
the class CswEndpoint method addOperationParameter.
private void addOperationParameter(String name, List<String> params, Operation op) {
DomainType dt = createDomainType(name, params);
op.getParameter().add(dt);
}
Aggregations