use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class ProfileValueTest method createProfileLevel.
private List<Value<?>> createProfileLevel() {
List<Value<?>> list = Lists.newArrayList();
CategoryValue category = new CategoryValue("weathered grey brown basalt", "unknown");
category.setDefinition("http://www.opengis.net/def/gwml/2.0/observedProperty/earthMaterial");
category.addName(new CodeType("lithology"));
list.add(category);
return list;
}
use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class SmlClassifierTest method shouldReturnFalseIfCodeSpaceIsEmptyOrNotSet.
@Test
public void shouldReturnFalseIfCodeSpaceIsEmptyOrNotSet() {
final String codeSpace = null;
final SmlClassifier smlClassifier = new SmlClassifier("name", "definition", codeSpace, "value");
assertThat(smlClassifier.isSetCodeSpace(), is(false));
smlClassifier.setCodeSpace("");
assertThat(smlClassifier.isSetCodeSpace(), is(false));
}
use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class JsonSettingsDao method createSettingValue.
protected SettingValue<?> createSettingValue(String key, JsonNode node) {
SettingType type = SettingType.fromString(node.path(JSONSettingConstants.TYPE_KEY).asText(null));
Object value = decodeValue(type, node.path(JSONSettingConstants.VALUE_KEY));
return new JsonSettingValue<>(type, key, value);
}
use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class OmObservation method convertSingleValueToMultiValue.
/**
* Convert {@link SingleObservationValue} to {@link TVPValue}.
*
* @param singleValue
* Single observation value
*
* @return Converted TVPValue value
*/
public TVPValue convertSingleValueToMultiValue(final SingleObservationValue<?> singleValue) {
MultiObservationValues<List<TimeValuePair>> multiValue = new MultiObservationValues<>();
TVPValue tvpValue = new TVPValue();
if (singleValue.isSetUnit()) {
tvpValue.setUnit(singleValue.getUnit());
} else if (singleValue.getValue().isSetUnit()) {
tvpValue.setUnit(singleValue.getValue().getUnit());
}
if (singleValue.isSetMetadata()) {
multiValue.setMetadata(singleValue.getMetadata());
}
if (singleValue.isSetDefaultPointMetadata()) {
multiValue.setDefaultPointMetadata(singleValue.getDefaultPointMetadata());
}
TimeValuePair timeValuePair = new TimeValuePair(singleValue.getPhenomenonTime(), singleValue.getValue());
tvpValue.addValue(timeValuePair);
multiValue.setValue(tvpValue);
value = multiValue;
return tvpValue;
}
use of org.n52.shetland.ogc.om.values.Value in project arctic-sea by 52North.
the class ProfileLevel method valueAsDataRecord.
public SweDataRecord valueAsDataRecord(SweDataRecord dataRecord) {
int counter = 0;
for (Value<?> v : getValue()) {
if (v instanceof SweAbstractDataComponent) {
SweAbstractDataComponent adc = (SweAbstractDataComponent) v;
String name;
if (adc.isSetName()) {
name = adc.getName().getValue();
} else if (adc.isSetDefinition()) {
name = adc.getDefinition();
} else {
name = "component_" + counter++;
}
dataRecord.addField(new SweField(name, adc));
}
}
return dataRecord;
}
Aggregations