use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class JSONDecoder method parseCodeWithAuthority.
protected CodeWithAuthority parseCodeWithAuthority(JsonNode node) {
if (node.isObject()) {
String value = node.path(JSONConstants.VALUE).textValue();
String codespace = node.path(JSONConstants.CODESPACE).textValue();
if (codespace == null || codespace.isEmpty()) {
codespace = OGCConstants.UNKNOWN;
}
return new CodeWithAuthority(value, codespace);
} else if (node.isTextual()) {
return new CodeWithAuthority(node.textValue(), OGCConstants.UNKNOWN);
} else {
return null;
}
}
use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class CountObservationDecodingTest method testObservation.
@Test
public void testObservation() {
assertThat(observation, is(notNullValue()));
final String type = observation.getObservationConstellation().getObservationType();
assertThat(type, is(equalTo(OmConstants.OBS_TYPE_COUNT_OBSERVATION)));
final ObservationValue<?> value = observation.getValue();
assertThat(value, is(instanceOf(SingleObservationValue.class)));
assertThat(value.getPhenomenonTime(), is(instanceOf(TimeInstant.class)));
TimeInstant pt = (TimeInstant) value.getPhenomenonTime();
assertThat(pt.getValue(), is(equalTo(phenomenonTime)));
assertThat(value.getValue(), is(instanceOf(CountValue.class)));
CountValue v = (CountValue) value.getValue();
assertThat(v.getValue(), is(1));
assertThat(v.getUnit(), is(nullValue()));
}
use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class AbstractCapabilitiesBaseTypeDecoder method parseValuesReference.
private OwsValuesReference parseValuesReference(ValuesReference valuesReference) {
if (valuesReference == null) {
return null;
}
URI reference = Optional.ofNullable(valuesReference.getReference()).map(Strings::emptyToNull).map(URI::create).orElse(null);
String value = valuesReference.getStringValue();
return new OwsValuesReference(reference, value);
}
use of org.n52.shetland.ogc.om.values.Value 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);
}
use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class TruthObservationDecodingTest method testObservation.
@Test
public void testObservation() {
assertThat(observation, is(notNullValue()));
final String type = observation.getObservationConstellation().getObservationType();
assertThat(type, is(equalTo(OmConstants.OBS_TYPE_TRUTH_OBSERVATION)));
final ObservationValue<?> value = observation.getValue();
assertThat(value, is(instanceOf(SingleObservationValue.class)));
assertThat(value.getPhenomenonTime(), is(instanceOf(TimeInstant.class)));
TimeInstant pt = (TimeInstant) value.getPhenomenonTime();
assertThat(pt.getValue(), is(equalTo(phenomenonTime)));
assertThat(value.getValue(), is(instanceOf(BooleanValue.class)));
BooleanValue v = (BooleanValue) value.getValue();
assertThat(v.getValue(), is(true));
assertThat(v.getUnit(), is(nullValue()));
}
Aggregations