Search in sources :

Example 1 with OwsMetadata

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

the class AbstractCapabilitiesBaseTypeDecoder method parseDomain.

private OwsDomain parseDomain(DomainType domain) {
    if (domain == null) {
        return null;
    }
    OwsValue defaultValue = parseValue(domain.getDefaultValue());
    Collection<OwsMetadata> metadata = parseMetadata(domain.getMetadataArray());
    OwsDomainMetadata meaning = parseDomainMetadata(domain.getMeaning());
    OwsDomainMetadata dataType = parseDomainMetadata(domain.getDataType());
    OwsValuesUnit valuesUnit = Stream.of(parseUom(domain.getUOM()), parseReferenceSystem(domain.getReferenceSystem())).filter(Objects::nonNull).findFirst().orElse(null);
    OwsPossibleValues possibleValues = Stream.of(parseAnyValue(domain.getAnyValue()), parseAllowedValues(domain.getAllowedValues()), parseValuesReference(domain.getValuesReference()), parseNoValues(domain.getNoValues())).filter(Objects::nonNull).findFirst().orElse(null);
    return new OwsDomain(domain.getName(), possibleValues, defaultValue, meaning, dataType, valuesUnit, metadata);
}
Also used : OwsDomain(org.n52.shetland.ogc.ows.OwsDomain) OwsDomainMetadata(org.n52.shetland.ogc.ows.OwsDomainMetadata) OwsMetadata(org.n52.shetland.ogc.ows.OwsMetadata) OwsValuesUnit(org.n52.shetland.ogc.ows.OwsValuesUnit) Objects(java.util.Objects) OwsPossibleValues(org.n52.shetland.ogc.ows.OwsPossibleValues) OwsValue(org.n52.shetland.ogc.ows.OwsValue)

Example 2 with OwsMetadata

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

the class AbstractCapabilitiesBaseTypeDecoder method parseMetadata.

// private Set<OwsDomainMetadata> parseDomainMetadata(DomainMetadataType[]
// metadata) {
// return
// Optional.ofNullable(metadata).map(Arrays::stream).orElseGet(Stream::empty).map(this::parseDomainMetadata)
// .filter(Objects::nonNull).collect(toSet());
// }
private OwsMetadata parseMetadata(MetadataType metadata) {
    if (metadata == null) {
        return null;
    }
    URI href = Optional.ofNullable(metadata.getHref()).map(Strings::emptyToNull).map(URI::create).orElse(null);
    URI role = Optional.ofNullable(metadata.getRole()).map(Strings::emptyToNull).map(URI::create).orElse(null);
    URI arcrole = Optional.ofNullable(metadata.getArcrole()).map(Strings::emptyToNull).map(URI::create).orElse(null);
    Show show = Optional.ofNullable(metadata.getShow()).map(Object::toString).map(Show::valueOf).orElse(null);
    Actuate actuate = Optional.ofNullable(metadata.getActuate()).map(Object::toString).map(Actuate::valueOf).orElse(null);
    URI about = Optional.ofNullable(metadata.getAbout()).map(Strings::emptyToNull).map(URI::create).orElse(null);
    String title = metadata.getTitle();
    return new OwsMetadata(href, role, arcrole, title, show, actuate, about);
}
Also used : Actuate(org.n52.shetland.w3c.xlink.Actuate) OwsMetadata(org.n52.shetland.ogc.ows.OwsMetadata) Show(org.n52.shetland.w3c.xlink.Show) XmlObject(org.apache.xmlbeans.XmlObject) LocalizedString(org.n52.janmayen.i18n.LocalizedString) MultilingualString(org.n52.janmayen.i18n.MultilingualString) OwsLanguageString(org.n52.shetland.ogc.ows.OwsLanguageString) URI(java.net.URI) Strings(com.google.common.base.Strings)

Example 3 with OwsMetadata

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

the class OwsEncoderv110 method encode.

