Search in sources :

Example 6 with DomainType

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;
}
Also used : DomainType(net.opengis.ows.v_1_0_0.DomainType) ArrayList(java.util.ArrayList) Operation(net.opengis.ows.v_1_0_0.Operation)

Example 7 with DomainType

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));
}
Also used : OperationsMetadata(net.opengis.ows.v_1_0_0.OperationsMetadata) DomainType(net.opengis.ows.v_1_0_0.DomainType) ArrayList(java.util.ArrayList) Operation(net.opengis.ows.v_1_0_0.Operation)

Example 8 with DomainType

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 + "]");
}
Also used : DomainType(net.opengis.ows.v_1_0_0.DomainType) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Operation(net.opengis.ows.v_1_0_0.Operation) Test(org.junit.Test)

Example 9 with DomainType

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());
            }
        });
    }
}
Also used : SortedSet(java.util.SortedSet) OwsPossibleValues(org.n52.shetland.ogc.ows.OwsPossibleValues) CodedException(org.n52.shetland.ogc.ows.exception.CodedException) LoggerFactory(org.slf4j.LoggerFactory) SectionsType(net.opengis.ows.x11.SectionsType) OwsAllowedValues(org.n52.shetland.ogc.ows.OwsAllowedValues) OwsServiceProvider(org.n52.shetland.ogc.ows.OwsServiceProvider) Show(org.n52.shetland.w3c.xlink.Show) LocalizedString(org.n52.janmayen.i18n.LocalizedString) Map(java.util.Map) KeywordsType(net.opengis.ows.x11.KeywordsType) ActuateType(org.w3.x1999.xlink.ActuateType) RequestMethodType(net.opengis.ows.x11.RequestMethodType) URI(java.net.URI) OwsRequestMethod(org.n52.shetland.ogc.ows.OwsRequestMethod) ServiceIdentification(net.opengis.ows.x11.ServiceIdentificationDocument.ServiceIdentification) OwsValue(org.n52.shetland.ogc.ows.OwsValue) OWSConstants(org.n52.shetland.ogc.ows.OWSConstants) EncodingException(org.n52.svalbard.encode.exception.EncodingException) MetadataType(net.opengis.ows.x11.MetadataType) N52XmlHelper(org.n52.svalbard.util.N52XmlHelper) HTTP(net.opengis.ows.x11.HTTPDocument.HTTP) Actuate(org.n52.shetland.w3c.xlink.Actuate) ResponsiblePartySubsetType(net.opengis.ows.x11.ResponsiblePartySubsetType) Set(java.util.Set) Setting(org.n52.faroe.annotation.Setting) ValuesReference(net.opengis.ows.x11.ValuesReferenceDocument.ValuesReference) LocaleHelper(org.n52.janmayen.i18n.LocaleHelper) OwsMetadata(org.n52.shetland.ogc.ows.OwsMetadata) ExceptionReport(net.opengis.ows.x11.ExceptionReportDocument.ExceptionReport) HTTPMethods(org.n52.janmayen.http.HTTPMethods) Sets(com.google.common.collect.Sets) DomainType(net.opengis.ows.x11.DomainType) LanguageStringType(net.opengis.ows.x11.LanguageStringType) OwsEncoderSettings(org.n52.svalbard.OwsEncoderSettings) List(java.util.List) DCP(net.opengis.ows.x11.DCPDocument.DCP) OnlineResourceType(net.opengis.ows.x11.OnlineResourceType) Stream(java.util.stream.Stream) ExceptionReportDocument(net.opengis.ows.x11.ExceptionReportDocument) SchemaLocation(org.n52.shetland.w3c.SchemaLocation) CodeType(net.opengis.ows.x11.CodeType) TelephoneType(net.opengis.ows.x11.TelephoneType) OwsResponsibleParty(org.n52.shetland.ogc.ows.OwsResponsibleParty) CollectionHelper(org.n52.shetland.util.CollectionHelper) AddressType(net.opengis.ows.x11.AddressType) OperationsMetadata(net.opengis.ows.x11.OperationsMetadataDocument.OperationsMetadata) Optional(java.util.Optional) OwsValuesReference(org.n52.shetland.ogc.ows.OwsValuesReference) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings) OwsAddress(org.n52.shetland.ogc.ows.OwsAddress) Joiner(com.google.common.base.Joiner) MultilingualString(org.n52.janmayen.i18n.MultilingualString) MediaTypes(org.n52.janmayen.http.MediaTypes) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ServiceProvider(net.opengis.ows.x11.ServiceProviderDocument.ServiceProvider) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) OwsDCP(org.n52.shetland.ogc.ows.OwsDCP) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) RangeType(net.opengis.ows.x11.RangeType) OwsAcceptVersions(org.n52.shetland.ogc.ows.OwsAcceptVersions) OwsExceptionCode(org.n52.shetland.ogc.ows.exception.OwsExceptionCode) Collectors.mapping(java.util.stream.Collectors.mapping) ExceptionType(net.opengis.ows.x11.ExceptionType) OwsDomainMetadata(org.n52.shetland.ogc.ows.OwsDomainMetadata) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException) XmlObject(org.apache.xmlbeans.XmlObject) AllowedValues(net.opengis.ows.x11.AllowedValuesDocument.AllowedValues) DomainMetadataType(net.opengis.ows.x11.DomainMetadataType) PrintStream(java.io.PrintStream) OwsOperationMetadataExtension(org.n52.shetland.ogc.ows.OwsOperationMetadataExtension) OwsRange(org.n52.shetland.ogc.ows.OwsRange) Logger(org.slf4j.Logger) AcceptVersionsType(net.opengis.ows.x11.AcceptVersionsType) OwsOnlineResource(org.n52.shetland.ogc.ows.OwsOnlineResource) OwsPhone(org.n52.shetland.ogc.ows.OwsPhone) OwsKeyword(org.n52.shetland.ogc.ows.OwsKeyword) OwsCode(org.n52.shetland.ogc.ows.OwsCode) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport) ShowType(org.w3.x1999.xlink.ShowType) ExceptionDocument(net.opengis.ows.x11.ExceptionDocument) Collectors.toList(java.util.stream.Collectors.toList) OwsContact(org.n52.shetland.ogc.ows.OwsContact) OwsLanguageString(org.n52.shetland.ogc.ows.OwsLanguageString) OwsHttp(org.n52.shetland.ogc.ows.OwsHttp) Configurable(org.n52.faroe.annotation.Configurable) CodingHelper(org.n52.svalbard.util.CodingHelper) OwsSections(org.n52.shetland.ogc.ows.OwsSections) OwsServiceIdentification(org.n52.shetland.ogc.ows.OwsServiceIdentification) ContactType(net.opengis.ows.x11.ContactType) OwsOperation(org.n52.shetland.ogc.ows.OwsOperation) OwsOperationsMetadata(org.n52.shetland.ogc.ows.OwsOperationsMetadata) Operation(net.opengis.ows.x11.OperationDocument.Operation) Collections(java.util.Collections) OwsDomain(org.n52.shetland.ogc.ows.OwsDomain) OwsAllowedValues(org.n52.shetland.ogc.ows.OwsAllowedValues) OwsRange(org.n52.shetland.ogc.ows.OwsRange) RangeType(net.opengis.ows.x11.RangeType) OwsValuesReference(org.n52.shetland.ogc.ows.OwsValuesReference) OwsAllowedValues(org.n52.shetland.ogc.ows.OwsAllowedValues) AllowedValues(net.opengis.ows.x11.AllowedValuesDocument.AllowedValues) ValuesReference(net.opengis.ows.x11.ValuesReferenceDocument.ValuesReference) OwsValuesReference(org.n52.shetland.ogc.ows.OwsValuesReference) OwsValue(org.n52.shetland.ogc.ows.OwsValue)

