Search in sources :

Example 6 with OwsValue

use of org.n52.shetland.ogc.ows.OwsValue 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 7 with OwsValue

use of org.n52.shetland.ogc.ows.OwsValue in project arctic-sea by 52North.

the class AbstractGetCapabilitiesHandler method getAcceptVersionsDomain.

private OwsDomain getAcceptVersionsDomain(String service) {
    Set<String> supportedVersions = this.serviceOperatorRepository.getSupportedVersions(service);
    OwsValue defaultValue = new OwsValue(Comparables.version().max(supportedVersions));
    OwsPossibleValues possibleValues = new OwsAllowedValues(supportedVersions.stream().map(OwsValue::new));
    return new OwsDomain(GetCapabilitiesParams.AcceptVersions, possibleValues, defaultValue);
}
Also used : OwsDomain(org.n52.shetland.ogc.ows.OwsDomain) OwsAllowedValues(org.n52.shetland.ogc.ows.OwsAllowedValues) OwsPossibleValues(org.n52.shetland.ogc.ows.OwsPossibleValues) OwsValue(org.n52.shetland.ogc.ows.OwsValue)

Example 8 with OwsValue

use of org.n52.shetland.ogc.ows.OwsValue in project arctic-sea by 52North.

the class AbstractGetCapabilitiesHandler method getAcceptFormatsDomain.

private OwsDomain getAcceptFormatsDomain() {
    OwsValue defaultValue = new OwsValue(MediaTypes.APPLICATION_XML.toString());
    OwsPossibleValues possibleValues = new OwsAllowedValues(defaultValue);
    return new OwsDomain(GetCapabilitiesParams.AcceptFormats, possibleValues, defaultValue);
}
Also used : OwsDomain(org.n52.shetland.ogc.ows.OwsDomain) OwsAllowedValues(org.n52.shetland.ogc.ows.OwsAllowedValues) OwsPossibleValues(org.n52.shetland.ogc.ows.OwsPossibleValues) OwsValue(org.n52.shetland.ogc.ows.OwsValue)

Example 9 with OwsValue

use of org.n52.shetland.ogc.ows.OwsValue in project arctic-sea by 52North.

the class AbstractCapabilitiesBaseTypeDecoder method parseRange.

private OwsRange parseRange(RangeType range) {
    if (range == null) {
        return null;
    }
    OwsValue upperBound = parseValue(range.getMaximumValue());
    OwsValue lowerBound = parseValue(range.getMinimumValue());
    OwsValue spacing = parseValue(range.getSpacing());
    String type = null;
    if (range.isSetRangeClosure() && !range.getRangeClosure().isEmpty()) {
        type = (String) range.getRangeClosure().get(0);
    }
    return new OwsRange(lowerBound, upperBound, type, spacing);
}
Also used : OwsRange(org.n52.shetland.ogc.ows.OwsRange) LocalizedString(org.n52.janmayen.i18n.LocalizedString) MultilingualString(org.n52.janmayen.i18n.MultilingualString) OwsLanguageString(org.n52.shetland.ogc.ows.OwsLanguageString) OwsValue(org.n52.shetland.ogc.ows.OwsValue)

Aggregations

OwsDomain (org.n52.shetland.ogc.ows.OwsDomain)8 OwsValue (org.n52.shetland.ogc.ows.OwsValue)8 OwsAllowedValues (org.n52.shetland.ogc.ows.OwsAllowedValues)7 OwsPossibleValues (org.n52.shetland.ogc.ows.OwsPossibleValues)6 LocaleHelper (org.n52.janmayen.i18n.LocaleHelper)3 OwsMetadata (org.n52.shetland.ogc.ows.OwsMetadata)3 URI (java.net.URI)2 Collections (java.util.Collections)2 Locale (java.util.Locale)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 Set (java.util.Set)2 Stream (java.util.stream.Stream)2 Configurable (org.n52.faroe.annotation.Configurable)2 Setting (org.n52.faroe.annotation.Setting)2 HTTPMethods (org.n52.janmayen.http.HTTPMethods)2 OwsDCP (org.n52.shetland.ogc.ows.OwsDCP)2 OwsDomainMetadata (org.n52.shetland.ogc.ows.OwsDomainMetadata)2 OwsHttp (org.n52.shetland.ogc.ows.OwsHttp)2