@Override
public XmlObject encode(Object element, EncodingContext additionalValues) throws EncodingException {
    if (element instanceof OwsServiceIdentification) {
        return encodeServiceIdentification((OwsServiceIdentification) element);
    } else if (element instanceof OwsServiceProvider) {
        return encodeServiceProvider((OwsServiceProvider) element);
    } else if (element instanceof OwsOperationsMetadata) {
        return encodeOperationsMetadata((OwsOperationsMetadata) element);
    } else if (element instanceof OwsExceptionReport) {
        if (isEncodeExceptionsOnly(additionalValues) && !((OwsExceptionReport) element).getExceptions().isEmpty()) {
            return encodeOwsException(((OwsExceptionReport) element).getExceptions().get(0));
        }
        return encodeOwsExceptionReport((OwsExceptionReport) element);
    } else if (element instanceof OwsMetadata) {
        MetadataType metadataType = MetadataType.Factory.newInstance(getXmlOptions());
        encodeOwsMetadata((OwsMetadata) element, metadataType);
        return metadataType;
    } else if (element instanceof OwsDomain) {
        DomainType domainType = DomainType.Factory.newInstance(getXmlOptions());
        encodeOwsDomain((OwsDomain) element, domainType);
        return domainType;
    } else if (element instanceof OwsAcceptVersions) {
        return encodeAcceptVersions((OwsAcceptVersions) element);
    } else if (element instanceof OwsSections) {
        return encodeSections((OwsSections) element);
    }
    throw new UnsupportedEncoderInputException(this, element);
}
Also used : OwsDomain(org.n52.shetland.ogc.ows.OwsDomain) DomainType(net.opengis.ows.x11.DomainType) OwsOperationsMetadata(org.n52.shetland.ogc.ows.OwsOperationsMetadata) OwsMetadata(org.n52.shetland.ogc.ows.OwsMetadata) OwsSections(org.n52.shetland.ogc.ows.OwsSections) OwsServiceProvider(org.n52.shetland.ogc.ows.OwsServiceProvider) MetadataType(net.opengis.ows.x11.MetadataType) DomainMetadataType(net.opengis.ows.x11.DomainMetadataType) OwsServiceIdentification(org.n52.shetland.ogc.ows.OwsServiceIdentification) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport) OwsAcceptVersions(org.n52.shetland.ogc.ows.OwsAcceptVersions) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)

Aggregations

OwsMetadata (org.n52.shetland.ogc.ows.OwsMetadata)3 OwsDomain (org.n52.shetland.ogc.ows.OwsDomain)2 Strings (com.google.common.base.Strings)1 URI (java.net.URI)1 Objects (java.util.Objects)1 DomainMetadataType (net.opengis.ows.x11.DomainMetadataType)1 DomainType (net.opengis.ows.x11.DomainType)1 MetadataType (net.opengis.ows.x11.MetadataType)1 XmlObject (org.apache.xmlbeans.XmlObject)1 LocalizedString (org.n52.janmayen.i18n.LocalizedString)1 MultilingualString (org.n52.janmayen.i18n.MultilingualString)1 OwsAcceptVersions (org.n52.shetland.ogc.ows.OwsAcceptVersions)1 OwsDomainMetadata (org.n52.shetland.ogc.ows.OwsDomainMetadata)1 OwsLanguageString (org.n52.shetland.ogc.ows.OwsLanguageString)1 OwsOperationsMetadata (org.n52.shetland.ogc.ows.OwsOperationsMetadata)1 OwsPossibleValues (org.n52.shetland.ogc.ows.OwsPossibleValues)1 OwsSections (org.n52.shetland.ogc.ows.OwsSections)1 OwsServiceIdentification (org.n52.shetland.ogc.ows.OwsServiceIdentification)1 OwsServiceProvider (org.n52.shetland.ogc.ows.OwsServiceProvider)1 OwsValue (org.n52.shetland.ogc.ows.OwsValue)1