Example 10 with DomainType

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 + "]");
}
Also used : GetCapabilitiesRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest) DomainType(net.opengis.ows.v_1_0_0.DomainType) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Operation(net.opengis.ows.v_1_0_0.Operation) Test(org.junit.Test)

Aggregations

DomainType (net.opengis.ows.v_1_0_0.DomainType)13 ArrayList (java.util.ArrayList)8 Operation (net.opengis.ows.v_1_0_0.Operation)8 OperationsMetadata (net.opengis.ows.v_1_0_0.OperationsMetadata)4 CapabilitiesType (net.opengis.cat.csw.v_2_0_2.CapabilitiesType)3 ConformanceType (net.opengis.filter.v_2_0_0.ConformanceType)3 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)3 DomainType (net.opengis.ows.v_1_1_0.DomainType)3 ValueType (net.opengis.ows.v_1_1_0.ValueType)3 Test (org.junit.Test)3 GetCapabilitiesType (net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType)2 GetCapabilitiesRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest)2 Joiner (com.google.common.base.Joiner)1 Sets (com.google.common.collect.Sets)1 Metacard (ddf.catalog.data.Metacard)1 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)1 SortByImpl (ddf.catalog.filter.impl.SortByImpl)1 QueryImpl (ddf.catalog.operation.impl.QueryImpl)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1