Search in sources :

Example 1 with Role

use of org.n52.shetland.ogc.sensorML.Role in project arctic-sea by 52North.

the class SamplingFeatureComplexTest method should_set_relatedSamplingFeature_correct.

@Test
public void should_set_relatedSamplingFeature_correct() {
    final SamplingFeature feature = new SamplingFeature(new CodeWithAuthority("test-feature"));
    final SamplingFeatureComplex sfc = new SamplingFeatureComplex("test-role", feature);
    assertThat(sfc.getRelatedSamplingFeature(), is(feature));
}
Also used : SamplingFeatureComplex(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex) SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature) CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) Test(org.junit.Test)

Example 2 with Role

use of org.n52.shetland.ogc.sensorML.Role in project arctic-sea by 52North.

the class SamplingFeatureTest method addRelatedSamplingFeature_should_add_a_relatedSamplingFeature.

@Test
public final void addRelatedSamplingFeature_should_add_a_relatedSamplingFeature() {
    final SamplingFeature feature = new SamplingFeature(null);
    final SamplingFeatureComplex relatedSamplingFeature = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature")));
    feature.addRelatedSamplingFeature(relatedSamplingFeature);
    assertThat(feature.isSetRelatedSamplingFeatures(), is(TRUE));
    assertThat(feature.getRelatedSamplingFeatures(), hasSize(1));
    assertThat(feature.getRelatedSamplingFeatures().get(0), is(relatedSamplingFeature));
    final SamplingFeatureComplex relatedSamplingFeature2 = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature-2")));
    feature.addRelatedSamplingFeature(relatedSamplingFeature2);
    validate(feature, relatedSamplingFeature, relatedSamplingFeature2);
    feature.addRelatedSamplingFeature(null);
    validate(feature, relatedSamplingFeature, relatedSamplingFeature2);
}
Also used : SamplingFeatureComplex(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex) SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature) CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) Test(org.junit.Test)

Example 3 with Role

use of org.n52.shetland.ogc.sensorML.Role in project arctic-sea by 52North.

the class SamplingFeatureTest method addAllRelatedSamplingFeatures_should_add_all_elements.

@Test
public final void addAllRelatedSamplingFeatures_should_add_all_elements() {
    final SamplingFeature feature = new SamplingFeature(null);
    final SamplingFeatureComplex relatedSamplingFeature = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature")));
    final SamplingFeatureComplex relatedSamplingFeature2 = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature-2")));
    List<SamplingFeatureComplex> list = Lists.newArrayList(relatedSamplingFeature, relatedSamplingFeature2);
    feature.addAllRelatedSamplingFeatures(list);
    validate(feature, relatedSamplingFeature, relatedSamplingFeature2);
    final SamplingFeatureComplex relatedSamplingFeature3 = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature-3")));
    final SamplingFeatureComplex relatedSamplingFeature4 = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature-4")));
    list = Lists.newArrayList(relatedSamplingFeature3, relatedSamplingFeature4);
    feature.addAllRelatedSamplingFeatures(list);
    validate(feature, relatedSamplingFeature, relatedSamplingFeature2, relatedSamplingFeature3, relatedSamplingFeature4);
}
Also used : SamplingFeatureComplex(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex) SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature) CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) Test(org.junit.Test)

Example 4 with Role

use of org.n52.shetland.ogc.sensorML.Role in project arctic-sea by 52North.

the class AbstractCapabilitiesBaseTypeDecoder method parseOnlineResource.

private OwsOnlineResource parseOnlineResource(OnlineResourceType onlineResource) {
    if (onlineResource == null) {
        return null;
    }
    URI href = Optional.ofNullable(onlineResource.getHref()).map(Strings::emptyToNull).map(URI::create).orElse(null);
    URI role = Optional.ofNullable(onlineResource.getRole()).map(Strings::emptyToNull).map(URI::create).orElse(null);
    URI arcrole = Optional.ofNullable(onlineResource.getArcrole()).map(Strings::emptyToNull).map(URI::create).orElse(null);
    Show show = Optional.ofNullable(onlineResource.getShow()).map(Object::toString).map(Show::valueOf).orElse(null);
    Actuate actuate = Optional.ofNullable(onlineResource.getActuate()).map(Object::toString).map(Actuate::valueOf).orElse(null);
    String title = onlineResource.getTitle();
    return new OwsOnlineResource(href, role, arcrole, title, show, actuate);
}
Also used : OwsOnlineResource(org.n52.shetland.ogc.ows.OwsOnlineResource) Actuate(org.n52.shetland.w3c.xlink.Actuate) 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 5 with Role

use of org.n52.shetland.ogc.sensorML.Role 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)

Aggregations

Test (org.junit.Test)6 CodeWithAuthority (org.n52.shetland.ogc.gml.CodeWithAuthority)6 SamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)6 SamplingFeatureComplex (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex)6 LocalizedString (org.n52.janmayen.i18n.LocalizedString)4 MultilingualString (org.n52.janmayen.i18n.MultilingualString)4 OwsLanguageString (org.n52.shetland.ogc.ows.OwsLanguageString)4 Strings (com.google.common.base.Strings)3 URI (java.net.URI)3 XmlObject (org.apache.xmlbeans.XmlObject)3 Actuate (org.n52.shetland.w3c.xlink.Actuate)3 Show (org.n52.shetland.w3c.xlink.Show)3 OwsCode (org.n52.shetland.ogc.ows.OwsCode)2 OwsContact (org.n52.shetland.ogc.ows.OwsContact)2 OwsOnlineResource (org.n52.shetland.ogc.ows.OwsOnlineResource)2 OwsResponsibleParty (org.n52.shetland.ogc.ows.OwsResponsibleParty)2 ReferenceType (org.n52.shetland.ogc.gml.ReferenceType)1 OwsAddress (org.n52.shetland.ogc.ows.OwsAddress)1 OwsDomain (org.n52.shetland.ogc.ows.OwsDomain)1 OwsMetadata (org.n52.shetland.ogc.ows.OwsMetadata)1