use of com.reprezen.kaizen.oasparser.model3.Operation 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);
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 com.reprezen.kaizen.oasparser.model3.Operation in project ddf by codice.
the class CswFilterDelegateTest 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 com.reprezen.kaizen.oasparser.model3.Operation in project ddf by codice.
the class CswCqlFilterTest 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 com.reprezen.kaizen.oasparser.model3.Operation in project ets-ogcapi-edr10 by opengeospatial.
the class CollectionsTime method zParameterDefinition.
/**
* Abstract Test 40 (/conf/edr/rc-z-definition): Validate that the vertical level query parameters are constructed correctly. (position)
* Abstract Test 56 (/conf/edr/rc-z-definition): Validate that the vertical level query parameters are constructed correctly. (area)
*
* @param testPoint the testPoint under test, never <code>null</code>
* @param model api definition, never <code>null</code>
*/
public void zParameterDefinition(TestPoint testPoint, OpenApi3 model) {
Parameter z = null;
String paramName = "z";
for (Path path : model.getPaths().values()) {
if (testPoint.getPath().equals(path.getPathString())) {
for (Operation op : path.getOperations().values()) {
for (Parameter param : op.getParameters()) {
if (hasName(param)) {
if (param.getName().equals(paramName)) {
z = param;
}
}
}
}
}
}
if (z != null) {
String msg = "Expected property '%s' with value '%s' but was '%s'";
assertEquals(z.getName(), paramName, String.format(msg, "name", paramName, z.getName()));
assertEquals(z.getIn(), "query", String.format(msg, "in", "query", z.getIn()));
assertTrue(isRequired(z), String.format(msg, "required", "true", z.getRequired()));
assertEquals(z.getStyle(), "form", String.format(msg, "style", "form", z.getStyle()));
assertFalse(isExplode(z), String.format(msg, "explode", "false", z.getExplode()));
}
}
use of com.reprezen.kaizen.oasparser.model3.Operation in project ets-ogcapi-edr10 by opengeospatial.
the class CollectionsTime method resolutionxParameterDefinition.
/**
* <pre>
* Requirement A.25: /req/edr/resolution-x-definition Parameter resolution-x
* definition
* </pre>
* NOTE: Not referenced by ATS
*
* @param testPoint the testPoint under test, never <code>null</code>
* @param model api definition, never <code>null</code>
*/
public void resolutionxParameterDefinition(TestPoint testPoint, OpenApi3 model) {
Parameter resolutionx = null;
String paramName = "resolution-x";
for (Path path : model.getPaths().values()) {
if (testPoint.getPath().equals(path.getPathString())) {
for (Operation op : path.getOperations().values()) {
for (Parameter param : op.getParameters()) {
if (hasName(param)) {
if (param.getName().equals(paramName)) {
resolutionx = param;
}
}
}
}
}
}
if (resolutionx != null) {
String msg = "Expected property '%s' with value '%s' but was '%s'";
assertEquals(resolutionx.getName(), paramName, String.format(msg, "name", paramName, resolutionx.getName()));
assertEquals(resolutionx.getIn(), "query", String.format(msg, "in", "query", resolutionx.getIn()));
assertFalse(isRequired(resolutionx), String.format(msg, "required", "false", resolutionx.getRequired()));
assertEquals(resolutionx.getStyle(), "form", String.format(msg, "style", "form", resolutionx.getStyle()));
assertFalse(isExplode(resolutionx), String.format(msg, "explode", "false", resolutionx.getExplode()));
}
}
Aggregations