Search in sources :

Example 1 with AllowedValues

use of net.opengis.swe.x101.AllowedValuesDocument.AllowedValues 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)

Aggregations

Joiner (com.google.common.base.Joiner)1 Sets (com.google.common.collect.Sets)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 SortedSet (java.util.SortedSet)1 Supplier (java.util.function.Supplier)1 Collectors.groupingBy (java.util.stream.Collectors.groupingBy)1 Collectors.mapping (java.util.stream.Collectors.mapping)1 Collectors.toList (java.util.stream.Collectors.toList)1 Stream (java.util.stream.Stream)1 AcceptVersionsType (net.opengis.ows.x11.AcceptVersionsType)1 AddressType (net.opengis.ows.x11.AddressType)1