use of net.opengis.ows.x11.DomainType in project ddf by codice.
the class TestCswFilterDelegate 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.x11.DomainType in project ddf by codice.
the class TestCswEndpoint method verifyOperationsMetadata.
/**
* Helper method to verify the OperationsMetadata section matches the endpoint's definition
*
* @param ct The CapabilitiesType to verify
*/
private void verifyOperationsMetadata(CapabilitiesType ct) {
OperationsMetadata om = ct.getOperationsMetadata();
List<Operation> opList = om.getOperation();
ArrayList<String> opNames = new ArrayList<>();
for (Operation op : opList) {
opNames.add(op.getName());
if (StringUtils.equals(CswConstants.TRANSACTION, op.getName()) || StringUtils.equals(CswConstants.GET_RECORDS, op.getName())) {
for (DomainType parameter : op.getParameter()) {
if (StringUtils.equals(CswConstants.CONSTRAINT_LANGUAGE_PARAMETER, parameter.getName())) {
assertThat(parameter.getValue(), contains(CswConstants.CONSTRAINT_LANGUAGE_FILTER, CswConstants.CONSTRAINT_LANGUAGE_CQL));
} else if (StringUtils.equals(CswConstants.TYPE_NAMES_PARAMETER, parameter.getName())) {
// TODO : Remove conditional when GMD Metacard Transformer is merged (DDF-1976)
if (StringUtils.equals(op.getName(), CswConstants.TRANSACTION)) {
assertThat(parameter.getValue(), contains(CswConstants.CSW_RECORD));
} else {
assertThat(parameter.getValue(), hasItems(CswConstants.CSW_RECORD, GmdConstants.GMD_METACARD_TYPE_NAME));
}
}
}
}
}
assertThat(opNames.contains(CswConstants.GET_CAPABILITIES), is(true));
assertThat(opNames.contains(CswConstants.DESCRIBE_RECORD), is(true));
assertThat(opNames.contains(CswConstants.GET_RECORDS), is(true));
assertThat(opNames.contains(CswConstants.GET_RECORD_BY_ID), is(true));
assertThat(opNames.contains(CswConstants.TRANSACTION), is(true));
}
use of net.opengis.ows.x11.DomainType in project ddf by codice.
the class TestCswEndpoint method testGetCapabilitiesTypeFederatedCatalogs.
@Test
public void testGetCapabilitiesTypeFederatedCatalogs() {
GetCapabilitiesType gct = createDefaultGetCapabilitiesType();
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gct);
} catch (CswException e) {
fail("CswException caught during getCapabilities GET request: " + e.getMessage());
}
assertThat(ct, notNullValue());
assertThat(ct.getOperationsMetadata(), notNullValue());
for (Operation operation : ct.getOperationsMetadata().getOperation()) {
if (StringUtils.equals(operation.getName(), CswConstants.GET_RECORDS)) {
for (DomainType constraint : operation.getConstraint()) {
if (StringUtils.equals(constraint.getName(), CswConstants.FEDERATED_CATALOGS)) {
assertThat(constraint.getValue().size(), is(3));
return;
}
}
}
}
fail("Didn't find [" + CswConstants.FEDERATED_CATALOGS + "] in request [" + CswConstants.GET_RECORDS + "]");
}
use of net.opengis.ows.x11.DomainType in project arctic-sea by 52North.
the class OwsEncoderv110 method encodeOwsPossibleValues.
private void encodeOwsPossibleValues(OwsPossibleValues possibleValues, DomainType xdomain) {
if (possibleValues.isAnyValue()) {
xdomain.addNewAnyValue();
} else if (possibleValues.isNoValues()) {
xdomain.addNewNoValues();
} else if (possibleValues.isValuesReference()) {
OwsValuesReference vr = possibleValues.asValuesReference();
ValuesReference xvr = xdomain.addNewValuesReference();
xvr.setReference(vr.getReference().toString());
xvr.setStringValue(vr.getValue());
} else if (possibleValues.isAllowedValues()) {
OwsAllowedValues av = possibleValues.asAllowedValues();
AllowedValues xav = xdomain.addNewAllowedValues();
av.getRestrictions().forEach(restriction -> {
if (restriction.isRange()) {
OwsRange range = restriction.asRange();
RangeType xrange = xav.addNewRange();
range.getLowerBound().map(OwsValue::getValue).ifPresent(v -> xrange.addNewMinimumValue().setStringValue(v));
range.getUpperBound().map(OwsValue::getValue).ifPresent(v -> xrange.addNewMaximumValue().setStringValue(v));
range.getSpacing().map(OwsValue::getValue).ifPresent(v -> xrange.addNewSpacing().setStringValue(v));
xrange.setRangeClosure(Collections.singletonList(range.getType()));
} else if (restriction.isValue()) {
xav.addNewValue().setStringValue(restriction.asValue().getValue());
}
});
}
}
use of net.opengis.ows.x11.DomainType in project ddf by codice.
the class TestCswEndpoint method testCapabilitiesFederatedCatalogs.
@Test
public void testCapabilitiesFederatedCatalogs() {
GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gcr);
} catch (CswException e) {
fail("CswException caught during getCapabilities GET request: " + e.getMessage());
}
assertThat(ct, notNullValue());
assertThat(ct.getOperationsMetadata(), notNullValue());
for (Operation operation : ct.getOperationsMetadata().getOperation()) {
if (StringUtils.equals(operation.getName(), CswConstants.GET_RECORDS)) {
for (DomainType constraint : operation.getConstraint()) {
if (StringUtils.equals(constraint.getName(), CswConstants.FEDERATED_CATALOGS)) {
assertThat(constraint.getValue().size(), is(3));
return;
}
}
}
}
fail("Didn't find [" + CswConstants.FEDERATED_CATALOGS + "] in request [" + CswConstants.GET_RECORDS + "]");
}
Aggregations