Search in sources :

Example 86 with Value

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;
}
Also used : CategoryValue(org.n52.shetland.ogc.om.values.CategoryValue) ProfileValue(org.n52.shetland.ogc.om.values.ProfileValue) QuantityValue(org.n52.shetland.ogc.om.values.QuantityValue) Value(org.n52.shetland.ogc.om.values.Value) CategoryValue(org.n52.shetland.ogc.om.values.CategoryValue) CodeType(org.n52.shetland.ogc.gml.CodeType)

Example 87 with Value

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));
}
Also used : SmlClassifier(org.n52.shetland.ogc.sensorML.elements.SmlClassifier) Test(org.junit.Test)

Example 88 with Value

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);
}
Also used : SettingType(org.n52.faroe.SettingType)

Example 89 with 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;
}
Also used : TVPValue(org.n52.shetland.ogc.om.values.TVPValue) List(java.util.List)

Example 90 with Value

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;
}
Also used : SweField(org.n52.shetland.ogc.swe.SweField) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent)

Aggregations

XmlObject (org.apache.xmlbeans.XmlObject)28 Test (org.junit.Test)27 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)20 IoParameters (org.n52.io.request.IoParameters)19 SweField (org.n52.shetland.ogc.swe.SweField)16 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)13 QuantityValue (org.n52.shetland.ogc.om.values.QuantityValue)13 RequestSimpleParameterSet (org.n52.io.request.RequestSimpleParameterSet)12 List (java.util.List)9 SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)9 AnyScalarPropertyType (net.opengis.swe.x101.AnyScalarPropertyType)7 CategoryValue (org.n52.shetland.ogc.om.values.CategoryValue)7 CountValue (org.n52.shetland.ogc.om.values.CountValue)7 SweBoolean (org.n52.shetland.ogc.swe.simpleType.SweBoolean)7 SweText (org.n52.shetland.ogc.swe.simpleType.SweText)7 DecodingException (org.n52.svalbard.decode.exception.DecodingException)7 DateTime (org.joda.time.DateTime)6 ModelAndView (org.springframework.web.servlet.ModelAndView)6 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)5 ArrayList (java.util.ArrayList)5