Search in sources :

Example 1 with OwsDomainMetadata

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

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

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

the class AbstractCapabilitiesBaseTypeDecoder method parse.

private <T extends OwsDomainMetadata> T parse(BiFunction<URI, String, T> fun, DomainMetadataType metadata) {
    if (metadata == null) {
        return null;
    }
    URI reference = Optional.ofNullable(metadata.getReference()).map(Strings::emptyToNull).map(URI::create).orElse(null);
    String value = metadata.getStringValue();
    return fun.apply(reference, value);
}
Also used : 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)

Aggregations

Strings (com.google.common.base.Strings)2 URI (java.net.URI)2 LocalizedString (org.n52.janmayen.i18n.LocalizedString)2 MultilingualString (org.n52.janmayen.i18n.MultilingualString)2 OwsLanguageString (org.n52.shetland.ogc.ows.OwsLanguageString)2 OwsMetadata (org.n52.shetland.ogc.ows.OwsMetadata)2 Objects (java.util.Objects)1 XmlObject (org.apache.xmlbeans.XmlObject)1 OwsDomain (org.n52.shetland.ogc.ows.OwsDomain)1 OwsDomainMetadata (org.n52.shetland.ogc.ows.OwsDomainMetadata)1 OwsPossibleValues (org.n52.shetland.ogc.ows.OwsPossibleValues)1 OwsValue (org.n52.shetland.ogc.ows.OwsValue)1 OwsValuesUnit (org.n52.shetland.ogc.ows.OwsValuesUnit)1 Actuate (org.n52.shetland.w3c.xlink.Actuate)1 Show (org.n52.shetland.w3c.xlink.Show)1